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

.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;
}

.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;
}

.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;
  padding: 9px;
  border: 1px solid #e4e9f0;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 12px;
}

.hud-card div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.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;
}

.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);
}

.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;
}

.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;
  }
}
