:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #f9fbfd;
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #66758a;
  --faint: #95a3b7;
  --border: #dfe7f0;
  --border-strong: #cbd7e4;
  --nav: #071326;
  --nav-soft: #111d33;
  --nav-active: rgba(255, 255, 255, 0.1);
  --nav-line: rgba(255, 255, 255, 0.12);
  --green: #0f8a73;
  --green-dark: #08715e;
  --green-soft: #e9f7f2;
  --blue: #2d6cdf;
  --blue-soft: #edf4ff;
  --red: #b42318;
  --amber: #b45309;
  --shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
  --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.04);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

body.detail-open {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  align-items: center;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 760;
  gap: 8px;
  justify-content: center;
  letter-spacing: 0;
  min-height: 34px;
  padding: 8px 12px;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    transform 150ms ease,
    box-shadow 150ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

input,
textarea {
  background: #fff;
  border: 1px solid #dbe4ee;
  border-radius: 7px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 620;
  line-height: 1.4;
  min-height: 33px;
  outline: none;
  padding: 8px 10px;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
  width: 100%;
}

input:focus,
textarea:focus {
  border-color: rgba(15, 138, 115, 0.65);
  box-shadow: 0 0 0 3px rgba(15, 138, 115, 0.11);
}

textarea {
  min-height: 70px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #8291a6;
  font-weight: 560;
}

.app-shell {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  height: 100vh;
  min-height: 760px;
  overflow: hidden;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(30, 45, 75, 0.72), transparent 210px),
    var(--nav);
  color: #e7edf7;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: auto;
  padding: 18px 10px 14px;
}

.brand {
  align-items: center;
  display: flex;
  gap: 10px;
  min-height: 36px;
  padding: 0 6px 22px;
}

.brand-mark {
  align-items: center;
  background: #f8fbff;
  border-radius: 7px;
  color: var(--green);
  display: flex;
  flex: 0 0 28px;
  font-size: 16px;
  font-weight: 950;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.brand h1,
.brand p,
.customer-header h2,
.customer-header p,
.channel-head h3,
.section-title h3,
.send-state {
  margin: 0;
}

.brand h1 {
  color: #fff;
  font-size: 19px;
  font-weight: 850;
  line-height: 1;
}

.sidebar-nav {
  display: grid;
  gap: 3px;
  padding-bottom: 22px;
}

.sidebar-nav button {
  background: transparent;
  color: #d4ddec;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  justify-content: stretch;
  min-height: 34px;
  padding: 8px 10px;
  text-align: left;
  width: 100%;
}

.sidebar-nav button span {
  color: #aebad0;
  font-size: 14px;
  line-height: 1;
}

.sidebar-nav button:hover,
.sidebar-nav button.active {
  background: var(--nav-active);
  color: #fff;
  transform: none;
}

.sidebar-section {
  display: grid;
  gap: 9px;
}

.provider-section {
  border-top: 1px solid var(--nav-line);
  margin-top: auto;
  padding-top: 20px;
}

.sidebar-heading {
  align-items: center;
  color: #aab5c6;
  display: flex;
  font-size: 10px;
  font-weight: 840;
  justify-content: space-between;
  letter-spacing: 0.08em;
  padding: 0 4px;
  text-transform: uppercase;
}

.sidebar-heading-actions {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.mini-action,
.mini-count {
  background: transparent;
  color: #c7d2e4;
}

.mini-action {
  border: 0;
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
  min-height: 22px;
  min-width: 22px;
  padding: 0;
}

.mini-action:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: none;
}

.mini-count,
.count-pill {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 850;
  justify-content: center;
  min-height: 22px;
  min-width: 22px;
  padding: 0 7px;
}

.mini-count {
  background: rgba(255, 255, 255, 0.09);
}

.persona-list,
.state-list,
.message-list,
.endpoint-stack {
  display: grid;
}

.persona-list {
  gap: 7px;
}

.persona-button {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  color: #e5ecf7;
  display: grid;
  justify-content: stretch;
  min-height: 74px;
  padding: 12px 12px;
  position: relative;
  text-align: left;
  width: 100%;
}

.persona-button:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: none;
}

.persona-button.active {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.05)),
    #17233a;
  border-color: rgba(255, 255, 255, 0.13);
  box-shadow: inset -3px 0 0 var(--green);
}

.persona-topline,
.header-left,
.title-line,
.header-actions,
.metric-card,
.section-title.with-action,
.channel-head,
.channel-title,
.channel-tools,
.composer-actions,
.message-meta-top,
.message-route,
.message-status,
.endpoint-row,
.locale-row,
.sidebar-profile {
  align-items: center;
  display: flex;
}

.persona-topline {
  gap: 10px;
  min-width: 0;
}

.persona-topline > span:last-child {
  min-width: 0;
}

.persona-initial {
  align-items: center;
  background: #0d1b33;
  border-radius: 7px;
  color: #fff;
  display: flex;
  flex: 0 0 30px;
  font-size: 11px;
  font-weight: 900;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.persona-name,
.persona-address,
.persona-phone {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.persona-name {
  color: #fff;
  font-size: 13px;
  font-weight: 850;
  margin-bottom: 2px;
}

.persona-address,
.persona-phone {
  color: #b9c5d7;
  font-size: 11px;
  font-weight: 560;
  line-height: 1.4;
}

.state-list {
  gap: 7px;
}

.state-item {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--nav-line);
  border-radius: 7px;
  color: #d1d9e8;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 8px;
  padding: 10px 11px;
}

.state-item strong {
  color: #fff;
  font-size: 11px;
  font-weight: 820;
  grid-column: 1;
  line-height: 1.25;
}

.state-item span {
  color: #c4cfdf;
  font-size: 10px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.state-item span:first-of-type {
  grid-column: 1;
}

.state-item span:last-child {
  align-self: start;
  color: #5bd59d;
  font-size: 10px;
  font-weight: 800;
  grid-column: 2;
  grid-row: 1 / span 2;
  padding-left: 9px;
  position: relative;
}

.state-item span:last-child::before {
  background: currentColor;
  border-radius: 50%;
  content: "";
  height: 5px;
  left: 0;
  position: absolute;
  top: 5px;
  width: 5px;
}

.state-item.is-warn span:last-child {
  color: #f8c874;
}

.sidebar-profile {
  border-top: 1px solid var(--nav-line);
  gap: 10px;
  margin-top: 18px;
  padding: 14px 6px 0;
}

.profile-avatar {
  align-items: center;
  background: #34445d;
  border-radius: 50%;
  color: #fff;
  display: flex;
  flex: 0 0 28px;
  font-size: 12px;
  font-weight: 850;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.sidebar-profile span:nth-child(2) {
  display: grid;
  min-width: 0;
}

.sidebar-profile strong,
.sidebar-profile small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-profile strong {
  color: #fff;
  font-size: 12px;
  font-weight: 820;
}

.sidebar-profile small {
  color: #aab5c6;
  font-size: 11px;
}

.profile-caret {
  color: #aab5c6;
  margin-left: auto;
}

.main-surface {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
}

.customer-header {
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  min-height: 74px;
  padding: 14px 16px;
}

.header-left {
  gap: 12px;
  min-width: 0;
}

.back-button,
.icon-button {
  background: #fff;
  border: 1px solid var(--border);
  color: #52627a;
  flex: 0 0 auto;
  font-size: 20px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  width: 34px;
}

.back-button:hover,
.icon-button:hover {
  background: var(--surface-soft);
  transform: none;
}

.customer-title {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 0;
}

.customer-title > div:last-child {
  min-width: 0;
}

.customer-avatar {
  align-items: center;
  background: radial-gradient(circle at 30% 20%, #21a789, var(--green-dark));
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
  color: #fff;
  display: flex;
  flex: 0 0 46px;
  font-size: 14px;
  font-weight: 900;
  height: 46px;
  justify-content: center;
  width: 46px;
}

.title-line {
  gap: 9px;
  min-width: 0;
}

.customer-header h2 {
  color: #071326;
  font-size: 24px;
  font-weight: 860;
  line-height: 1.08;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-header p {
  color: #53657d;
  font-size: 12px;
  font-weight: 620;
  line-height: 1.4;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

#activeSubtitle {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-separator {
  color: #b4bfcd;
  margin: 0 7px;
}

.status-pill,
.run-state-pill {
  align-items: center;
  background: var(--green-soft);
  border-radius: 999px;
  color: var(--green);
  display: inline-flex;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1;
  min-height: 19px;
  padding: 4px 8px;
  text-transform: uppercase;
  white-space: nowrap;
  width: max-content;
}

.status-pill.active-soft {
  gap: 5px;
  letter-spacing: 0;
  text-transform: none;
}

.run-state-pill::before,
.activity-dot {
  background: currentColor;
  border-radius: 50%;
  content: "";
  flex: 0 0 7px;
  height: 7px;
  width: 7px;
}

.run-state-pill {
  gap: 7px;
}

.run-state-pill.is-inactive {
  background: #eef3f8;
  color: #728196;
}

.header-actions {
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.metric-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  color: var(--muted);
  gap: 9px;
  min-height: 48px;
  min-width: 94px;
  padding: 8px 13px;
}

.metric-icon {
  color: var(--blue);
  font-size: 15px;
}

.metric-icon.sms {
  color: var(--green);
}

.metric-card strong {
  color: var(--ink);
  display: block;
  font-size: 14px;
  font-weight: 870;
  line-height: 1.05;
}

.metric-card span:last-child {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.05;
}

.activity-card {
  min-width: 226px;
}

.activity-card .activity-dot {
  color: var(--green);
  box-shadow: 0 0 0 6px rgba(15, 138, 115, 0.1);
}

.activity-card small {
  color: var(--muted);
  display: block;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}

.secondary-button {
  background: #fff;
  border: 1px solid var(--border-strong);
  color: #1e2b3d;
}

.secondary-button:hover {
  background: var(--surface-soft);
  border-color: #b9c7d7;
}

.dashboard-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) 256px;
  min-height: 0;
  padding: 12px 14px 12px;
}

.channel-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 0;
}

.channel-panel,
.detail-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.channel-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.channel-head {
  justify-content: space-between;
  min-height: 56px;
  padding: 11px 14px 10px;
}

.channel-title {
  gap: 8px;
  min-width: 0;
}

.channel-icon {
  color: var(--blue);
  font-size: 15px;
}

.channel-icon.sms {
  color: var(--green);
}

.channel-head h3 {
  color: #152033;
  font-size: 14px;
  font-weight: 850;
  line-height: 1.2;
  white-space: nowrap;
}

.count-pill {
  background: var(--blue-soft);
  color: var(--blue);
  min-width: 21px;
}

.sms-panel .count-pill {
  background: var(--green-soft);
  color: var(--green);
}

.channel-tools {
  gap: 8px;
}

.compact-button {
  min-height: 31px;
  padding: 7px 10px;
}

.channel-tools .compact-button {
  min-width: 68px;
}

.channel-address {
  display: none;
}

.message-list {
  align-content: start;
  background: linear-gradient(180deg, #fbfdff, #fff);
  gap: 0;
  overflow: auto;
  padding: 8px 12px 0;
}

.timeline-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  min-width: 0;
  padding-bottom: 12px;
  position: relative;
}

.timeline-item::before {
  background: #dce7f2;
  bottom: -1px;
  content: "";
  left: 15px;
  position: absolute;
  top: 36px;
  width: 1px;
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-marker {
  align-items: center;
  background: var(--blue-soft);
  border: 1px solid #d5e5ff;
  border-radius: 50%;
  color: var(--blue);
  display: flex;
  font-size: 13px;
  font-weight: 900;
  height: 30px;
  justify-content: center;
  margin-top: 8px;
  width: 30px;
  z-index: 1;
}

.timeline-item.outbound .timeline-marker {
  background: var(--green-soft);
  border-color: #ccecdf;
  color: var(--green);
}

.message-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 11px 12px 10px;
}

.message-card:hover {
  border-color: #b9c9dc;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.message-card:focus-visible {
  outline: 3px solid rgba(45, 108, 223, 0.18);
  outline-offset: 2px;
}

.message-card.inbound {
  background: linear-gradient(180deg, #fff, #fbfdff);
}

.message-card.outbound {
  background: linear-gradient(180deg, #fff, #f7fffc);
  border-color: #cfe7df;
}

.message-meta-top {
  gap: 8px;
  justify-content: space-between;
}

.direction-pill {
  border-radius: 999px;
  font-size: 10px;
  font-weight: 920;
  letter-spacing: 0.06em;
  line-height: 1;
  padding: 4px 7px;
  text-transform: uppercase;
}

.message-card.inbound .direction-pill {
  background: var(--blue-soft);
  color: var(--blue);
}

.message-card.outbound .direction-pill {
  background: var(--green-soft);
  color: var(--green);
}

.direction-pill.inbound {
  background: var(--blue-soft);
  color: var(--blue);
}

.direction-pill.outbound {
  background: var(--green-soft);
  color: var(--green);
}

.message-time {
  color: #52647c;
  font-size: 10px;
  font-weight: 720;
  white-space: nowrap;
}

.message-route {
  color: #62748c;
  font-size: 11px;
  gap: 5px;
  min-width: 0;
}

.message-route span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-route .arrow {
  color: #aab7c6;
  flex: 0 0 auto;
}

.message-subject {
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.3;
}

.message-body {
  color: #40506a;
  font-size: 12px;
  font-weight: 520;
  line-height: 1.45;
  max-height: 165px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-status {
  color: #52647c;
  font-size: 11px;
  font-weight: 720;
  gap: 7px;
  text-transform: capitalize;
}

.open-message-hint {
  color: var(--blue);
  font-size: 10px;
  font-weight: 850;
  margin-left: auto;
  text-transform: none;
}

.status-check {
  color: var(--green);
  font-size: 12px;
}

.empty-state {
  align-items: center;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  font-size: 12px;
  gap: 5px;
  justify-items: center;
  margin: 4px 0 12px 42px;
  min-height: 132px;
  padding: 18px;
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
  font-size: 13px;
}

.composer {
  background: #fff;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 7px;
  padding: 8px 14px 12px;
}

.composer-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.composer-head strong {
  color: #152033;
  font-size: 12px;
  font-weight: 850;
}

.composer-head span {
  background: var(--green-soft);
  border-radius: 999px;
  color: var(--green);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  padding: 3px 7px;
  text-transform: uppercase;
}

.composer label {
  align-items: center;
  color: #52647c;
  display: grid;
  font-size: 11px;
  font-weight: 800;
  gap: 8px;
  grid-template-columns: 34px minmax(0, 1fr);
}

.composer label:has(textarea) {
  grid-template-columns: 1fr;
  gap: 4px;
}

.composer label:has(textarea) span {
  display: none;
}

.composer textarea {
  min-height: 58px;
}

.sms-composer textarea {
  min-height: 68px;
}

.composer-actions {
  gap: 8px;
  justify-content: space-between;
}

.composer-tools {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.composer-tools span {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #66758a;
  display: inline-flex;
  font-size: 12px;
  font-weight: 760;
  height: 24px;
  justify-content: center;
  min-width: 24px;
}

.send-state {
  color: var(--muted);
  flex: 1;
  font-size: 11px;
  line-height: 1.35;
  min-height: 15px;
}

.send-state.error {
  color: var(--red);
}

.composer button[type="submit"],
.form-actions button[type="submit"] {
  background: var(--green);
  box-shadow: 0 8px 14px rgba(15, 138, 115, 0.16);
  color: #fff;
}

.composer button[type="submit"] {
  min-width: 114px;
}

.composer button[type="submit"]:hover,
.form-actions button[type="submit"]:hover {
  background: var(--green-dark);
}

.inspector {
  align-content: start;
  display: grid;
  gap: 10px;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  min-height: 0;
  overflow: auto;
}

.detail-panel {
  box-shadow: var(--shadow-soft);
  padding: 14px;
}

.section-title {
  margin-bottom: 10px;
}

.section-title h3 {
  color: #142033;
  font-size: 14px;
  font-weight: 860;
  line-height: 1.2;
}

.section-title.with-action {
  gap: 10px;
  justify-content: space-between;
}

.text-action {
  background: transparent;
  color: #304158;
  font-size: 11px;
  font-weight: 820;
  min-height: 0;
  padding: 0;
  white-space: nowrap;
}

.text-action:hover {
  background: transparent;
  color: var(--green);
  transform: none;
}

.persona-form {
  display: grid;
  gap: 10px;
}

.persona-form label {
  color: #52647c;
  display: grid;
  font-size: 10px;
  font-weight: 820;
  gap: 5px;
}

.identity-panel .persona-form label {
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.identity-panel .persona-form input {
  border: 0;
  border-radius: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 830;
  min-height: 22px;
  padding: 0;
}

.identity-panel .persona-form input:focus {
  box-shadow: none;
}

.persona-form textarea {
  min-height: 70px;
}

.form-actions {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.form-actions > div {
  display: inline-flex;
  gap: 7px;
}

.danger-button {
  color: var(--red);
}

.identity-panel .danger-button {
  background: transparent;
  border-color: transparent;
  color: var(--red);
  min-height: 24px;
  padding: 0;
}

.identity-panel .danger-button:hover {
  background: transparent;
  border-color: transparent;
}

.locale-row {
  gap: 8px;
  margin-top: 12px;
}

.locale-row > span:first-child {
  color: #d71920;
  font-size: 10px;
}

.locale-row strong {
  border: 1px solid var(--border);
  border-radius: 999px;
  color: #223047;
  font-size: 11px;
  font-weight: 820;
  padding: 5px 9px;
}

.endpoint-stack {
  gap: 7px;
}

.endpoint-row {
  justify-content: space-between;
}

.run-summary {
  border-bottom: 1px solid var(--border);
  color: var(--ink-soft);
  display: grid;
  font-size: 12px;
  gap: 5px;
  margin-bottom: 10px;
  padding-bottom: 10px;
}

.run-summary strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.run-summary span {
  color: #40506a;
  line-height: 1.4;
}

.summary-label {
  color: var(--muted) !important;
  font-size: 10px;
  font-weight: 820;
  margin-top: 3px;
}

.run-token {
  background: #f3f7fb;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: #0f3d6b;
  display: block;
  font-size: 11px;
  overflow-wrap: anywhere;
  padding: 6px 8px;
}

.notes-panel textarea {
  min-height: 112px;
  resize: vertical;
}

.activity-panel {
  min-height: 0;
}

.activity-list {
  display: grid;
  gap: 0;
}

.activity-item {
  display: grid;
  gap: 8px;
  grid-template-columns: 42px 26px minmax(0, 1fr);
  min-height: 48px;
  position: relative;
}

.activity-item::before {
  background: #dfe8f2;
  bottom: -7px;
  content: "";
  left: 54px;
  position: absolute;
  top: 27px;
  width: 1px;
}

.activity-item:last-child::before {
  display: none;
}

.activity-time {
  color: #7b899a;
  font-size: 10px;
  font-weight: 650;
  padding-top: 5px;
  text-align: right;
}

.activity-icon {
  align-items: center;
  background: var(--green-soft);
  border-radius: 50%;
  color: var(--green);
  display: flex;
  font-size: 12px;
  font-weight: 900;
  height: 24px;
  justify-content: center;
  width: 24px;
  z-index: 1;
}

.activity-item strong {
  color: #142033;
  display: block;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.25;
}

.activity-item small {
  color: #66758a;
  display: block;
  font-size: 10px;
  line-height: 1.35;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.empty-activity {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  padding: 4px 0 2px;
}

.message-detail-overlay {
  align-items: stretch;
  background: rgba(7, 19, 38, 0.36);
  display: flex;
  inset: 0;
  justify-content: flex-end;
  padding: 12px;
  position: fixed;
  z-index: 40;
}

.message-detail-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(7, 19, 38, 0.22);
  max-width: 100%;
  min-height: 0;
  overflow: hidden;
  width: min(520px, calc(100vw - 24px));
}

.message-detail-shell {
  display: grid;
  gap: 14px;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  height: 100%;
  max-height: calc(100vh - 24px);
  overflow: auto;
  padding: 18px;
}

.message-detail-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding-bottom: 14px;
}

.message-detail-header h2 {
  color: var(--ink);
  font-size: 20px;
  font-weight: 860;
  line-height: 1.2;
  margin: 9px 0 4px;
  overflow-wrap: anywhere;
}

.message-detail-header p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin: 0;
}

.message-detail-header .icon-button {
  font-size: 18px;
}

.message-detail-meta {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.message-detail-meta div,
.message-detail-section {
  background: linear-gradient(180deg, #fff, #fbfdff);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px 11px;
}

.message-detail-meta span,
.message-detail-section span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.message-detail-meta strong,
.message-detail-section strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 780;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.message-body-section {
  align-content: start;
  min-height: 260px;
}

.message-body-tabs {
  align-items: center;
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.body-tab {
  background: #fff;
  border: 1px solid var(--border);
  color: #52647c;
  min-height: 28px;
  padding: 6px 9px;
}

.body-tab.active {
  background: var(--blue-soft);
  border-color: #cfe0ff;
  color: var(--blue);
}

.body-tab:disabled {
  display: none;
}

#messageDetailBody {
  color: #1d2b42;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.body-view-html {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 7px;
  min-height: 420px;
  width: 100%;
}

.message-id-section code {
  color: #40506a;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.login-overlay {
  align-items: center;
  background:
    linear-gradient(180deg, rgba(7, 19, 38, 0.84), rgba(7, 19, 38, 0.92)),
    var(--nav);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: fixed;
  z-index: 60;
}

.login-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  display: grid;
  gap: 12px;
  max-width: 100%;
  padding: 20px;
  width: 390px;
}

.login-brand {
  border: 0;
  padding: 0;
}

.login-brand h1 {
  color: var(--ink);
}

.login-panel h2 {
  color: var(--ink);
  font-size: 22px;
  line-height: 1.15;
  margin: 6px 0 0;
}

.login-panel p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
}

.login-panel label {
  color: #52647c;
  display: grid;
  font-size: 11px;
  font-weight: 820;
  gap: 6px;
}

.login-panel button[type="submit"] {
  background: var(--green);
  color: #fff;
}

@media (max-width: 1240px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .inspector {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto auto;
    overflow: visible;
  }
}

@media (max-width: 940px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .sidebar {
    gap: 14px;
    max-height: none;
  }

  .sidebar-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding-bottom: 8px;
  }

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

  .provider-section,
  .sidebar-profile {
    display: none;
  }

  .main-surface {
    overflow: visible;
  }

  .customer-header {
    align-items: flex-start;
    display: grid;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .channel-grid,
  .inspector {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .sidebar-nav {
    grid-template-columns: 1fr 1fr;
  }

  .persona-list {
    grid-template-columns: 1fr;
  }

  .customer-header,
  .dashboard-grid {
    padding-left: 10px;
    padding-right: 10px;
  }

  .header-left {
    align-items: flex-start;
  }

  .customer-title {
    align-items: flex-start;
  }

  .title-line {
    align-items: flex-start;
    display: grid;
  }

  .title-line .status-pill {
    justify-self: start;
  }

  .customer-header h2 {
    white-space: normal;
  }

  .metric-card,
  .activity-card {
    min-width: 0;
    width: 100%;
  }

  .channel-head {
    align-items: flex-start;
    display: grid;
    gap: 10px;
  }

  .channel-tools {
    justify-content: space-between;
    width: 100%;
  }

  .timeline-item {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .timeline-item::before {
    left: 14px;
  }

  .message-route {
    align-items: flex-start;
    display: grid;
    gap: 2px;
  }

  .message-route .arrow {
    display: none;
  }

  .message-route span {
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
  }

  .composer label {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .composer-actions {
    align-items: flex-start;
    display: grid;
  }

  .composer button[type="submit"] {
    width: 100%;
  }

  .activity-item {
    grid-template-columns: 34px 24px minmax(0, 1fr);
  }

  .activity-item::before {
    left: 45px;
  }

  .message-detail-overlay {
    padding: 0;
  }

  .message-detail-panel {
    border-radius: 0;
    width: 100vw;
  }

  .message-detail-shell {
    max-height: 100vh;
    padding: 14px;
  }

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