* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #09111d;
  --bg-soft: #0f1a2c;
  --panel: rgba(16, 24, 40, 0.82);
  --panel-strong: #111c2f;
  --line: rgba(157, 177, 211, 0.16);
  --text: #eef4ff;
  --muted: #99a9c4;
  --gold: #f5b85c;
  --cyan: #4ed7f5;
  --violet: #7d7cff;
  --green: #48da92;
  --red: #ff6c7a;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(78, 215, 245, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(125, 124, 255, 0.18), transparent 34%),
    linear-gradient(180deg, #07111e 0%, #09111d 100%);
  color: var(--text);
}

body.modal-open {
  overflow: hidden;
}

.shell {
  max-width: 1380px;
  margin: 0 auto;
  padding: 36px 24px 80px;
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(12, 20, 34, 0.74);
  border: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand-mark {
  color: var(--text);
  text-decoration: none;
  font-weight: 900;
  letter-spacing: 0.08em;
  font-size: 1.1rem;
}

.top-nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.nav-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-links a {
  text-decoration: none;
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: 120ms ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: rgba(255,255,255,0.05);
  border-color: var(--line);
}

.action-stack {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero {
  display: grid;
  gap: 14px;
  margin-bottom: 28px;
}

h1 {
  margin: 0;
  font-size: clamp(2.8rem, 5vw, 5.4rem);
  line-height: 0.92;
  max-width: 11ch;
}

.hero-title {
  max-width: none;
}

.hero-tagline {
  margin: 0;
  font-size: clamp(1rem, 1.8vw, 1.4rem);
  line-height: 1.1;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.compact-hero {
  margin-bottom: 20px;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding-top: 40px;
}

.auth-card {
  width: min(560px, 100%);
}

.hero-copy {
  margin: 0;
  max-width: 74ch;
  line-height: 1.65;
  color: var(--muted);
  font-size: 1.04rem;
}

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

.hero-metric {
  padding: 18px 20px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.hero-metric span,
.metric-label,
.saved-meta,
.panel p,
.post-card p,
.comment-context,
.theme-chip span,
.signal-card span {
  color: var(--muted);
}

.hero-metric strong {
  display: block;
  margin-top: 10px;
  font-size: 1.45rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  margin-bottom: 24px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px;
  box-shadow:
    0 18px 60px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(18px);
  position: relative;
  overflow: visible;
  margin-bottom: 24px;
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 1.2rem;
}

.panel h3 {
  margin: 0;
  font-size: 1rem;
}

.stack {
  display: grid;
  gap: 16px;
}

.field,
.reply-form label,
.inbox-toolbar label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.field input,
.field select,
.field textarea,
.reply-form textarea,
.reply-form input,
.inbox-toolbar select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  font: inherit;
  color: var(--text);
  background: rgba(7, 14, 25, 0.9);
}

.field textarea,
.reply-form textarea {
  min-height: 110px;
  resize: vertical;
}

.button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  background: linear-gradient(135deg, var(--gold), #cf7d25);
  color: #111;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.button:hover {
  filter: brightness(1.05);
}

.subtle-button {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid var(--line);
}

.danger-button {
  background: rgba(255,255,255,0.04);
  color: var(--gold);
  border: 1px solid rgba(245, 184, 92, 0.24);
}

.status {
  min-height: 24px;
  margin: 0;
  font-weight: 700;
}

.status.pending {
  color: var(--gold);
}

.status.success {
  color: var(--green);
}

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

.saved-card,
.metric-card,
.post-card,
.comment-card,
.signal-card,
.theme-chip,
.sync-health-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid var(--line);
}

.saved-card {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(320px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 18px;
  border-radius: 18px;
}

.saved-card-primary {
  min-width: 0;
}

.saved-card-primary p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-meta-inline {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 16px;
}

.saved-meta-inline span {
  white-space: nowrap;
}

.saved-card h3,
.post-card h3,
.comment-card h3 {
  margin: 0 0 6px;
}

.saved-card p,
.saved-meta span,
.comment-card-header p,
.comment-message,
.signal-card p {
  margin: 0;
}

code {
  padding: 3px 7px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--gold);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

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

.metric-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 18px;
}

.metric-head,
.chart-title-row,
.distribution-meta,
.legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.metric-card strong {
  font-size: 1.3rem;
}

.tooltip-trigger {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: rgba(245, 184, 92, 0.18);
  color: var(--gold);
  border: 1px solid rgba(245, 184, 92, 0.24);
  font-size: 0.76rem;
  font-weight: 900;
  cursor: help;
  flex-shrink: 0;
}

.has-tooltip {
  position: relative;
}

.has-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  transform: translateX(-50%) translateY(4px);
  width: min(280px, 80vw);
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--gold);
  color: #111;
  font-size: 0.82rem;
  line-height: 1.45;
  font-weight: 700;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 3000;
}

.has-tooltip:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.glow-card:nth-child(1) {
  box-shadow: 0 0 0 1px rgba(245,184,92,0.12), 0 0 28px rgba(245,184,92,0.12);
}

.glow-card:nth-child(2) {
  box-shadow: 0 0 0 1px rgba(78,215,245,0.12), 0 0 28px rgba(78,215,245,0.12);
}

.glow-card:nth-child(3) {
  box-shadow: 0 0 0 1px rgba(125,124,255,0.12), 0 0 28px rgba(125,124,255,0.12);
}

.glow-card:nth-child(4) {
  box-shadow: 0 0 0 1px rgba(255,108,122,0.12), 0 0 28px rgba(255,108,122,0.12);
}

.chart-panel {
  overflow: hidden;
}

.chart-card-grid,
.distribution-stack {
  display: grid;
  gap: 20px;
}

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

.chart-card,
.band-chart-card {
  display: grid;
  gap: 18px;
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid var(--line);
  position: relative;
  overflow: visible;
}

.donut-layout {
  display: grid;
  justify-items: center;
  grid-template-rows: 150px auto;
  gap: 24px;
  align-content: start;
  min-height: 420px;
}

.donut-chart {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-self: start;
}

.donut-hole {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: rgba(9, 17, 29, 0.96);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  text-align: center;
}

.donut-hole strong {
  font-size: 1.3rem;
}

.donut-hole span {
  color: var(--muted);
  font-size: 0.8rem;
}

.donut-legend,
.band-legend,
.distribution-list {
  display: grid;
  gap: 10px;
}

.donut-legend {
  width: 100%;
  max-width: 360px;
  align-self: start;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.distribution-row {
  display: grid;
  gap: 8px;
}

.distribution-track,
.band-track {
  width: 100%;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
}

.distribution-track {
  height: 12px;
}

.distribution-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.band-track {
  display: flex;
  height: 20px;
}

.band-fill {
  display: block;
  min-width: 10px;
}

.high-band {
  background: #48da92;
}

.medium-band {
  background: #f5b85c;
}

.low-band {
  background: #ff6c7a;
}

.chart-grid {
  display: flex;
  align-items: end;
  gap: 10px;
  min-height: 210px;
  padding-top: 22px;
}

.chart-group {
  display: grid;
  justify-items: center;
  gap: 8px;
  flex: 1;
}

.bar-stack {
  width: 100%;
  min-height: 150px;
  display: flex;
  gap: 6px;
  align-items: end;
  justify-content: center;
}

.bar {
  width: 18px;
  border-radius: 999px 999px 6px 6px;
}

.posts-bar {
  background: linear-gradient(180deg, var(--cyan), #1f83ff);
}

.comments-bar {
  background: linear-gradient(180deg, var(--gold), #ff6a3d);
}

.chart-group span {
  color: var(--muted);
  font-size: 0.82rem;
}

.theme-list,
.signal-grid,
.contact-list {
  display: grid;
  gap: 12px;
}

.theme-list {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.keyword-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.theme-chip,
.signal-card {
  padding: 14px 16px;
  border-radius: 18px;
}

.raw-chip {
  opacity: 0.84;
}

.theme-chip strong {
  display: block;
  margin-bottom: 4px;
}

.signal-card {
  display: grid;
  gap: 8px;
}

.ranked-card {
  grid-template-columns: 52px 1fr;
  align-items: start;
}

.rank-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(78,215,245,0.14);
  color: var(--cyan);
  font-weight: 800;
}

.recommendation-list,
.checklist,
.comment-preview {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
}

.recommendation-list li,
.checklist li,
.comment-preview li,
.comment-message {
  line-height: 1.6;
}

.post-list,
.comment-inbox {
  display: grid;
  gap: 16px;
}

.reply-bank-list,
.reply-bank-cards {
  display: grid;
  gap: 16px;
}

.contacts-grid {
  align-items: start;
}

.contact-list-card {
  width: 100%;
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.contact-list-card.active {
  border-color: rgba(245, 184, 92, 0.35);
  box-shadow: 0 0 0 1px rgba(245,184,92,0.14), 0 0 28px rgba(245,184,92,0.08);
}

.contact-list-head,
.contact-list-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.contact-list-meta,
.contact-list-card p,
.panel-section p {
  margin: 0;
  color: var(--muted);
}

.contact-detail-stack,
.panel-section {
  display: grid;
  gap: 18px;
}

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

.contact-form-grid {
  margin-bottom: 0;
}

.contact-hero-card {
  margin-bottom: 0;
}

.due-tag {
  background: rgba(255,108,122,0.16);
  color: #ffd5db;
}

.diagnostic-panel {
  margin-top: 18px;
  display: grid;
  gap: 18px;
}

.diagnostic-table-wrap {
  margin-top: 4px;
}

.muted-inline {
  color: var(--muted);
}

.reply-bank-list {
  margin-top: 24px;
}

.reply-bank-group {
  display: grid;
  gap: 14px;
}

.reply-bank-group-head,
.reply-bank-card-head,
.reply-bank-header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.reply-bank-group-head span,
.reply-bank-keywords {
  color: var(--muted);
}

.reply-bank-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

.reply-bank-card p {
  margin: 0;
  line-height: 1.6;
}

.reply-bank-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.compact-button {
  padding: 9px 14px;
  font-size: 0.9rem;
}

.post-card,
.comment-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 18px;
}

.post-card-header,
.comment-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.post-meta,
.comment-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.post-meta {
  flex-direction: column;
  align-items: flex-end;
}

.post-meta a,
.comment-actions a {
  color: var(--cyan);
}

.comment-card.handled {
  opacity: 0.72;
}

.reply-form {
  position: relative;
}

.slash-picker {
  position: absolute;
  left: 0;
  right: 0;
  top: 118px;
  z-index: 4000;
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(9, 15, 26, 0.98);
  border: 1px solid rgba(245, 184, 92, 0.24);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.slash-option {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.slash-option:hover,
.slash-option.active {
  border-color: rgba(245, 184, 92, 0.42);
  background: rgba(245, 184, 92, 0.1);
}

.slash-option-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.slash-option-head span,
.slash-option-text,
.slash-picker-empty {
  color: var(--muted);
}

.slash-option-text,
.slash-picker-empty {
  line-height: 1.5;
}

.tag {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(125,124,255,0.16);
  color: #d6d8ff;
  font-size: 0.82rem;
  text-transform: lowercase;
}

.handled-tag {
  background: rgba(72,218,146,0.14);
  color: var(--green);
}

.comment-actions,
.reply-actions,
.inbox-header,
.inbox-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.inbox-toolbar-wide {
  margin-bottom: 18px;
}

.inbox-header {
  justify-content: space-between;
  margin-bottom: 16px;
}

.pill-count {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(78,215,245,0.12);
  color: var(--cyan);
  font-size: 0.9rem;
  font-weight: 700;
}

.empty-state {
  color: var(--muted);
}

.footer-note {
  margin-top: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.sync-health-card {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border-radius: 18px;
}

.sync-health-card strong,
.sync-health-card span,
.sync-health-card p {
  display: block;
}

.sync-health-card span,
.sync-health-card p {
  color: var(--muted);
  margin: 0;
}

.sync-health-card.warning {
  border-color: rgba(245, 184, 92, 0.3);
  box-shadow: 0 0 0 1px rgba(245,184,92,0.12), 0 0 24px rgba(245,184,92,0.08);
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.data-table th,
.data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.data-table td {
  line-height: 1.5;
}

.helper-copy {
  margin-top: 8px;
  font-size: 0.92rem;
}

.modal-shell[hidden] {
  display: none;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 15, 0.72);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  width: min(520px, 100%);
  padding: 28px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(18, 28, 46, 0.96), rgba(11, 18, 31, 0.96));
  border: 1px solid rgba(245, 184, 92, 0.2);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.45);
}

.modal-eyebrow {
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  font-weight: 800;
  margin-bottom: 10px;
}

.modal-card h2 {
  margin: 0 0 10px;
  font-size: 1.6rem;
}

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

.modal-progress {
  margin-top: 18px;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}

.modal-progress-bar {
  display: block;
  width: 35%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--gold), #cf7d25, var(--cyan));
  animation: sync-slide 1.15s ease-in-out infinite;
}

.modal-note {
  margin-top: 14px !important;
  font-size: 0.92rem;
}

@keyframes sync-slide {
  0% {
    transform: translateX(-120%);
  }

  50% {
    transform: translateX(95%);
  }

  100% {
    transform: translateX(240%);
  }
}

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

  .summary-grid,
  .hero-metrics,
  .chart-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

@media (max-width: 720px) {
  .summary-grid,
  .hero-metrics,
  .chart-card-grid {
    grid-template-columns: 1fr;
  }

  .top-nav {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .saved-meta-inline {
    justify-content: flex-start;
  }

  .post-card-header,
  .comment-card-header {
    flex-direction: column;
  }

  .action-stack {
    flex-direction: column;
  }

  .post-meta {
    align-items: flex-start;
  }
}
