:root {
  color-scheme: dark;
  --bg: #08111e;
  --bg2: #0e1a2f;
  --panel: rgba(10, 18, 33, 0.78);
  --panel-strong: rgba(16, 26, 46, 0.96);
  --line: rgba(180, 203, 255, 0.12);
  --text: #eef4ff;
  --muted: #93a4c4;
  --accent: #7dd3fc;
  --accent-2: #f59e0b;
  --good: #34d399;
  --warn: #f97316;
  --bad: #fb7185;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(
      circle at top left,
      rgba(125, 211, 252, 0.16),
      transparent 35%
    ),
    radial-gradient(
      circle at 85% 15%,
      rgba(245, 158, 11, 0.12),
      transparent 30%
    ),
    linear-gradient(160deg, var(--bg), var(--bg2));
  font-family: "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
}

button,
input {
  font: inherit;
}

.bg-orb {
  position: fixed;
  inset: auto;
  border-radius: 999px;
  filter: blur(54px);
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
}

.bg-orb-a {
  width: 320px;
  height: 320px;
  right: -120px;
  top: 20px;
  background: rgba(125, 211, 252, 0.28);
}

.bg-orb-b {
  width: 240px;
  height: 240px;
  left: -80px;
  bottom: 80px;
  background: rgba(245, 158, 11, 0.18);
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-sizing: border-box;
}

.card {
  background: linear-gradient(
    180deg,
    rgba(13, 21, 37, 0.88),
    rgba(10, 16, 30, 0.78)
  );
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero {
  border-radius: 28px;
  padding: 22px 24px;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 0.95fr) minmax(350px, 1.05fr);
  align-items: end;
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.76rem;
  color: var(--accent);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.8rem, 3.4vw, 3.4rem);
  line-height: 0.96;
  letter-spacing: -0.04em;
  max-width: 20ch;
}

.lede {
  margin-top: 12px;
  max-width: 60ch;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.5;
}

.hero-metrics {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(0, 1.3fr);
  gap: 10px;
}

.metric {
  padding: 13px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.metric-project {
  padding: 14px 16px;
}

.metric-project strong {
  display: block;
  margin-bottom: 10px;
}

.project-kv {
  display: grid;
  gap: 10px;
  margin: 0;
}

.project-kv div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
}

.project-kv dt {
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.2;
  padding-top: 2px;
}

.project-kv dd {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
  text-align: left;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.metric-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.metric strong {
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(270px, 0.48fr) minmax(0, 1.52fr);
  gap: 16px;
  margin-top: 16px;
  flex: 1 1 auto;
  min-height: 0;
}

.panel {
  border-radius: 26px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.sidebar,
.detail {
  padding: 16px;
}

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

.ghost-button {
  border: 1px solid rgba(125, 211, 252, 0.26);
  background: rgba(125, 211, 252, 0.08);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
}

.ghost-button[data-active="true"] {
  border-color: rgba(52, 211, 153, 0.36);
  background: rgba(52, 211, 153, 0.12);
}

.search {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.search span {
  font-size: 0.78rem;
  color: var(--muted);
}

.search input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
}

.conversation-list {
  display: grid;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding-right: 2px;
}

.conversation-item {
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  padding: 12px;
  color: inherit;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.conversation-item:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(125, 211, 252, 0.2);
}

.conversation-item[data-selected="true"] {
  border-color: rgba(125, 211, 252, 0.42);
  background: linear-gradient(
    180deg,
    rgba(125, 211, 252, 0.12),
    rgba(255, 255, 255, 0.04)
  );
}

.conversation-item-top,
.conversation-stats,
.timeline-row,
.nudge-head,
.detail-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.conversation-id {
  font-size: 0.96rem;
}

.conversation-preview {
  margin-top: 8px;
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.detail {
  display: grid;
  gap: 12px;
  min-height: 0;
}

.nudges-panel {
  padding: 16px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.detail-header {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  min-height: 0;
  flex: 1 1 auto;
}

.timeline-wrap,
.nudge-wrap {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.timeline-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.timeline,
.nudge-list {
  display: grid;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding-right: 2px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 10px;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  margin-top: 10px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(125, 211, 252, 0.08);
}

.timeline-body {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 18px;
  padding: 14px;
}

.timeline-type {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
}

.timeline-time {
  font-size: 0.8rem;
}

.timeline-text {
  margin-top: 10px;
  font-size: 0.96rem;
  line-height: 1.55;
}

.timeline-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.75rem;
}

.nudge-card {
  border: 1px solid rgba(245, 158, 11, 0.18);
  background:
    radial-gradient(
      circle at top right,
      rgba(245, 158, 11, 0.08),
      transparent 48%
    ),
    linear-gradient(180deg, rgba(255, 249, 235, 0.08), rgba(255, 255, 255, 0.03));
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 18px 40px rgba(245, 158, 11, 0.04);
}

.nudge-card[data-state="draft"] {
  border-style: dashed;
  background:
    radial-gradient(
      circle at top right,
      rgba(255, 196, 92, 0.12),
      transparent 48%
    ),
    linear-gradient(180deg, rgba(255, 250, 241, 0.16), rgba(255, 255, 255, 0.05));
  opacity: 0.96;
}

.nudge-heading,
.nudge-type {
  font-size: 1rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.nudge-category,
.nudge-type {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
}

.nudge-points {
  margin: 12px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
}

.nudge-points li {
  line-height: 1.55;
  color: var(--text);
  overflow-wrap: anywhere;
}

.nudge-points strong {
  color: #9f5f00;
  font-weight: 700;
}

.nudge-points li::marker {
  color: var(--accent-2);
}

.nudge-text {
  margin-top: 10px;
  font-size: 0.98rem;
  line-height: 1.6;
}

.nudge-meta {
  margin-top: 10px;
  font-size: 0.82rem;
}

.nudge-card[data-state="draft"] .nudge-meta {
  color: #c88d13;
}

.nudge-wrap {
  border-radius: 22px;
  background:
    radial-gradient(circle at top, rgba(245, 158, 11, 0.08), transparent 55%),
    linear-gradient(180deg, rgba(255, 249, 235, 0.05), rgba(255, 255, 255, 0.02));
}

.nudge-wrap .timeline-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-bottom: 8px;
  background: linear-gradient(
    180deg,
    rgba(255, 249, 235, 0.96),
    rgba(255, 249, 235, 0.72)
  );
  backdrop-filter: blur(10px);
}

.nudge-wrap .timeline-head h3 {
  color: #ffcf7a;
}

.nudge-wrap .muted {
  color: #d4c3a1;
}

.nudge-wrap .nudge-list {
  padding-top: 2px;
  max-height: none;
  height: 100%;
  scrollbar-gutter: stable;
}

.nudge-wrap .nudge-list .nudge-card {
  min-width: 0;
}

.empty-state {
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

.status-live {
  color: var(--good);
}

.status-idle {
  color: var(--muted);
}

.status-warn {
  color: var(--warn);
}

@media (max-width: 1120px) {
  .hero,
  .dashboard,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: auto;
  }

  body {
    overflow: auto;
  }

  .shell {
    height: auto;
    min-height: 100vh;
  }
}

@media (max-height: 860px) and (min-width: 1121px) {
  .shell {
    padding-top: 14px;
    padding-bottom: 18px;
  }

  .hero {
    padding: 16px 20px;
  }

  .eyebrow {
    margin-bottom: 6px;
  }

  h1 {
    font-size: clamp(1.6rem, 3vw, 3rem);
  }

  .lede {
    margin-top: 10px;
    font-size: 0.92rem;
    line-height: 1.45;
  }

  .metric {
    padding: 11px 12px;
  }

  .sidebar,
  .detail {
    padding: 14px;
  }

  .dashboard {
    margin-top: 12px;
    gap: 14px;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 20px, 1440px);
    padding-top: 10px;
  }

  .hero,
  .sidebar,
  .detail {
    padding: 16px;
    border-radius: 22px;
  }

  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .panel-header,
  .timeline-head {
    flex-direction: column;
    align-items: start;
  }

  .timeline,
  .nudge-list,
  .conversation-list {
    max-height: none;
  }
}

.nudge-points a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(15, 122, 216, 0.35);
}

.nudge-points code {
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(15, 122, 216, 0.08);
  color: #0d4f8b;
  font-size: 0.92em;
}

body[data-theme="dark"] .nudge-points strong {
  color: #ffcf7a;
}
