:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #f1f4f7;
  --line: #e5e9ef;
  --line-strong: #d7dde6;
  --text: #20252d;
  --muted: #667085;
  --subtle: #8a94a3;
  --teal: #0f766e;
  --teal-soft: #dff5f0;
  --blue: #2563eb;
  --blue-soft: #e6edff;
  --amber: #b7791f;
  --amber-soft: #fff4d6;
  --rose: #c2415d;
  --rose-soft: #ffe7ec;
  --green: #17803d;
  --shadow: 0 18px 48px rgba(34, 42, 53, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[hidden] {
  display: none !important;
}

.auth-screen {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 440px);
  align-items: center;
  min-height: 100vh;
  padding: 48px clamp(20px, 6vw, 84px);
  gap: clamp(28px, 7vw, 88px);
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.08), transparent 42%),
    #f7f9fb;
}

.auth-visual {
  display: grid;
  align-content: center;
  gap: 34px;
  min-height: 520px;
  padding: clamp(24px, 5vw, 56px);
  color: #ffffff;
  background:
    linear-gradient(rgba(24, 32, 43, 0.78), rgba(24, 32, 43, 0.78)),
    url("https://images.unsplash.com/photo-1557804506-669a67965ba0?auto=format&fit=crop&w=1200&q=80") center/cover;
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.auth-mark {
  width: 56px;
  height: 56px;
  border-radius: 14px;
}

.auth-brand p,
.auth-brand h1 {
  margin: 0;
}

.auth-brand p {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.auth-brand h1 {
  margin-top: 5px;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1;
  letter-spacing: 0;
}

.auth-preview {
  max-width: 470px;
  padding: 20px;
  color: #18202b;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 14px;
}

.preview-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.preview-row span {
  width: 10px;
  height: 10px;
  background: var(--green);
  border-radius: 50%;
}

.preview-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-row em {
  color: var(--subtle);
  font-size: 12px;
  font-style: normal;
}

.auth-preview p {
  margin: 14px 0;
  color: #3b4654;
  line-height: 1.7;
}

.preview-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preview-tags span {
  padding: 5px 9px;
  color: var(--teal);
  background: var(--teal-soft);
  border-radius: 8px;
  font-size: 12px;
}

.auth-panel {
  display: grid;
  gap: 18px;
  width: 100%;
  padding: 30px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(34, 42, 53, 0.1);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  background: var(--surface-soft);
  border-radius: 10px;
}

.auth-tabs button {
  min-height: 38px;
  border: 0;
  color: var(--muted);
  background: transparent;
  border-radius: 8px;
}

.auth-tabs button.active {
  color: var(--text);
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(34, 42, 53, 0.08);
}

.auth-panel h2 {
  margin: 5px 0 0;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

.auth-error {
  margin: 0;
  padding: 10px 12px;
  color: #9f1239;
  background: var(--rose-soft);
  border: 1px solid #fecdd3;
  border-radius: 9px;
  line-height: 1.5;
}

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

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 16px 10px;
  color: #596579;
  background: #18202b;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #ffffff;
  background: linear-gradient(135deg, #18a999, #2d6cdf);
  border-radius: 12px;
}

.brand-mark svg {
  width: 30px;
  height: 30px;
}

.brand-mark path:first-child {
  fill: currentColor;
  stroke: none;
  opacity: 0.95;
}

.brand-mark path:last-child {
  color: #18202b;
  stroke-width: 2.2;
}

.rail-nav,
.rail-bottom {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.rail-nav {
  flex: 1;
}

.rail-btn,
.avatar-btn,
.icon-btn {
  display: inline-grid;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
}

.rail-btn {
  width: 44px;
  height: 44px;
  color: #99a6b8;
  border-radius: 10px;
}

.rail-btn:hover,
.rail-btn.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.avatar-btn {
  width: 38px;
  height: 38px;
  color: #ffffff;
  background: #0f766e;
  border-radius: 50%;
  font-weight: 700;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 18px 16px;
  background: #fbfcfe;
  border-right: 1px solid var(--line);
}

.workspace {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
}

.workspace-label,
.eyebrow,
.menu-title,
.metric-card p,
.section-heading p,
.drawer-brand p,
.drawer-stats p,
.health-row p,
.dialog-body p {
  margin: 0;
  color: var(--subtle);
  font-size: 12px;
  line-height: 1.4;
}

.workspace h1,
.topbar h2,
.section-heading h3,
.insight-header h3,
.drawer-header h3,
.dialog-header h3 {
  margin: 0;
  color: var(--text);
  letter-spacing: 0;
}

.workspace h1 {
  margin-top: 3px;
  font-size: 20px;
  line-height: 1.2;
}

.icon-btn {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 9px;
}

.icon-btn:hover {
  color: var(--text);
  background: #e8edf3;
}

.menu-group {
  display: grid;
  gap: 7px;
}

.menu-title {
  padding: 0 10px;
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  text-align: left;
}

.menu-item strong {
  min-width: 30px;
  color: var(--subtle);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.menu-item:hover,
.menu-item.active {
  color: var(--blue);
  background: var(--blue-soft);
}

.menu-item.active strong {
  color: var(--blue);
}

.launch-box {
  display: flex;
  gap: 12px;
  margin-top: auto;
  padding: 14px;
  background: #eef8f6;
  border: 1px solid #cceae4;
  border-radius: 12px;
}

.launch-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  flex: 0 0 auto;
  color: var(--teal);
  background: #ffffff;
  border-radius: 10px;
}

.launch-box p {
  margin: 0 0 3px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
}

.launch-box strong {
  display: block;
  color: #3c665f;
  font-size: 12px;
  line-height: 1.4;
}

.main {
  min-width: 0;
  padding: 22px 28px 34px;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.topbar h2 {
  margin-top: 2px;
  font-size: 28px;
  line-height: 1.2;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 340px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(360px, 36vw);
  height: 42px;
  padding: 0 13px;
  color: var(--subtle);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.search-box input {
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
}

.primary-btn,
.ghost-btn,
.secondary-btn,
.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.primary-btn {
  color: #ffffff;
  background: var(--teal);
  border: 1px solid var(--teal);
}

.primary-btn:hover {
  background: #0d6a63;
}

.ghost-btn {
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
}

.ghost-btn:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.ghost-btn.compact {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.secondary-btn {
  color: #0f5f58;
  background: #eefaf7;
  border: 1px solid rgba(15, 118, 110, 0.22);
}

.secondary-btn:hover {
  color: #0d4f4a;
  background: #e0f5f0;
}

.account-chip {
  min-height: 42px;
  gap: 8px;
  white-space: nowrap;
}

.account-chip span {
  display: inline-block;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.view-panel {
  min-width: 0;
}

.inbox-view {
  display: grid;
  gap: 14px;
}

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

.inbox-summary article {
  min-height: 78px;
  padding: 15px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.inbox-summary span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.inbox-summary strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
}

.customer-directory-view {
  display: grid;
  gap: 14px;
}

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

.customer-summary article {
  min-height: 78px;
  padding: 15px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.customer-summary span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.customer-summary strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
}

.customer-directory-shell {
  display: grid;
  grid-template-columns: 220px minmax(360px, 1fr) minmax(280px, 340px);
  min-height: calc(100vh - 220px);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.customer-filter-panel,
.customer-detail-panel {
  min-width: 0;
  background: #fbfcfd;
}

.customer-filter-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 16px;
  border-right: 1px solid var(--line);
}

.customer-list-panel {
  min-width: 0;
  overflow: hidden;
}

.customer-batch-bar {
  display: grid;
  grid-template-columns: auto minmax(130px, 160px) minmax(120px, 1fr) minmax(120px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  background: #f5fbfa;
  border-bottom: 1px solid var(--line);
}

.customer-batch-bar[hidden] {
  display: none;
}

.customer-batch-bar strong {
  color: #0f514a;
  font-size: 13px;
  white-space: nowrap;
}

.customer-batch-bar input,
.customer-batch-bar select {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
}

.customer-batch-bar input:focus,
.customer-batch-bar select:focus {
  border-color: #7bbdb5;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.customer-list {
  max-height: calc(100vh - 220px);
  overflow: auto;
}

.customer-row {
  position: relative;
  display: grid;
  grid-template-columns: 24px 34px minmax(0, 1fr) auto;
  gap: 10px;
  width: 100%;
  min-height: 112px;
  padding: 13px 14px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.customer-row:hover,
.customer-row.active {
  background: #eef8f6;
}

.customer-row.selected {
  background: #f0f7ff;
}

.customer-row:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  outline-offset: -3px;
}

.customer-select {
  position: relative;
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  align-self: start;
  margin-top: 5px;
  cursor: pointer;
}

.customer-select input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.customer-select span {
  display: block;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border: 1px solid #b8c5d1;
  border-radius: 5px;
  box-shadow: inset 0 0 0 2px #ffffff;
}

.customer-select input:checked + span {
  background: #0f766e;
  border-color: #0f766e;
}

.customer-select input:checked + span::after {
  display: block;
  width: 7px;
  height: 4px;
  margin: 4px 0 0 4px;
  border: solid #ffffff;
  border-width: 0 0 2px 2px;
  content: "";
  transform: rotate(-45deg);
}

.customer-select input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.customer-row-main {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.customer-row-title,
.customer-row-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.customer-row-title strong,
.customer-row-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-row-title strong {
  min-width: 0;
  font-size: 15px;
}

.customer-row-title em,
.customer-row-meta {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.customer-row-meta {
  flex-wrap: wrap;
}

.customer-row-preview {
  color: #566371;
  font-size: 13px;
}

.stage-chip {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  min-height: 22px;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  background: #eef2f7;
  border: 1px solid #dbe3ea;
  border-radius: 999px;
  white-space: nowrap;
}

.stage-chip.new {
  color: #36516d;
  background: #edf4fb;
  border-color: #cfe0ee;
}

.stage-chip.qualified {
  color: #075f58;
  background: #dcf7f1;
  border-color: #aee7dc;
}

.stage-chip.opportunity {
  color: #73510b;
  background: #fff3cf;
  border-color: #f5d987;
}

.stage-chip.won {
  color: #17633b;
  background: #e5f8ec;
  border-color: #b7e7c6;
}

.stage-chip.lost {
  color: #923538;
  background: #fdebed;
  border-color: #f4c4ca;
}

.customer-empty,
.customer-detail-empty {
  display: grid;
  min-height: 220px;
  place-content: center;
  gap: 8px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.customer-empty strong,
.customer-detail-empty strong {
  color: var(--text);
  font-size: 16px;
}

.customer-detail-panel {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 18px;
  border-left: 1px solid var(--line);
}

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

.customer-detail-head p {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.customer-detail-head h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 20px;
}

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

.customer-detail-grid span {
  display: grid;
  gap: 5px;
  min-height: 68px;
  padding: 11px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.customer-detail-grid em,
.section-label {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.customer-detail-grid strong {
  align-self: end;
  overflow-wrap: anywhere;
  font-size: 15px;
}

.customer-detail-section {
  display: grid;
  gap: 8px;
}

.customer-detail-section p {
  margin: 0;
  color: #475569;
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.detail-tags {
  min-height: 26px;
}

.customer-profile-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

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

.customer-profile-form textarea {
  min-height: 96px;
}

.customer-detail-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.customer-detail-actions .primary-btn {
  grid-column: span 2;
}

.inbox-shell {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr) minmax(260px, 300px);
  min-height: calc(100vh - 220px);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.conversation-pane,
.customer-pane {
  min-width: 0;
  background: #fbfcfd;
}

.conversation-pane {
  border-right: 1px solid var(--line);
}

.customer-pane {
  display: grid;
  align-content: start;
  gap: 13px;
  padding: 16px;
  border-left: 1px solid var(--line);
}

.customer-panel-header h3 {
  margin: 2px 0 0;
  font-size: 18px;
}

.conversation-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.conversation-tab {
  min-height: 34px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 800;
}

.conversation-tab.active {
  color: var(--teal);
  background: var(--teal-soft);
}

.conversation-list {
  max-height: calc(100vh - 286px);
  overflow: auto;
}

.conversation-item {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  width: 100%;
  min-height: 104px;
  padding: 12px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.conversation-item:hover,
.conversation-item.active {
  background: #eef8f6;
}

.conversation-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #ffffff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 900;
}

.conversation-copy {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.conversation-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 8px;
}

.conversation-line strong,
.conversation-preview,
.thread-peer h3,
.thread-peer p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-line em {
  flex: 0 0 auto;
  color: var(--subtle);
  font-size: 12px;
  font-style: normal;
}

.conversation-line.muted {
  color: var(--muted);
  font-size: 12px;
}

.conversation-preview {
  color: #3c4654;
  font-size: 13px;
}

.conversation-status,
.thread-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.conversation-status.open,
.thread-status.open {
  color: var(--teal);
  background: var(--teal-soft);
}

.conversation-status.pending,
.thread-status.pending {
  color: var(--amber);
  background: var(--amber-soft);
}

.conversation-status.closed,
.thread-status.closed {
  color: var(--muted);
  background: var(--surface-soft);
}

.conversation-status.spam,
.thread-status.spam {
  color: var(--rose);
  background: var(--rose-soft);
}

.conversation-tags {
  display: flex;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
}

.conversation-tags small {
  flex: 0 0 auto;
  max-width: 86px;
  overflow: hidden;
  padding: 3px 7px;
  color: var(--blue);
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--blue-soft);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.conversation-owner {
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  min-height: 22px;
  overflow: hidden;
  padding: 3px 7px;
  color: #3e5968;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #eef4f7;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 800;
}

.conversation-owner.active,
.assignee-chip.active {
  color: var(--teal);
  background: var(--teal-soft);
}

.conversation-owner.away,
.assignee-chip.away {
  color: var(--amber);
  background: var(--amber-soft);
}

.conversation-owner.inactive,
.conversation-owner.unknown,
.assignee-chip.inactive,
.assignee-chip.unknown {
  color: var(--muted);
  background: var(--surface-soft);
}

.conversation-owner.empty,
.assignee-chip.empty {
  color: #6b7280;
  background: #edf1f5;
}

.unread-badge {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  color: #ffffff;
  text-align: center;
  background: var(--rose);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  line-height: 22px;
}

.conversation-empty,
.thread-empty {
  display: grid;
  gap: 6px;
  padding: 24px 18px;
  color: var(--muted);
}

.conversation-empty strong,
.thread-empty strong {
  color: var(--text);
}

.conversation-empty p,
.thread-empty p {
  margin: 0;
  line-height: 1.6;
}

.thread-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  background: #ffffff;
}

.thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.thread-header h3 {
  margin: 2px 0 0;
  font-size: 19px;
}

.thread-peer {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.thread-peer > div {
  min-width: 0;
}

.thread-peer p {
  max-width: 52vw;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.thread-peer h3 {
  max-width: 52vw;
}

.thread-meta-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.thread-translation-tools {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 3px;
  background: #f4f8fa;
  border: 1px solid var(--line);
  border-radius: 8px;
  gap: 6px;
}

.translation-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  color: #38556d;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  gap: 5px;
}

.translation-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--teal);
}

.translation-select {
  min-height: 24px;
  padding: 0 24px 0 8px;
  color: #273142;
  font-size: 12px;
  font-weight: 800;
  background: #ffffff;
  border: 1px solid rgba(71, 94, 112, 0.18);
  border-radius: 7px;
  outline: 0;
}

.assignee-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  max-width: 240px;
  overflow: hidden;
  padding: 0 10px;
  color: #3e5968;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #eef4f7;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
  gap: 7px;
}

.assignee-chip::before {
  width: 7px;
  height: 7px;
  background: currentColor;
  border-radius: 999px;
  content: "";
}

.thread-messages {
  min-height: 340px;
  overflow: auto;
  padding: 18px;
  background: linear-gradient(180deg, #f8fafb 0%, #ffffff 70%);
}

.thread-event {
  display: grid;
  max-width: 520px;
  margin: 12px auto;
  padding: 9px 12px;
  color: var(--muted);
  text-align: center;
  background: #f2f5f8;
  border: 1px solid var(--line);
  border-radius: 8px;
  gap: 4px;
}

.thread-event span {
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.thread-event p {
  margin: 0;
  overflow-wrap: anywhere;
  color: #314154;
  font-size: 13px;
  font-weight: 800;
}

.thread-event em,
.thread-event small {
  color: var(--subtle);
  font-size: 12px;
  font-style: normal;
  line-height: 1.4;
}

.thread-message {
  display: flex;
  margin-bottom: 12px;
}

.thread-message.outbound {
  justify-content: flex-end;
}

.message-bubble {
  max-width: min(620px, 78%);
  padding: 10px 12px;
  color: #273142;
  background: #eef2f7;
  border-radius: 9px;
}

.thread-message.outbound .message-bubble {
  color: #173f3b;
  background: #dff5f0;
}

.message-bubble p {
  margin: 0;
  overflow-wrap: anywhere;
  line-height: 1.55;
  white-space: pre-wrap;
}

.message-bubble span {
  display: block;
  margin-top: 6px;
  color: var(--subtle);
  font-size: 12px;
}

.message-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.message-translate {
  min-height: 24px;
  padding: 0 8px;
  color: #0f766e;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  background: #ffffff;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 8px;
}

.message-translate:disabled {
  color: #7a8d9d;
  cursor: wait;
  background: #f5f8fa;
}

.message-translation {
  margin-top: 8px;
  padding: 8px 9px;
  color: #2f4858;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(77, 113, 134, 0.16);
  border-radius: 8px;
}

.message-translation strong {
  display: block;
  margin-bottom: 4px;
  color: #0f766e;
  font-size: 12px;
}

.message-translation p {
  color: #273142;
  font-size: 13px;
}

.message-translation.error {
  color: #9b2c2c;
  background: #fff5f3;
  border-color: rgba(197, 72, 62, 0.2);
}

.delivery-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
  color: #5e7187;
  font-size: 12px;
}

.delivery-line small {
  max-width: 100%;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.delivery-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  color: #38556d;
  background: #eef5f7;
  border: 1px solid rgba(77, 113, 134, 0.18);
  border-radius: 8px;
}

.delivery-status.sent {
  color: #0f766e;
  background: #e8f7f2;
  border-color: rgba(15, 118, 110, 0.18);
}

.delivery-status.delivered {
  color: #146b8c;
  background: #e8f4fb;
  border-color: rgba(20, 107, 140, 0.2);
}

.delivery-status.read {
  color: #175cd3;
  background: #edf4ff;
  border-color: rgba(23, 92, 211, 0.2);
}

.delivery-status.queued {
  color: #9a5b00;
  background: #fff6dd;
  border-color: rgba(194, 132, 5, 0.22);
}

.delivery-status.failed {
  color: #b42318;
  background: #fff0ee;
  border-color: rgba(180, 35, 24, 0.2);
}

.delivery-template {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  color: #7a3f00;
  font-size: 12px;
  font-weight: 800;
  background: #fff8e8;
  border: 1px solid rgba(194, 132, 5, 0.22);
  border-radius: 8px;
}

.delivery-retry {
  min-height: 24px;
  padding: 2px 8px;
  color: #0f766e;
  font: inherit;
  font-weight: 700;
  background: #ffffff;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 8px;
  cursor: pointer;
}

.delivery-retry:hover {
  background: #eefaf7;
}

.delivery-retry:disabled {
  color: #8ba0ad;
  cursor: wait;
  background: #f4f7f8;
  border-color: var(--line);
}

.template-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #f8fbfa;
  border-top: 1px solid var(--line);
}

.template-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.template-head > div {
  display: grid;
  gap: 2px;
}

.template-head span {
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.template-head strong {
  color: var(--text);
  font-size: 15px;
}

.template-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.template-send-grid {
  display: grid;
  grid-template-columns: minmax(160px, .8fr) minmax(180px, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.template-editor {
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.template-editor summary {
  padding: 10px 12px;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.template-editor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 10px;
  padding: 0 12px 12px;
}

.template-editor-grid .wide {
  grid-column: 1 / span 3;
}

.template-editor textarea {
  min-height: 68px;
}

.quick-reply-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #ffffff;
  border-top: 1px solid var(--line);
}

.quick-reply-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quick-reply-head > div:first-child {
  display: grid;
  gap: 2px;
}

.quick-reply-head span {
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.quick-reply-head strong {
  color: var(--text);
  font-size: 15px;
}

.quick-reply-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.quick-reply-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(270px, 100%);
  min-height: 34px;
  padding: 0 10px;
  color: var(--subtle);
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.quick-reply-search svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
}

.quick-reply-search input {
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
}

.quick-reply-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.quick-reply-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.quick-reply-main {
  display: grid;
  gap: 4px;
  width: 100%;
  min-width: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
  background: transparent;
  border: 0;
}

.quick-reply-main:hover .quick-reply-body {
  color: var(--text);
}

.quick-reply-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.quick-reply-title strong {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-reply-title em {
  flex: 0 0 auto;
  padding: 2px 7px;
  color: #0f766e;
  font-size: 12px;
  font-style: normal;
  background: #e7f7f4;
  border-radius: 999px;
}

.quick-reply-body {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.quick-reply-meta {
  overflow: hidden;
  color: var(--subtle);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-reply-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.quick-reply-empty {
  display: grid;
  gap: 4px;
  padding: 12px;
  color: var(--muted);
  background: #f8fbfa;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.quick-reply-empty strong {
  color: var(--text);
}

.quick-reply-empty span {
  font-size: 13px;
}

.quick-reply-form {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #f8fbfa;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 8px;
}

.quick-reply-form[hidden] {
  display: none;
}

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

.quick-reply-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 10px;
}

.quick-reply-form-grid .wide {
  grid-column: 1 / span 4;
}

.quick-reply-form textarea {
  min-height: 74px;
}

.drawer-quick-reply-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-reply-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 30px;
  padding: 0 10px;
  color: #0d5f58;
  font-weight: 800;
  cursor: pointer;
  background: #eefaf7;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 999px;
}

.quick-reply-chip span {
  color: #607987;
  font-size: 12px;
}

.drawer-quick-empty {
  color: var(--subtle);
  font-size: 13px;
}

.thread-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  background: #ffffff;
  border-top: 1px solid var(--line);
}

.thread-composer textarea {
  width: 100%;
  min-height: 44px;
  max-height: 160px;
  padding: 10px 12px;
  color: var(--text);
  resize: vertical;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
}

.thread-composer textarea:focus {
  border-color: #7bbdb5;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.reply-translate-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  gap: 8px;
}

.reply-translate-bar span {
  color: #5e7187;
  font-size: 12px;
  font-weight: 900;
}

.reply-translate-bar select {
  min-height: 32px;
  padding: 0 28px 0 10px;
  color: #273142;
  font-size: 13px;
  font-weight: 800;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
}

.reply-translation-preview {
  display: grid;
  grid-column: 1 / -1;
  padding: 10px 12px;
  background: #f5faf8;
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: 8px;
  gap: 7px;
}

.reply-translation-preview[hidden] {
  display: none;
}

.reply-translation-preview span {
  color: #0f766e;
  font-size: 12px;
  font-weight: 900;
}

.reply-translation-preview p {
  margin: 0;
  overflow-wrap: anywhere;
  color: #273142;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.reply-translation-preview p.error {
  color: #9b2c2c;
}

.reply-translation-actions {
  display: flex;
  justify-content: flex-end;
}

.primary-btn.wide {
  width: 100%;
}

.assignment-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.assignment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.assignment-head h3 {
  margin: 2px 0 0;
  font-size: 18px;
}

.assignment-head span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.assignment-form {
  display: grid;
  grid-template-columns: minmax(170px, 1.25fr) minmax(150px, 1fr) minmax(92px, .55fr) minmax(82px, .45fr);
  gap: 12px;
  align-items: end;
}

.assignment-form .wide {
  grid-column: span 2;
}

.assignment-form .small input {
  text-align: center;
}

.check-row input {
  width: 22px;
  height: 22px;
  min-height: 22px;
  padding: 0;
  accent-color: var(--teal);
}

.assignment-actions {
  display: flex;
  align-items: end;
  gap: 10px;
  grid-column: span 2;
}

.assignment-list {
  display: grid;
  gap: 10px;
}

.assignment-rule {
  display: grid;
  grid-template-columns: minmax(180px, 1.25fr) minmax(0, 1fr) minmax(120px, .75fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 86px;
  padding: 12px;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.assignment-rule.disabled {
  opacity: .66;
}

.assignment-rule h4 {
  margin: 0 0 7px;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.assignment-rule p {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.assignment-rule-meta,
.assignment-rule-tags,
.assignment-rule-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.assignment-rule-meta span,
.assignment-rule-tags span,
.assignment-rule-tags small {
  min-height: 24px;
  max-width: 170px;
  overflow: hidden;
  padding: 4px 8px;
  color: #2e455d;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #eef4f8;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.assignment-rule-tags span,
.assignment-rule-tags small {
  color: var(--blue);
  background: var(--blue-soft);
}

.assignment-rule-actions {
  justify-content: flex-end;
}

.assignment-rule-actions button {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
}

.assignment-empty {
  padding: 18px;
  color: var(--muted);
  background: #fbfcfd;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  font-weight: 800;
}

.team-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.team-summary article {
  display: grid;
  min-height: 96px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  gap: 8px;
}

.team-summary span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.team-summary strong {
  color: var(--text);
  font-size: 28px;
  line-height: 1;
}

.team-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
}

.team-member-panel,
.team-list-panel {
  display: grid;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  gap: 14px;
}

.team-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 14px;
}

.team-panel-head h3 {
  margin: 2px 0 0;
  font-size: 18px;
}

.team-panel-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

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

.team-member-form .wide,
.team-form-actions {
  grid-column: 1 / -1;
}

#teamMemberChannels {
  min-height: 132px;
  padding: 8px;
}

.team-form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.team-member-list {
  display: grid;
  gap: 10px;
}

.team-member-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: start;
  padding: 13px;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  gap: 12px;
}

.team-member-card.inactive {
  opacity: 0.68;
}

.member-avatar {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  color: #ffffff;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  border-radius: 8px;
  font-weight: 900;
}

.member-main {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.member-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 8px;
}

.member-heading strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-main p {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 13px;
}

.member-status {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.member-status.active {
  color: var(--teal);
  background: var(--teal-soft);
}

.member-status.away {
  color: var(--amber);
  background: var(--amber-soft);
}

.member-status.inactive {
  color: var(--muted);
  background: var(--surface-soft);
}

.member-meta,
.team-channel-list,
.member-actions {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
  gap: 6px;
}

.member-meta span,
.team-channel-list small {
  min-height: 24px;
  max-width: 190px;
  overflow: hidden;
  padding: 4px 8px;
  color: #2e455d;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #eef4f8;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.team-channel-list small {
  color: var(--blue);
  background: var(--blue-soft);
}

.member-note {
  color: #3c4654 !important;
  line-height: 1.5;
}

.member-actions {
  justify-content: flex-end;
}

.team-empty {
  padding: 18px;
  color: var(--muted);
  background: #fbfcfd;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  font-weight: 800;
}

.team-empty p {
  margin: 6px 0 0;
  font-weight: 600;
  line-height: 1.5;
}

.permission-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -4px 0 16px;
  padding: 12px 14px;
  color: #31515a;
  background: #edf8f6;
  border: 1px solid #c9ebe5;
  border-radius: 8px;
  gap: 12px;
}

.permission-notice strong {
  flex: 0 0 auto;
  font-size: 14px;
}

.permission-notice span {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.is-readonly {
  opacity: .74;
}

.is-readonly input,
.is-readonly select,
.is-readonly textarea,
.is-readonly button {
  cursor: not-allowed;
}

.audit-panel {
  display: grid;
  margin-top: 18px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  gap: 14px;
}

.audit-panel-head,
.audit-toolbar,
.audit-log-head,
.audit-log-meta {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.audit-panel-head {
  justify-content: space-between;
}

.audit-panel-head h3 {
  margin: 2px 0 0;
  font-size: 18px;
}

.audit-panel-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.audit-toolbar {
  flex-wrap: wrap;
  justify-content: space-between;
  padding: 12px;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.audit-toolbar .field-row {
  flex: 0 0 220px;
}

.audit-search {
  flex: 1 1 280px;
  min-width: 240px;
  background: var(--surface);
}

.audit-log-list {
  display: grid;
  gap: 10px;
}

.audit-log {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  padding: 13px;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  gap: 12px;
}

.audit-log.channel-connect,
.audit-log.auth-login,
.audit-log.message_template-sync,
.audit-log.message_template-create {
  border-left-color: var(--teal);
}

.audit-log.team-member-disable,
.audit-log.routing-rule-delete,
.audit-log.channel-disconnect,
.audit-log.message_template-delete {
  border-left-color: var(--rose);
}

.audit-log-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #ffffff;
  background: #334155;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 900;
}

.audit-log-main {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.audit-log-head {
  justify-content: space-between;
}

.audit-log-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audit-log-head span {
  flex: 0 0 auto;
  color: var(--subtle);
  font-size: 12px;
  font-weight: 800;
}

.audit-log-main p {
  margin: 0;
  overflow-wrap: anywhere;
  color: #3c4654;
  line-height: 1.45;
}

.audit-log-meta {
  flex-wrap: wrap;
}

.audit-log-meta span {
  min-height: 24px;
  max-width: 210px;
  overflow: hidden;
  padding: 4px 8px;
  color: #2e455d;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #eef4f8;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.audit-empty {
  padding: 18px;
  color: var(--muted);
  background: #fbfcfd;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  font-weight: 800;
}

.audit-empty p {
  margin: 6px 0 0;
  font-weight: 600;
  line-height: 1.5;
}

.danger-btn {
  color: #b42318;
  background: #fff1f0;
  border: 1px solid #ffd2cf;
}

.danger-btn.compact {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 92px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.metric-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 12px;
}

.metric-card strong {
  display: block;
  margin-top: 3px;
  font-size: 26px;
  line-height: 1;
}

.metric-card span {
  align-self: end;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.accent-teal .metric-icon {
  color: var(--teal);
  background: var(--teal-soft);
}

.accent-blue .metric-icon {
  color: var(--blue);
  background: var(--blue-soft);
}

.accent-amber .metric-icon {
  color: var(--amber);
  background: var(--amber-soft);
}

.accent-rose .metric-icon {
  color: var(--rose);
  background: var(--rose-soft);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: #eceff3;
  border-radius: 10px;
}

.tab {
  min-width: 76px;
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-weight: 700;
}

.tab.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(32, 37, 45, 0.08);
}

.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-weight: 700;
}

.switch-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-row span {
  position: relative;
  width: 42px;
  height: 24px;
  background: #d6dce5;
  border-radius: 99px;
}

.switch-row span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  content: "";
  background: #ffffff;
  border-radius: 50%;
  transition: transform 160ms ease;
}

.switch-row input:checked + span {
  background: var(--teal);
}

.switch-row input:checked + span::after {
  transform: translateX(18px);
}

.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
}

.section-heading,
.insight-header,
.drawer-header,
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-heading {
  margin-bottom: 12px;
}

.section-heading h3,
.insight-header h3,
.drawer-header h3,
.dialog-header h3 {
  font-size: 18px;
  line-height: 1.3;
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(230px, 1fr));
  gap: 14px;
}

.channel-card {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-height: 190px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.channel-card:hover {
  border-color: #cbd4df;
  box-shadow: 0 10px 26px rgba(34, 42, 53, 0.08);
  transform: translateY(-1px);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

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

.channel-logo {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  flex: 0 0 auto;
  color: #ffffff;
  border-radius: 12px;
  font-weight: 800;
}

.channel-logo.large {
  width: 54px;
  height: 54px;
  border-radius: 15px;
  font-size: 18px;
}

.brand-row strong {
  display: block;
  overflow: hidden;
  max-width: 150px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-row span {
  display: block;
  margin-top: 2px;
  color: var(--subtle);
  font-size: 12px;
}

.status-pill,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.connected {
  color: #146c2e;
  background: #e7f8ed;
}

.status-pill.pending {
  color: #9a5b00;
  background: #fff1c2;
}

.status-pill.available {
  color: #506078;
  background: #eef2f6;
}

.status-pill.beta {
  color: #9f3150;
  background: #ffe7ef;
}

.channel-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-bottom: 10px;
}

.integration-badge {
  display: inline-flex;
  justify-self: start;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}

.integration-badge.ready {
  color: #0f5f58;
  background: #e5f6f3;
}

.integration-badge.blocked {
  color: #8a5a12;
  background: #fff3d4;
}

.health-chip {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  max-width: 100%;
  padding: 0 9px;
  overflow: hidden;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.health-chip.ready {
  color: #0f5f58;
  background: var(--teal-soft);
}

.health-chip.warning {
  color: #8a5a12;
  background: var(--amber-soft);
}

.health-chip.blocked {
  color: #9f3150;
  background: var(--rose-soft);
}

.health-chip.offline {
  color: #506078;
  background: #eef2f6;
}

.channel-card p {
  min-height: 42px;
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.45;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.tag {
  color: var(--muted);
  background: #f3f5f8;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.activity {
  min-width: 0;
  color: var(--subtle);
  font-size: 12px;
  line-height: 1.35;
}

.activity strong {
  display: block;
  overflow: hidden;
  max-width: 150px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  color: var(--text);
  background: #f3f5f8;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
  white-space: nowrap;
}

.card-action:hover {
  background: #e9eef4;
}

.card-action.connected {
  color: var(--teal);
  background: var(--teal-soft);
}

.card-action.blocked {
  color: #7a5a22;
  background: #fff6df;
}

.insight-panel {
  align-self: start;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.insight-header span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.recommendation {
  margin: 16px 0;
  padding: 14px;
  background: linear-gradient(135deg, #eef8f6, #f4f7ff);
  border: 1px solid #dce8ef;
  border-radius: 12px;
}

.recommendation strong {
  display: block;
  margin-bottom: 7px;
}

.recommendation p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.45;
}

.health-list {
  display: grid;
  gap: 10px;
}

.health-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.health-row strong {
  display: block;
  margin-top: 2px;
  font-size: 13px;
}

.health-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.health-dot.good {
  background: var(--green);
}

.health-dot.warn {
  background: #d58b00;
}

.health-dot.info {
  background: var(--blue);
}

.channel-health-panel {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.mini-refresh {
  height: 30px;
  padding: 0 10px;
  color: var(--blue);
  background: #eef4ff;
  border: 1px solid #d7e4ff;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.mini-refresh:disabled {
  cursor: wait;
  opacity: 0.7;
}

.channel-health-list {
  display: grid;
  gap: 10px;
}

.health-alert {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 12px;
}

.health-alert.ready {
  border-left-color: var(--teal);
}

.health-alert.warning {
  border-left-color: var(--amber);
}

.health-alert.blocked {
  border-left-color: var(--rose);
}

.health-alert.offline {
  border-left-color: #95a1b2;
}

.health-alert-head {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.health-alert-copy {
  min-width: 0;
}

.health-alert-copy strong,
.health-alert-copy em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.health-alert-copy strong {
  color: var(--ink);
  font-size: 13px;
}

.health-alert-copy em {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.health-alert p {
  margin: 0;
  color: #3c4654;
  font-size: 12px;
  line-height: 1.45;
}

.health-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.health-check {
  max-width: 100%;
  padding: 4px 7px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #eef2f6;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 800;
}

.health-check.ok {
  color: var(--teal);
  background: var(--teal-soft);
}

.health-check.warning {
  color: var(--amber);
  background: var(--amber-soft);
}

.health-check.blocked {
  color: var(--rose);
  background: var(--rose-soft);
}

.health-action-line {
  justify-self: start;
  padding: 0;
  color: var(--blue);
  background: transparent;
  border: 0;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.health-empty {
  display: grid;
  gap: 5px;
  padding: 12px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px dashed var(--line);
  border-radius: 12px;
}

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

.health-empty p {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}

.recent-messages {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.mini-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mini-heading strong {
  font-size: 14px;
}

.mini-heading span {
  color: var(--subtle);
  font-size: 12px;
  font-weight: 800;
}

.message-list {
  display: grid;
  gap: 8px;
}

.message-item {
  display: grid;
  gap: 5px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.message-item:first-child {
  border-top: 0;
}

.message-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--subtle);
  font-size: 12px;
}

.message-item strong,
.message-item p {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-mainline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 8px;
  align-items: center;
}

.message-item strong {
  color: var(--text);
  font-size: 13px;
}

.message-item p {
  color: var(--muted);
  font-size: 13px;
}

.message-reply {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--muted);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.message-reply:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.message-reply svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 320px;
  padding: 42px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  text-align: center;
}

.empty-state svg {
  width: 80px;
  height: 80px;
  color: #b4bfcc;
}

.empty-state h3,
.empty-state p {
  margin: 8px 0 0;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(11, 18, 28, 0.38);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 30;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: min(430px, 100vw);
  height: 100vh;
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateX(105%);
  transition: transform 180ms ease;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-body {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 22px 0;
  overflow: auto;
}

.drawer-brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.drawer-brand strong {
  font-size: 18px;
}

.drawer-status {
  display: inline-flex;
  justify-self: start;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  color: #146c2e;
  background: #e7f8ed;
  border-radius: 999px;
  font-weight: 800;
}

.webhook-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: #f7f9fb;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.webhook-card span {
  color: var(--subtle);
  font-size: 12px;
  font-weight: 800;
}

.webhook-card code {
  overflow-wrap: anywhere;
  color: #334155;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.inline-webhook {
  background: #ffffff;
}

.config-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #f7f9fb;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.config-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.config-badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  color: #536174;
  background: #eef2f7;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.config-badge.ready {
  color: #146c2e;
  background: #e7f8ed;
}

.config-badge.pending {
  color: #8a5d00;
  background: #fff2c8;
}

.config-badge.blocked {
  color: #9f2936;
  background: #ffe8ec;
}

.config-fields {
  display: grid;
  gap: 8px;
}

.config-field {
  display: grid;
  grid-template-columns: minmax(96px, .8fr) minmax(0, 1.2fr);
  gap: 10px;
  align-items: center;
  min-height: 36px;
  padding: 8px 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.config-field span,
.config-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.config-field strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
}

.drawer-setup-guide {
  display: grid;
  gap: 7px;
  padding-top: 2px;
}

.drawer-guide-row {
  display: grid;
  gap: 4px;
}

.drawer-guide-row span {
  color: var(--subtle);
  font-size: 12px;
  font-weight: 800;
}

.drawer-guide-row strong {
  color: var(--text);
  font-size: 14px;
}

.drawer-setup-guide p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.diagnostic-card {
  gap: 13px;
  background: #ffffff;
  border-radius: 8px;
}

.diagnostic-list {
  display: grid;
  gap: 8px;
}

.diagnostic-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  min-height: 42px;
  padding: 9px 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.diagnostic-row strong,
.diagnostic-row small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.diagnostic-row strong {
  color: var(--text);
  font-size: 13px;
}

.diagnostic-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.diagnostic-row em {
  color: var(--subtle);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.diagnostic-dot {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: #94a3b8;
}

.diagnostic-row.ok {
  background: #f0fbf4;
  border-color: #bdebd0;
}

.diagnostic-dot.ok {
  background: #16a34a;
}

.diagnostic-row.warning {
  background: #fffbeb;
  border-color: #f3da8d;
}

.diagnostic-dot.warning {
  background: #f59e0b;
}

.diagnostic-row.blocked {
  background: #fff1f2;
  border-color: #fecdd3;
}

.diagnostic-dot.blocked {
  background: #e11d48;
}

.test-send-box {
  display: grid;
  gap: 10px;
  padding-top: 2px;
}

.test-send-box .field-row textarea {
  min-height: 62px;
}

.test-send-result {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.test-send-result.active {
  color: #0f766e;
  font-weight: 800;
}

.test-send-result.failed {
  color: #be123c;
  font-weight: 800;
}

.credential-guide {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: #f7f9fb;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.credential-guide div {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
}

.credential-guide strong {
  color: var(--text);
  font-size: 13px;
}

.credential-guide span {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.readiness-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.readiness-card strong {
  font-size: 14px;
}

.readiness-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.readiness-card.ready {
  background: #edf8f6;
  border-color: #c9ebe5;
}

.readiness-card.blocked {
  background: #fff8e8;
  border-color: #f4dc9f;
}

.compact-btn {
  justify-self: start;
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.ghost-btn:disabled,
.primary-btn:disabled,
.secondary-btn:disabled,
.danger-btn:disabled {
  cursor: wait;
  opacity: 0.62;
}

.webhook-view {
  display: grid;
  align-content: start;
}

.webhook-topbar .search-box {
  width: min(420px, 38vw);
}

.webhook-metrics {
  margin-bottom: 16px;
}

.webhook-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.webhook-filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.field-row.compact {
  min-width: 178px;
}

.field-row.compact select {
  min-height: 38px;
}

.webhook-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 480px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.webhook-hint span {
  display: inline-block;
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  background: var(--amber);
  border-radius: 50%;
}

.webhook-list {
  display: grid;
  gap: 12px;
}

.webhook-event {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 18px;
  padding: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 12px;
}

.webhook-event.processed {
  border-left-color: var(--teal);
}

.webhook-event.failed {
  border-left-color: var(--rose);
}

.webhook-event.received,
.webhook-event.retrying {
  border-left-color: var(--amber);
}

.webhook-event-head {
  display: flex;
  grid-column: 1 / -1;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.webhook-channel {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.webhook-channel div {
  min-width: 0;
}

.webhook-channel strong,
.webhook-channel p {
  margin: 0;
}

.webhook-channel strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.webhook-channel p {
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.webhook-status {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.webhook-status.processed {
  color: var(--teal);
  background: var(--teal-soft);
}

.webhook-status.failed {
  color: var(--rose);
  background: var(--rose-soft);
}

.webhook-status.received,
.webhook-status.retrying {
  color: var(--amber);
  background: var(--amber-soft);
}

.webhook-event-body {
  display: grid;
  min-width: 0;
  gap: 10px;
}

.webhook-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.webhook-meta span {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  color: #536174;
  background: #eef2f7;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.webhook-error {
  margin: 0;
  padding: 10px 12px;
  color: #9f1239;
  background: var(--rose-soft);
  border: 1px solid #fecdd3;
  border-radius: 9px;
  line-height: 1.5;
}

.webhook-payload {
  display: block;
  max-height: 118px;
  padding: 11px 12px;
  overflow: auto;
  overflow-wrap: anywhere;
  color: #334155;
  background: #f7f9fb;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.55;
}

.webhook-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  min-width: 92px;
}

.webhook-actions span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.webhook-empty {
  display: grid;
  gap: 6px;
  padding: 24px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
}

.webhook-empty strong {
  color: var(--text);
  font-size: 17px;
}

.webhook-empty p {
  margin: 0;
  line-height: 1.6;
}

.setting-list {
  display: grid;
  gap: 10px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px;
  background: #f7f9fb;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.setting-row strong,
.setting-row small {
  display: block;
}

.setting-row small {
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.35;
}

.setting-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--teal);
}

.drawer-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.drawer-stats div {
  padding: 14px;
  background: #f7f9fb;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.drawer-stats strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.reply-panel {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.full-width {
  width: 100%;
  justify-content: center;
}

.drawer-footer,
.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.connect-dialog {
  width: min(520px, calc(100vw - 28px));
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 0;
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.connect-dialog::backdrop {
  background: rgba(11, 18, 28, 0.38);
}

.connect-dialog form {
  padding: 18px;
}

.dialog-body {
  display: grid;
  gap: 18px;
  padding: 18px 0;
}

.selected-channel {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: #f7f9fb;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.selected-channel strong {
  display: block;
  margin-bottom: 3px;
}

.setup-guide {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.setup-guide .mini-heading span {
  min-height: 26px;
  padding: 0 9px;
  color: #155e75;
  background: #e6f6fb;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.step-list {
  display: grid;
  gap: 12px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.step-list li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
}

.step-list span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #ffffff;
  background: var(--text);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
}

.step-list strong {
  display: block;
  margin-bottom: 2px;
}

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

.setup-step em {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  margin-top: 7px;
  padding: 0 8px;
  color: #536174;
  background: #eef2f7;
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.setup-step.done .step-index,
.setup-step.done em {
  background: #dff7e7;
  color: #146c2e;
}

.setup-step.current .step-index,
.setup-step.current em {
  background: #dbeafe;
  color: #1d4ed8;
}

.setup-step.waiting .step-index,
.setup-step.waiting em {
  background: #fff2c8;
  color: #8a5d00;
}

.setup-step.blocked .step-index,
.setup-step.blocked em {
  background: #ffe8ec;
  color: #9f2936;
}

.setup-step.muted .step-index,
.setup-step.muted em {
  background: #eef2f7;
  color: #64748b;
}

.setup-field-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.setup-field {
  display: grid;
  gap: 4px;
  min-height: 54px;
  padding: 9px 10px;
  background: #f7f9fb;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.setup-field strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.setup-field span {
  justify-self: start;
  min-height: 22px;
  padding: 0 8px;
  color: #536174;
  background: #eef2f7;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 22px;
}

.setup-field.saved span {
  color: #146c2e;
  background: #dff7e7;
}

.setup-field.missing span {
  color: #9f2936;
  background: #ffe8ec;
}

.setup-field.recommended span {
  color: #8a5d00;
  background: #fff2c8;
}

.setup-notes {
  display: grid;
  gap: 6px;
}

.setup-notes p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

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

.field-row {
  display: grid;
  gap: 7px;
}

.field-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field-row input,
.field-row select,
.field-row textarea {
  width: 100%;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
}

.field-row input,
.field-row select {
  min-height: 40px;
  padding: 0 12px;
}

.field-row textarea {
  min-height: 84px;
  padding: 10px 12px;
  font: inherit;
  resize: vertical;
}

.field-row input:focus,
.field-row select:focus,
.field-row textarea:focus {
  border-color: #7bbdb5;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  max-width: 320px;
  padding: 12px 14px;
  color: #ffffff;
  background: #20252d;
  border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1240px) {
  .app-shell {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .side-panel {
    display: none;
  }

  .channel-grid {
    grid-template-columns: repeat(2, minmax(230px, 1fr));
  }

  .inbox-shell {
    grid-template-columns: minmax(240px, 310px) minmax(0, 1fr);
  }

  .customer-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .customer-directory-shell {
    grid-template-columns: minmax(200px, 240px) minmax(0, 1fr);
  }

  .customer-detail-panel {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .customer-pane {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .customer-panel-header,
  .customer-pane .wide {
    grid-column: 1 / -1;
  }

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

  .assignment-form .wide,
  .assignment-actions {
    grid-column: span 2;
  }

  .assignment-rule {
    grid-template-columns: minmax(180px, 1fr) minmax(0, 1fr);
  }

  .assignment-rule-actions {
    justify-content: flex-start;
  }

  .team-layout {
    grid-template-columns: 1fr;
  }

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

  .webhook-event {
    grid-template-columns: minmax(0, 1fr);
  }

  .webhook-actions {
    justify-content: flex-start;
    min-width: 0;
  }
}

@media (max-width: 980px) {
  .auth-screen {
    grid-template-columns: 1fr;
    align-items: start;
    padding: 28px 18px;
  }

  .auth-visual {
    min-height: 300px;
  }

  .main {
    padding: 18px;
  }

  .topbar,
  .toolbar,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .search-box {
    width: 100%;
    min-width: 0;
  }

  .webhook-topbar .search-box {
    width: 100%;
  }

  .metrics,
  .content-layout {
    grid-template-columns: 1fr;
  }

  .webhook-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .webhook-filter-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .inbox-summary {
    grid-template-columns: 1fr;
  }

  .customer-summary {
    grid-template-columns: 1fr;
  }

  .customer-directory-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .customer-filter-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .customer-list {
    max-height: 420px;
  }

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

  .customer-batch-bar strong {
    grid-column: 1 / -1;
  }

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

  .customer-row .unread-badge {
    position: absolute;
    top: 12px;
    right: 12px;
  }

  .customer-detail-grid,
  .customer-profile-form,
  .customer-detail-actions {
    grid-template-columns: 1fr;
  }

  .customer-profile-form .wide {
    grid-column: auto;
  }

  .customer-detail-actions .primary-btn {
    grid-column: auto;
  }

  .inbox-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

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

  .conversation-list {
    max-height: 320px;
  }

  .thread-messages {
    min-height: 360px;
    max-height: 520px;
  }

  .thread-meta-actions {
    justify-content: flex-start;
  }

  .thread-translation-tools {
    max-width: 100%;
  }

  .thread-composer {
    grid-template-columns: 1fr;
  }

  .template-send-grid,
  .template-editor-grid {
    grid-template-columns: 1fr;
  }

  .template-editor-grid .wide {
    grid-column: auto;
  }

  .quick-reply-head,
  .quick-reply-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .quick-reply-search {
    width: 100%;
  }

  .quick-reply-item,
  .quick-reply-form-grid {
    grid-template-columns: 1fr;
  }

  .quick-reply-form-grid .wide {
    grid-column: auto;
  }

  .quick-reply-tools {
    justify-content: flex-start;
  }

  .customer-pane {
    grid-template-columns: 1fr;
  }

  .assignment-form,
  .assignment-rule {
    grid-template-columns: 1fr;
  }

  .assignment-form .wide,
  .assignment-actions {
    grid-column: auto;
  }

  .assignment-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .team-summary,
  .team-member-form {
    grid-template-columns: 1fr;
  }

  .team-member-form .wide,
  .team-form-actions {
    grid-column: auto;
  }

  .team-member-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .member-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .permission-notice,
  .audit-toolbar,
  .audit-log-head {
    align-items: stretch;
    flex-direction: column;
  }

  .audit-toolbar .field-row,
  .audit-search {
    width: 100%;
    min-width: 0;
    flex-basis: auto;
  }

  .insight-panel {
    order: -1;
  }
}

@media (max-width: 680px) {
  .auth-screen {
    padding: 14px;
  }

  .auth-visual {
    min-height: 260px;
    padding: 24px;
    border-radius: 14px;
  }

  .auth-brand {
    align-items: flex-start;
  }

  .auth-brand h1 {
    font-size: 32px;
  }

  .auth-panel {
    padding: 20px;
    border-radius: 14px;
  }

  .app-shell {
    display: block;
  }

  .rail {
    position: sticky;
    top: 0;
    z-index: 10;
    flex-direction: row;
    justify-content: space-between;
    padding: 10px 12px;
  }

  .rail-nav {
    flex-direction: row;
    width: auto;
    overflow-x: auto;
  }

  .rail-bottom {
    display: none;
  }

  .brand-mark,
  .rail-btn {
    flex: 0 0 auto;
  }

  .main {
    padding: 16px 12px 28px;
  }

  .topbar h2 {
    font-size: 24px;
  }

  .tabs {
    width: 100%;
    overflow-x: auto;
  }

  .tab {
    flex: 0 0 auto;
  }

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

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

  .setup-guide {
    padding: 12px;
  }

  .metric-card {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .metric-card span {
    grid-column: 2;
    justify-self: start;
  }

  .webhook-filter-group {
    grid-template-columns: 1fr;
  }

  .webhook-event {
    padding: 13px;
  }

  .webhook-event-head {
    flex-direction: column;
  }

  .webhook-channel {
    align-items: flex-start;
  }

  .webhook-channel strong {
    white-space: normal;
  }

  .webhook-status {
    align-self: flex-start;
  }

  .conversation-tabs {
    grid-template-columns: repeat(4, minmax(76px, 1fr));
    overflow-x: auto;
  }

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

  .unread-badge {
    grid-column: 2;
    justify-self: start;
  }

  .thread-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .thread-peer p,
  .thread-peer h3 {
    max-width: calc(100vw - 94px);
  }

  .thread-meta-actions {
    align-items: flex-start;
  }

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

  .translation-select {
    flex: 1 1 128px;
    min-width: 0;
  }

  .assignee-chip {
    max-width: 100%;
  }

  .team-panel-head,
  .member-heading,
  .team-form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .team-member-card {
    grid-template-columns: 1fr;
  }

  .member-actions {
    grid-column: auto;
  }

  .message-bubble {
    max-width: 90%;
  }
}
