.awareness-shell {
  width: min(1500px, calc(100vw - 32px));
}

.communications-filter {
  display: inline-grid;
  gap: 4px;
  margin: 0 0 10px;
  font-weight: 700;
}

.communications-filter select {
  min-width: 180px;
  padding: 7px 9px;
  border: 1px solid #b9c8d8;
  border-radius: 5px;
  background: #fff;
  font: inherit;
}

.communications-phone-filter {
  display: inline-flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px 8px;
}

.communications-phone-filter label { display: grid; gap: 4px; font-weight: 700; }
.communications-phone-filter input { width: min(240px, 65vw); padding: 7px 9px; border: 1px solid #b9c8d8; border-radius: 5px; font: inherit; }

.phone-copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.copy-phone-button {
  position: relative;
  width: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border-color: transparent;
  background: transparent;
}

.copy-icon::before,
.copy-icon::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-radius: 1px;
}

.copy-icon::before { left: 8px; top: 7px; }
.copy-icon::after { left: 11px; top: 10px; background: #fff; }
.copy-phone-button.copied .copy-icon::before { content: "✓"; inset: 3px 0 0; width: auto; height: auto; border: 0; }
.copy-phone-button.copied .copy-icon::after { display: none; }

.dashboard-hero {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin: -8px -8px 10px;
  padding: 10px 8px;
  border-bottom: 1px solid #e4e9f0;
  background: rgba(246, 248, 251, 0.96);
  backdrop-filter: blur(8px);
}

.dashboard-hero h1 {
  margin: 0;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.05;
}

.dashboard-hero p {
  margin: 3px 0 0;
  color: #5f6368;
  font-size: 13px;
}

.eyebrow {
  margin: 0 0 4px !important;
  color: #1f6feb !important;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-button {
  background: #1f6feb;
  border-color: #1f6feb;
  color: #fff;
}

.requirements-sms-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.requirements-sms-control h2 { margin: 0 0 4px; }
.requirements-sms-control .hint { margin: 0; }
.requirements-sms-control.hidden { display: none; }
.requirements-sms-actions { display: flex; align-items: center; justify-content: flex-start; gap: 14px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid #d8e0e9; border-radius: 8px; background: #f8fafc; }
.requirements-sms-preview-form { display: grid; gap: 7px; max-width: 900px; }
.requirements-sms-preview-form > label { font-weight: 800; }
.requirements-sms-email-row { display: flex; gap: 8px; }
.requirements-sms-email-row input { min-width: 260px; flex: 1; padding: 9px 10px; border: 1px solid #c8d1dc; border-radius: 6px; }
.requirements-sms-preview-panel { width: 100%; padding: 16px; border: 1px solid #c8d1dc; border-radius: 8px; background: #f8fafc; }
.requirements-sms-preview-panel.hidden { display: none; }
.requirements-sms-preview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.requirements-sms-preview-head strong, .requirements-sms-preview-head span { display: block; }
.requirements-sms-preview-meta { margin: 8px 0; color: #52606d; font-size: 13px; }
.requirements-sms-preview-panel pre { white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px; border-radius: 6px; background: #fff; border: 1px solid #dde3ea; font: 14px/1.45 system-ui, sans-serif; }
.requirements-sms-preview-send { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.requirements-sms-preview-send .hint { margin-right: auto; }
.status-pill { padding: 4px 8px; border-radius: 999px; background: #e7eef8; font-size: 12px; font-weight: 800; text-transform: capitalize; }
.automation-toggle { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; cursor: pointer; }
.automation-toggle input { width: 20px; height: 20px; accent-color: #1f6feb; }

@media (max-width: 680px) {
  .requirements-sms-actions { align-items: flex-start; flex-direction: column; }
  .requirements-sms-email-row { align-items: stretch; flex-direction: column; width: 100%; }
  .requirements-sms-email-row input { min-width: 0; }
  .requirements-sms-preview-head, .requirements-sms-preview-send { align-items: stretch; flex-direction: column; }
}

.tools-menu {
  position: relative;
}

.tools-menu summary {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid #c8d1dc;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.tools-menu summary::-webkit-details-marker {
  display: none;
}

.tools-menu-content {
  position: absolute;
  right: 0;
  z-index: 5;
  display: grid;
  gap: 2px;
  min-width: 230px;
  max-height: min(70vh, 360px);
  margin-top: 6px;
  padding: 6px;
  border: 1px solid #d8dde6;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(32, 33, 36, 0.14);
  overflow-y: auto;
}

.tools-menu-content button,
.tools-menu-content .button-link {
  width: 100%;
  justify-content: flex-start;
  min-height: 32px;
  padding: 6px 8px;
  border-color: transparent;
  background: transparent;
  color: #202124;
  font-size: 13px;
  text-align: left;
}

.tools-menu-content button:hover,
.tools-menu-content .button-link:hover {
  background: #f1f5f9;
  border-color: #f1f5f9;
}

.status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0 0 8px;
  color: #5f6368;
  font-size: 12px;
}

.scope-badge {
  width: fit-content;
  margin: 0 0 8px;
  padding: 3px 8px;
  border: 1px solid #d8dde6;
  border-radius: 999px;
  background: #fff;
  color: #5f6368;
  font-size: 12px;
  font-weight: 800;
}

.status-line span {
  display: inline-flex;
  align-items: center;
}

.status-line span + span::before {
  content: "";
  width: 4px;
  height: 4px;
  margin-right: 14px;
  border-radius: 50%;
  background: #a8b0bd;
}

.status-line .stale {
  color: #8a5a00;
  font-weight: 700;
}

.stale-warning {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-color: #f3c66d;
  border: 1px solid #f3c66d;
  border-radius: 6px;
  background: #fff8e5;
  color: #7a4d00;
  font-size: 13px;
  font-weight: 700;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #c8d1dc;
  border-radius: 6px;
  background: #fff;
  color: #202124;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.button-link:hover {
  background: #f1f4f8;
}

.controls-panel {
  display: grid;
  gap: 10px;
}

.control-grid {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(160px, 1fr));
  gap: 10px;
  align-items: end;
}

.quick-range {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quick-range button {
  padding: 8px 10px;
  font-size: 12px;
}

.quick-range button.active {
  background: #1f6feb;
  border-color: #1f6feb;
  color: #fff;
}

select {
  width: 100%;
  border: 1px solid #c8d1dc;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  background: #fff;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.snapshot-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid #d8dde6;
  border-radius: 10px;
  background: #fff;
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
}

.kpi-row {
  display: grid;
  gap: 10px;
}

.snapshot-panel {
  display: grid;
  gap: 8px;
}

.primary-kpis {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.secondary-kpis {
  display: contents;
}

.live-team-status {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #d8dde6;
  border-radius: 8px;
  background: #fff;
}

.live-team-status h2 {
  margin: 0;
  font-size: 15px;
}

#popout-live {
  align-self: start;
  padding: 5px 9px;
  font-size: 12px;
}

.live-team-status p {
  margin: 3px 0 0;
  color: #5f6368;
  font-size: 12px;
}

.live-team-list {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.hud-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 9px;
  border: 1px solid #e4e9f0;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 12px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.hud-card.is-selected {
  border-color: #4777a8;
  background: #f3f8fc;
}

.hud-card:focus-visible {
  outline: 2px solid #4777a8;
  outline-offset: 2px;
}

.hud-card-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.hud-card span {
  color: #5f6368;
}

.hud-status {
  color: #202124 !important;
  font-weight: 800;
}

.hud-call-timer {
  color: #202124 !important;
  font-weight: 800;
}

.hud-call-timer-row {
  min-height: 17px;
}

.caller-insight-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #d8dde6;
  border-radius: 8px;
  background: #fff;
}

.caller-insight-panel h2 {
  margin: 0;
  font-size: 15px;
}

.caller-insight-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.compact-button {
  min-height: 32px;
  padding: 6px 10px;
  white-space: nowrap;
}

.caller-insight-content {
  color: #3c4043;
  font-size: 12px;
}

.caller-insight-content p {
  margin: 0;
}

.caller-insight-phone {
  margin-bottom: 8px !important;
  color: #5f6368;
  font-weight: 700;
}

.caller-insight-note {
  margin-bottom: 8px !important;
  color: #8a5a00;
}

.caller-insight-portal {
  color: #5f6368;
  font-size: 11px;
  font-weight: 700;
}

.record-contact-section {
  margin: 16px 0;
  padding-top: 12px;
  border-top: 1px solid #e4e9f0;
}

.record-contact-section h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.record-contact-section a {
  display: inline-block;
  min-height: 32px;
  line-height: 32px;
}

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

.caller-match-card {
  display: grid;
  gap: 8px;
  padding: 9px;
  border: 1px solid #e4e9f0;
  border-radius: 8px;
  background: #f8fafc;
}

.caller-match-card .drawer-list {
  margin: 0;
  grid-template-columns: minmax(110px, auto) 1fr;
}

.compact-cards {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.metric-card {
  background: #fff;
  border: 1px solid #d8dde6;
  border-radius: 8px;
  min-height: 88px;
  padding: 10px;
}

.metric-card .label {
  margin: 0 0 6px;
  color: #5f6368;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-card .value {
  margin: 0;
  color: #202124;
  font-size: 21px;
  font-weight: 800;
}

.metric-link {
  min-height: 36px;
  padding: 4px 8px;
  border-color: transparent;
  background: transparent;
  color: #1f6feb;
  font: inherit;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.metric-link:hover,
.metric-link:focus {
  background: #eef4ff;
  border-color: #b8cff8;
}

.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  box-sizing: border-box;
  background: rgba(32, 33, 36, 0.35);
}

.detail-panel {
  width: min(1120px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  border-color: #b8cff8;
  box-shadow: 0 18px 48px rgba(32, 33, 36, 0.22);
}

.small-table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.small-table table {
  min-width: 760px;
}

.detail-header,
.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-filter {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.detail-filter input {
  min-width: 220px;
}

.active-filter {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 0 0 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: #174ea6;
  font-size: 12px;
  font-weight: 700;
}

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

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: #f4f8ff;
}

.record-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 50;
  width: min(520px, 100vw);
  height: 100vh;
  overflow: auto;
  box-sizing: border-box;
  padding: 18px;
  border-left: 1px solid #d8dde6;
  background: #fff;
  box-shadow: -16px 0 40px rgba(32, 33, 36, 0.18);
}

.call-summary-link { display: block; margin-top: 0.35rem; padding: 0; }
.call-summary-section ul { padding-left: 1.25rem; }
.call-summary-section li { margin-bottom: 0.4rem; }

.conversation-drawer { z-index: 60; width: min(720px, 100vw); }
.conversation-popup-messages { display: grid; gap: 10px; align-content: start; }

.drawer-list {
  grid-template-columns: minmax(150px, auto) 1fr;
  margin-bottom: 16px;
}

.routing-details {
  margin-top: 12px;
}

.message-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 12px;
  border: 1px solid #d8dde6;
  border-radius: 6px;
  background: #f8fafc;
  line-height: 1.45;
}

.rules-form {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

#sms-rules-status {
  white-space: pre-line;
}

.rules-form textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #c8d1dc;
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
}

.owner-sms-panel {
  width: min(520px, calc(100vw - 36px));
}

.no-follow-up-panel {
  width: min(480px, calc(100vw - 36px));
}

.no-follow-up-form {
  display: grid;
  gap: 12px;
}

.no-follow-up-form label {
  display: grid;
  gap: 5px;
  font-weight: 700;
}

.no-follow-up-form textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid #c8d1dc;
  border-radius: 6px;
  font: inherit;
  line-height: 1.4;
}

.owner-sms-form {
  display: grid;
  gap: 12px;
}

.owner-sms-form label {
  display: grid;
  gap: 5px;
  font-weight: 700;
}

.owner-sms-form input,
.owner-sms-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #c8d1dc;
  border-radius: 6px;
  font: inherit;
}

.owner-sms-form textarea {
  resize: vertical;
  line-height: 1.4;
}

.quick-reply-picker {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #d8dde6;
  border-radius: 6px;
  background: #f8fafc;
}

.quick-reply-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-reply-heading label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.quick-reply-heading select,
.quick-replies-manager select {
  padding: 6px 8px;
  border: 1px solid #c8d1dc;
  border-radius: 5px;
  background: #fff;
  font: inherit;
}

.quick-reply-tabs,
.quick-reply-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quick-reply-tabs button.active {
  border-color: #1f6feb;
  background: #eef5ff;
  color: #174f9b;
}

.quick-reply-options button {
  min-height: 32px;
  text-align: left;
}

.quick-replies-manager {
  width: min(900px, calc(100vw - 36px));
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.rule-text {
  max-width: 380px;
  white-space: normal;
}

.muted {
  color: #5f6368;
}

.hidden {
  display: none;
}

.low-prominence {
  opacity: 0.92;
}

.outcome-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  background: #eef2f7;
  font-size: 11px;
  font-weight: 700;
}

.sms-shell {
  width: min(1400px, calc(100vw - 32px));
}

.sms-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 12px;
  align-items: start;
  height: calc(100vh - 250px);
  min-height: 520px;
}

.sms-thread-panel,
.sms-conversation-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

.thread-list,
.conversation-messages {
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}

.thread-list {
  flex: 1;
}

.conversation-messages {
  flex: 1;
  align-content: start;
}

.thread-item {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 10px;
  border: 1px solid #d8dde6;
  border-radius: 8px;
  background: #fff;
  color: #202124;
  text-align: left;
}

.thread-item span {
  color: #5f6368;
  font-size: 12px;
}

.thread-item.active {
  border-color: #1f6feb;
  box-shadow: 0 0 0 2px rgba(31, 111, 235, 0.12);
}

.conversation-header {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.conversation-header h2 {
  margin: 0;
}

.sort-control {
  display: grid;
  gap: 4px;
  min-width: 160px;
  color: #5f6368;
  font-size: 12px;
  font-weight: 800;
}

.message-bubble {
  width: min(680px, 92%);
  padding: 12px;
  border: 1px solid #d8dde6;
  border-radius: 10px;
  background: #f8fafc;
}

.message-bubble.outbound {
  justify-self: end;
  background: #eef6ff;
}

.message-bubble.inbound {
  justify-self: start;
  background: #fff;
}

.message-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #5f6368;
  font-size: 12px;
}

.message-body {
  margin: 8px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.sms-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.sms-badge.automated {
  background: #f1f5f9;
  color: #475569;
}

.message-details {
  margin-top: 8px;
  color: #5f6368;
  font-size: 12px;
}

.message-details summary {
  width: fit-content;
  cursor: pointer;
  font-weight: 800;
}

.message-details dl {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 4px 10px;
  margin: 8px 0 0;
  color: #5f6368;
  font-size: 12px;
}

.message-details dt {
  font-weight: 800;
}

.message-details dd {
  margin: 0;
}

.mobile-only {
  display: none;
}

@media (max-width: 900px) {
  .dashboard-hero {
    grid-template-columns: 1fr;
    margin: -8px -8px 8px;
  }

  .hero-actions {
    justify-content: stretch;
  }

  .hero-actions > *,
  .primary-button {
    width: 100%;
  }

  .tools-menu-content {
    position: static;
    min-width: 0;
  }

  .status-line {
    display: grid;
    gap: 4px;
  }

  .status-line span + span::before {
    display: none;
  }

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

  .token-row {
    display: grid;
  }

  .metric-card {
    padding: 12px;
  }

  .metric-card .value {
    font-size: 22px;
  }

  .primary-kpis,
  .secondary-kpis {
    grid-template-columns: 1fr 1fr;
  }

  .live-team-status {
    align-items: flex-start;
    display: grid;
  }

  .detail-header,
  .drawer-header,
  .detail-filter {
    display: grid;
  }

  .detail-actions button,
  .detail-filter button,
  .detail-filter input,
  .detail-filter select {
    width: 100%;
    box-sizing: border-box;
  }

  .record-drawer {
    width: 100vw;
  }

  .detail-overlay {
    align-items: stretch;
    padding: 0;
  }

  .detail-panel {
    width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    margin-bottom: 0;
  }

  .collapsible-header {
    align-items: stretch;
    display: grid;
  }

  .sms-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }

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

  .sms-layout.conversation-open .sms-thread-panel {
    display: none;
  }

  .sms-layout:not(.conversation-open) .sms-conversation-panel {
    display: none;
  }

  .sms-thread-panel,
  .sms-conversation-panel,
  .thread-list,
  .conversation-messages {
    max-height: none;
    overflow: visible;
  }

  .conversation-header {
    display: grid;
  }

  .sort-control {
    min-width: 0;
  }

  .message-bubble {
    width: 100%;
    box-sizing: border-box;
  }

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

@media (max-width: 1200px) and (min-width: 901px) {
  .primary-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .primary-kpis {
    grid-template-columns: 1fr;
  }
}
