:root {
  --bg: #edf4ee;
  --bg-accent: #dfeee3;
  --surface: rgba(255, 255, 255, 0.76);
  --surface-strong: #ffffff;
  --surface-deep: #123329;
  --text: #173225;
  --muted: #617567;
  --border: rgba(19, 90, 53, 0.12);
  --green: #18b35d;
  --green-deep: #0d8c44;
  --green-soft: #dff8e9;
  --lime: #a6d63f;
  --yellow: #f2c94c;
  --orange: #ff9f47;
  --red: #e35555;
  --blue: #2993d1;
  --shadow: 0 26px 60px rgba(16, 65, 37, 0.12);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --transition: 220ms ease;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(166, 214, 63, 0.24), transparent 22%),
    radial-gradient(circle at top right, rgba(41, 147, 209, 0.14), transparent 24%),
    linear-gradient(180deg, #f7fbf8 0%, var(--bg) 42%, #e4efe7 100%);
}

button,
textarea {
  font: inherit;
}

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

.sidebar {
  padding: 28px 22px;
  background:
    linear-gradient(180deg, rgba(18, 51, 41, 0.98), rgba(10, 33, 26, 0.98)),
    linear-gradient(135deg, rgba(24, 179, 93, 0.18), transparent 40%);
  color: #f4fff7;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.brand-card,
.sidebar-panel,
.panel,
.hero-card {
  backdrop-filter: blur(18px);
}

.brand-card {
  padding: 22px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.brand-row {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04));
  display: grid;
  place-items: center;
}

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

.brand-title {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.brand-subtitle,
.brand-copy,
.sidebar-panel__label,
.panel-subtitle,
.eyebrow,
.hero-copy,
.kpi-label,
.mention-meta,
.detail-meta,
.assist-meta,
.context-meta,
.mini-note,
.reply-editor::placeholder,
.assistant-label,
.assistant-input::placeholder {
  color: rgba(244, 255, 247, 0.7);
}

.brand-subtitle {
  font-size: 0.85rem;
}

.brand-copy {
  margin: 16px 0 0;
  font-size: 0.96rem;
  line-height: 1.5;
}

.nav {
  display: grid;
  gap: 10px;
  margin: 24px 0;
}

.nav-item,
.filter-chip,
.primary-button,
.ghost-button {
  border: 0;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition), color var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.nav-item {
  text-align: left;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(244, 255, 247, 0.92);
  border: 1px solid transparent;
}

.nav-item:hover,
.nav-item.is-active {
  background: linear-gradient(135deg, rgba(24, 179, 93, 0.28), rgba(255, 255, 255, 0.08));
  border-color: rgba(166, 214, 63, 0.26);
  transform: translateX(4px);
}

.sidebar-panel {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-panel__label {
  font-size: 0.83rem;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.competitor-mini {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.competitor-mini:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.competitor-mini strong,
.competitor-mini span {
  display: block;
}

.competitor-mini span {
  color: rgba(244, 255, 247, 0.68);
  font-size: 0.85rem;
  margin-top: 4px;
}

.main {
  padding: 30px 34px 40px;
}

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

.eyebrow {
  color: #4e7a58;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
  margin-bottom: 8px;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 2.5vw, 3.4rem);
  line-height: 1.02;
  max-width: 760px;
}

.topbar-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button {
  padding: 13px 18px;
  border-radius: 999px;
  font-weight: 700;
}

.primary-button {
  color: white;
  background: linear-gradient(135deg, var(--green), var(--green-deep));
  box-shadow: 0 18px 30px rgba(24, 179, 93, 0.22);
}

.primary-button:hover,
.ghost-button:hover,
.filter-chip:hover {
  transform: translateY(-2px);
}

.ghost-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(19, 90, 53, 0.14);
}

.view {
  display: none;
  animation: fadeUp 320ms ease;
}

.view.is-visible {
  display: block;
}

.hero-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero-card {
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-end;
  padding: 26px 28px;
  border-radius: 34px;
  background:
    linear-gradient(135deg, rgba(24, 179, 93, 0.12), rgba(255, 255, 255, 0.9) 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.76));
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -36px -36px auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(166, 214, 63, 0.34), transparent 65%);
}

.hero-title {
  font-size: clamp(1.45rem, 2vw, 2.2rem);
  font-weight: 800;
  margin-bottom: 10px;
}

.hero-copy {
  color: #496559;
  margin: 0;
  max-width: 720px;
  line-height: 1.6;
}

.hero-status {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 999px;
  background: rgba(18, 51, 41, 0.92);
  color: #f4fff7;
  font-size: 0.92rem;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #65ff91;
  box-shadow: 0 0 0 0 rgba(101, 255, 145, 0.52);
  animation: pulse 1.8s infinite;
}

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

.kpi-card {
  padding: 20px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(19, 90, 53, 0.12);
  box-shadow: var(--shadow);
}

.kpi-label {
  color: #64806f;
  font-size: 0.92rem;
}

.kpi-value {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 16px;
  font-size: 2rem;
  font-weight: 800;
}

.kpi-delta {
  color: var(--green-deep);
  font-size: 0.92rem;
  font-weight: 700;
}

.overview-grid,
.response-layout,
.escalation-layout,
.assistant-layout {
  display: grid;
  gap: 18px;
}

.overview-grid {
  grid-template-columns: 1.2fr 0.9fr;
}

.response-layout,
.assistant-layout,
.escalation-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  padding: 22px;
  border-radius: var(--radius-xl);
}

.panel-head,
.section-header,
.assistant-answer-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.panel-title {
  font-size: 1.15rem;
  font-weight: 800;
}

.panel-subtitle {
  margin-top: 6px;
  font-size: 0.95rem;
  color: var(--muted);
}

.spotlight-list,
.mention-list,
#themeBars,
#competitorInsights,
#escalationList {
  display: grid;
  gap: 14px;
}

.spotlight-item,
.mention-item,
.escalation-item,
.competitor-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(19, 90, 53, 0.1);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.spotlight-item:hover,
.mention-item:hover,
.mention-item.is-active,
.escalation-item:hover,
.escalation-item.is-active,
.competitor-card:hover {
  transform: translateY(-2px);
  border-color: rgba(24, 179, 93, 0.28);
  box-shadow: 0 18px 30px rgba(16, 65, 37, 0.08);
}

.spotlight-top,
.mention-top,
.detail-top,
.escalation-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.spotlight-title,
.mention-title,
.detail-title,
.escalation-title {
  font-size: 1rem;
  font-weight: 800;
}

.spotlight-copy,
.mention-preview,
.detail-text,
.context-copy,
.assistant-answer-body,
.recommendation-list,
.mini-note,
.competitor-copy {
  color: var(--muted);
  line-height: 1.55;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.chip--positive {
  background: rgba(24, 179, 93, 0.12);
  color: var(--green-deep);
}

.chip--negative {
  background: rgba(227, 85, 85, 0.12);
  color: #ba3737;
}

.chip--warning {
  background: rgba(242, 201, 76, 0.18);
  color: #9a6b04;
}

.chip--neutral {
  background: rgba(18, 51, 41, 0.08);
  color: #345948;
}

.flow-steps {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.flow-step {
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(24, 179, 93, 0.1), rgba(255, 255, 255, 0.8));
  border: 1px solid rgba(19, 90, 53, 0.1);
}

.flow-step strong,
.flow-step span {
  display: block;
}

.flow-step span {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
}

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

.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(19, 90, 53, 0.12);
  color: var(--text);
  font-weight: 700;
}

.filter-chip.is-active {
  background: linear-gradient(135deg, rgba(24, 179, 93, 0.18), rgba(166, 214, 63, 0.18));
  border-color: rgba(24, 179, 93, 0.24);
}

.monitor-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.15fr);
  gap: 18px;
}

.mention-panel,
.detail-panel {
  min-height: 620px;
}

.mention-item {
  cursor: pointer;
}

.mention-meta,
.detail-meta,
.context-meta,
.assist-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.detail-stack,
.context-stack {
  display: grid;
  gap: 18px;
}

.detail-card,
.context-card,
.assistant-answer-block {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(19, 90, 53, 0.1);
}

.detail-card strong,
.assistant-answer-block strong {
  display: block;
  margin-bottom: 8px;
}

.detail-tags,
.action-group,
.tone-tags,
.quick-prompts {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.action-group {
  margin-top: 18px;
}

.reply-editor,
.assistant-input {
  width: 100%;
  resize: none;
  border-radius: 20px;
  border: 1px solid rgba(19, 90, 53, 0.12);
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  padding: 18px;
  line-height: 1.6;
}

.reply-editor {
  min-height: 286px;
}

.assistant-input {
  min-height: 190px;
  margin: 12px 0 16px;
}

.reply-editor:focus,
.assistant-input:focus {
  outline: 2px solid rgba(24, 179, 93, 0.26);
  outline-offset: 2px;
}

.response-foot {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.confidence span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.confidence strong {
  font-size: 1.2rem;
}

.chart-panel,
.themes-panel {
  min-height: 350px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
}

.map-panel,
.competitor-panel {
  min-height: 380px;
}

.line-chart {
  margin-top: 16px;
  min-height: 240px;
  padding: 12px 0 0;
}

.line-chart svg {
  width: 100%;
  height: 100%;
}

.axis-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.84rem;
}

.theme-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) 58px;
  gap: 14px;
  align-items: center;
}

.theme-track {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: rgba(19, 90, 53, 0.08);
  overflow: hidden;
}

.theme-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--lime));
}

.heat-map {
  position: relative;
  min-height: 270px;
  margin-top: 18px;
  border-radius: 26px;
  background:
    radial-gradient(circle at 20% 24%, rgba(24, 179, 93, 0.18), transparent 18%),
    radial-gradient(circle at 72% 38%, rgba(41, 147, 209, 0.12), transparent 16%),
    linear-gradient(180deg, rgba(222, 241, 228, 0.9), rgba(255, 255, 255, 0.76));
  border: 1px solid rgba(19, 90, 53, 0.1);
  overflow: hidden;
}

.heat-map::before {
  content: "";
  position: absolute;
  inset: 20px;
  border-radius: 22px;
  border: 1px dashed rgba(19, 90, 53, 0.16);
}

.map-point {
  position: absolute;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  color: white;
  font-weight: 800;
  box-shadow: 0 18px 30px rgba(16, 65, 37, 0.14);
}

.map-point[data-level="low"] {
  background: linear-gradient(135deg, var(--green), #5ccd72);
}

.map-point[data-level="medium"] {
  background: linear-gradient(135deg, var(--yellow), var(--orange));
}

.map-point[data-level="high"] {
  background: linear-gradient(135deg, #f77462, #d04343);
}

.map-tooltip {
  position: absolute;
  left: 20px;
  bottom: 18px;
  padding: 14px 16px;
  max-width: 300px;
  border-radius: 18px;
  background: rgba(18, 51, 41, 0.94);
  color: #f4fff7;
}

.map-tooltip strong,
.map-tooltip span {
  display: block;
}

.map-tooltip span {
  margin-top: 6px;
  color: rgba(244, 255, 247, 0.78);
  line-height: 1.45;
}

.assistant-answer-panel {
  min-height: 520px;
}

.assistant-answer-body {
  margin-top: 14px;
}

.assistant-answer-block {
  margin-top: 14px;
}

.assistant-answer-block ul,
.recommendation-list {
  margin: 10px 0 0;
  padding-left: 18px;
}

.assistant-answer-block li,
.recommendation-list li {
  margin-bottom: 8px;
}

.quick-prompt {
  padding: 10px 14px;
  border-radius: 16px;
  border: 1px solid rgba(19, 90, 53, 0.12);
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
}

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

.mini-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(19, 90, 53, 0.08);
}

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

.mini-card span {
  margin-top: 6px;
  color: var(--muted);
}

.sync-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(18, 51, 41, 0.94);
  color: #f4fff7;
  box-shadow: 0 24px 40px rgba(16, 65, 37, 0.22);
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
}

.sync-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(101, 255, 145, 0.52);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(101, 255, 145, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(101, 255, 145, 0);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .main {
    padding-top: 0;
  }

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

@media (max-width: 980px) {
  .main,
  .sidebar {
    padding: 20px;
  }

  .topbar,
  .overview-grid,
  .monitor-layout,
  .response-layout,
  .assistant-layout,
  .escalation-layout,
  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-header,
  .panel-head,
  .assistant-answer-head,
  .response-foot {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .kpi-grid,
  .escalation-summary {
    grid-template-columns: 1fr;
  }

  .theme-row {
    grid-template-columns: 1fr;
  }

  .topbar-actions,
  .action-group,
  .tone-tags,
  .quick-prompts,
  .filter-row {
    width: 100%;
  }

  .primary-button,
  .ghost-button,
  .filter-chip,
  .quick-prompt {
    width: 100%;
  }
}
