:root {
  color-scheme: light;
  --canvas: #F4F1FA;
  --text: #332F3A;
  --muted: #635F69;
  --violet: #7C3AED;
  --violet-soft: rgba(124, 58, 237, .12);
  --pink: #DB2777;
  --pink-soft: rgba(219, 39, 119, .12);
  --sky: #0EA5E9;
  --sky-soft: rgba(14, 165, 233, .13);
  --emerald: #10B981;
  --emerald-soft: rgba(16, 185, 129, .13);
  --amber: #F59E0B;
  --amber-soft: rgba(245, 158, 11, .16);
  --white-glass: rgba(255, 255, 255, .72);
  --white-glass-strong: rgba(255, 255, 255, .84);
  --line: rgba(99, 95, 105, .14);
  --line-strong: rgba(124, 58, 237, .22);
  --input-bg: #EFEBF5;
  --display: "Nunito", ui-rounded, system-ui, sans-serif;
  --body: "DM Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.clay-surface {
  box-shadow: 30px 30px 60px #cdc6d9, -30px -30px 60px #ffffff, inset 10px 10px 20px rgba(139,92,246,.05), inset -10px -10px 20px rgba(255,255,255,.8);
}

.clay-card {
  box-shadow: 16px 16px 32px rgba(160,150,180,.2), -10px -10px 24px rgba(255,255,255,.9), inset 6px 6px 12px rgba(139,92,246,.03), inset -6px -6px 12px rgba(255,255,255,1);
}

.clay-button {
  box-shadow: 12px 12px 24px rgba(139,92,246,.3), -8px -8px 16px rgba(255,255,255,.4), inset 4px 4px 8px rgba(255,255,255,.4), inset -4px -4px 8px rgba(0,0,0,.1);
}

.clay-pressed {
  box-shadow: inset 10px 10px 20px #d9d4e3, inset -10px -10px 20px #ffffff;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.625;
  letter-spacing: 0;
  overflow-x: hidden;
}

.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: fixed;
  width: 60vh;
  height: 60vh;
  border-radius: 9999px;
  filter: blur(64px);
  opacity: 1;
  animation: blob-float 10s ease-in-out infinite alternate;
}

.blob-violet {
  top: -18vh;
  left: -12vh;
  background: rgba(124, 58, 237, .10);
  animation-duration: 9s;
}

.blob-pink {
  top: 14vh;
  right: -20vh;
  background: rgba(219, 39, 119, .10);
  animation-duration: 12s;
  animation-delay: -2s;
}

.blob-sky {
  right: 14vw;
  bottom: -24vh;
  background: rgba(14, 165, 233, .10);
  animation-duration: 11s;
  animation-delay: -4s;
}

.blob-emerald {
  left: 20vw;
  bottom: -26vh;
  background: rgba(16, 185, 129, .10);
  animation-duration: 8s;
  animation-delay: -1s;
}

@keyframes blob-float {
  from {
    transform: translateY(0) rotate(0deg);
  }

  to {
    transform: translateY(-34px) rotate(16deg);
  }
}

body > header,
body > main {
  position: relative;
  z-index: 1;
}

button,
select {
  font: inherit;
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 20px;
  background: linear-gradient(to bottom right, #A78BFA, #7C3AED);
  color: #ffffff;
  padding: 0 18px;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 200ms ease, box-shadow 200ms ease;
  box-shadow: 12px 12px 24px rgba(139,92,246,.3), -8px -8px 16px rgba(255,255,255,.4), inset 4px 4px 8px rgba(255,255,255,.4), inset -4px -4px 8px rgba(0,0,0,.1);
}

button:hover {
  transform: translateY(-4px);
  box-shadow: 18px 18px 32px rgba(139,92,246,.34), -10px -10px 18px rgba(255,255,255,.5), inset 4px 4px 8px rgba(255,255,255,.4), inset -4px -4px 8px rgba(0,0,0,.1);
}

button:active {
  transform: scale(.92);
  box-shadow: inset 10px 10px 20px #d9d4e3, inset -10px -10px 20px #ffffff;
}

button:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(124, 58, 237, .28);
  outline-offset: 4px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  width: min(1540px, calc(100% - 56px));
  margin: 0 auto;
  padding: 42px 0 22px;
}

.topbar > div:first-child {
  max-width: 850px;
}

.topbar-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 14px;
  min-width: 340px;
}

.auth-area {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.lock-hint {
  max-width: 410px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  text-align: right;
}

.google-signin {
  min-width: 190px;
}

.signed-in {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--violet);
  font-family: var(--display);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .12em;
  line-height: 1.2;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 900px;
  font-family: var(--display);
  font-size: clamp(48px, 6vw, 96px);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0;
  background: linear-gradient(110deg, #332F3A 20%, #7C3AED 60%, #DB2777);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

h2 {
  color: var(--text);
  font-family: var(--display);
  font-size: clamp(30px, 3vw, 42px);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: 0;
}

.status-pill {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 9999px;
  background: rgba(255, 255, 255, .72);
  color: var(--amber);
  padding: 0 18px;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .04em;
  white-space: nowrap;
  box-shadow: 16px 16px 32px rgba(160,150,180,.2), -10px -10px 24px rgba(255,255,255,.9), inset 6px 6px 12px rgba(139,92,246,.03), inset -6px -6px 12px rgba(255,255,255,1);
}

.status-pill.ready {
  color: var(--emerald);
}

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

main {
  width: min(1540px, calc(100% - 56px));
  margin: 0 auto;
  padding: 16px 0 56px;
}

.counter-grid {
  display: grid;
  grid-template-columns: 1.28fr repeat(2, .9fr) repeat(3, .78fr);
  gap: 22px;
  margin-bottom: 24px;
}

.counter-grid > div {
  position: relative;
  min-height: 188px;
  border-radius: 32px;
  background: rgba(255, 255, 255, .76);
  padding: 26px;
  overflow: hidden;
  transition: transform 500ms ease, box-shadow 500ms ease;
  backdrop-filter: blur(24px);
  box-shadow: 16px 16px 32px rgba(160,150,180,.2), -10px -10px 24px rgba(255,255,255,.9), inset 6px 6px 12px rgba(139,92,246,.03), inset -6px -6px 12px rgba(255,255,255,1);
}

.counter-grid > div:first-child {
  grid-column: span 2;
  min-height: 226px;
  border-radius: 48px;
  box-shadow: 30px 30px 60px #cdc6d9, -30px -30px 60px #ffffff, inset 10px 10px 20px rgba(139,92,246,.05), inset -10px -10px 20px rgba(255,255,255,.8);
}

.counter-grid > div:hover,
.cost-strip > div:hover,
.panel:hover {
  transform: translateY(-8px);
  box-shadow: 24px 24px 44px rgba(160,150,180,.25), -14px -14px 30px rgba(255,255,255,.95), inset 6px 6px 12px rgba(139,92,246,.03), inset -6px -6px 12px rgba(255,255,255,1);
}

.counter-grid span,
.cost-strip span {
  display: block;
  color: var(--muted);
  font-family: var(--display);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .12em;
  line-height: 1.2;
  text-transform: uppercase;
}

.counter-grid strong {
  display: block;
  margin-top: 24px;
  color: var(--text);
  font-family: var(--display);
  font-size: clamp(48px, 6vw, 96px);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  line-height: .9;
}

.counter-grid > div:first-child strong {
  color: var(--violet);
  font-size: clamp(68px, 8vw, 128px);
}

.cost-strip {
  display: grid;
  grid-template-columns: 1.1fr 1fr .78fr;
  gap: 22px;
  margin-bottom: 30px;
}

.cost-strip > div {
  min-height: 112px;
  border-radius: 32px;
  background: rgba(255, 255, 255, .68);
  padding: 24px 26px;
  transition: transform 500ms ease, box-shadow 500ms ease;
  backdrop-filter: blur(24px);
  box-shadow: 16px 16px 32px rgba(160,150,180,.2), -10px -10px 24px rgba(255,255,255,.9), inset 6px 6px 12px rgba(139,92,246,.03), inset -6px -6px 12px rgba(255,255,255,1);
}

.cost-strip strong {
  display: block;
  margin-top: 10px;
  color: var(--violet);
  font-family: var(--display);
  font-size: clamp(24px, 3vw, 42px);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

#failed-count {
  color: var(--pink);
}

.chart-grid {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.18fr);
  gap: 24px;
  margin-bottom: 28px;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(420px, .82fr);
  grid-template-areas:
    "feed trace"
    "feed accuracy";
  gap: 24px;
}

.feed-panel {
  grid-area: feed;
}

.trace-panel {
  grid-area: trace;
}

.accuracy-panel {
  grid-area: accuracy;
}

.panel {
  min-width: 0;
  overflow: hidden;
  border-radius: 48px;
  background: rgba(255, 255, 255, .72);
  transition: transform 500ms ease, box-shadow 500ms ease;
  backdrop-filter: blur(24px);
  box-shadow: 30px 30px 60px #cdc6d9, -30px -30px 60px #ffffff, inset 10px 10px 20px rgba(139,92,246,.05), inset -10px -10px 20px rgba(255,255,255,.8);
}

.feed-panel {
  border-radius: 60px;
}

.panel-head {
  min-height: 108px;
  padding: 30px 34px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.select-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-family: var(--display);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}

select {
  max-width: 260px;
  min-height: 48px;
  border: 0;
  border-radius: 20px;
  background: var(--input-bg);
  color: var(--text);
  padding: 0 38px 0 14px;
  font-family: var(--body);
  font-size: 15px;
  font-weight: 700;
  box-shadow: inset 10px 10px 20px #d9d4e3, inset -10px -10px 20px #ffffff;
}

select:focus {
  background: #ffffff;
}

select:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

.table-wrap {
  width: calc(100% - 40px);
  margin: 0 20px 20px;
  overflow-x: auto;
  border-radius: 32px;
  background: rgba(255, 255, 255, .68);
  box-shadow: inset 6px 6px 12px rgba(139,92,246,.03), inset -6px -6px 12px rgba(255,255,255,1);
}

.table-wrap::-webkit-scrollbar {
  height: 12px;
}

.table-wrap::-webkit-scrollbar-track {
  background: rgba(239, 235, 245, .8);
  border-radius: 9999px;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: var(--violet);
  border-radius: 9999px;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
}

.feed-panel table {
  min-width: 1120px;
}

th,
td {
  padding: 16px 15px;
  border-bottom: 1px solid rgba(99, 95, 105, .12);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
  line-height: 1.45;
}

th {
  color: var(--muted);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

td {
  color: var(--text);
  word-break: break-word;
}

tbody tr:hover td {
  background: rgba(124, 58, 237, .05);
}

.feed-panel th:nth-child(1),
.trace-panel th:nth-child(1) {
  width: 86px;
}

.feed-panel th:nth-child(2),
.trace-panel th:nth-child(2) {
  width: 108px;
}

.feed-panel th:nth-child(3),
.trace-panel th:nth-child(3) {
  width: 178px;
}

.feed-panel th:nth-child(4) {
  width: 190px;
}

.feed-panel th:nth-child(7),
.trace-panel th:nth-child(4) {
  width: 132px;
}

.feed-panel th:nth-child(8),
.trace-panel th:nth-child(6) {
  width: 118px;
}

.trace-panel th:nth-child(5),
.trace-panel th:nth-child(7) {
  width: 110px;
}

.muted,
td:nth-child(1),
td:nth-child(8),
.trace-panel td:nth-child(5),
.trace-panel td:nth-child(6),
.trace-panel td:nth-child(7) {
  color: var(--muted);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.empty-row {
  height: 108px;
  color: var(--muted);
  text-align: center;
}

.badge {
  display: inline-flex;
  max-width: 100%;
  min-height: 32px;
  align-items: center;
  border: 0;
  border-radius: 9999px;
  background: var(--violet-soft);
  color: var(--violet);
  padding: 6px 12px;
  font-family: var(--display);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.15;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.badge.decision-archive {
  background: var(--emerald-soft);
  color: var(--emerald);
}

.badge.decision-unsub,
.badge.decision-unsubscribe,
.badge.decision-unsubscribe-and-archive {
  background: var(--sky-soft);
  color: var(--sky);
}

.badge.decision-needs-human {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.decision-reply-worthy {
  background: var(--violet-soft);
  color: var(--violet);
}

.badge.decision-quarantine {
  background: var(--pink-soft);
  color: var(--pink);
}

.badge.status-done {
  background: var(--emerald-soft);
  color: var(--emerald);
}

.badge.status-failed,
.badge.status-rejected {
  background: var(--pink-soft);
  color: var(--pink);
}

.badge.status-pending,
.badge.status-pending-action,
.badge.status-awaiting,
.badge.status-awaiting-approval {
  background: var(--amber-soft);
  color: var(--amber);
}

.run-summary {
  min-height: 96px;
  margin: 0 20px 20px;
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  border-radius: 32px;
  background: rgba(255, 255, 255, .68);
  box-shadow: inset 6px 6px 12px rgba(139,92,246,.03), inset -6px -6px 12px rgba(255,255,255,1);
}

.summary-item {
  min-width: 0;
}

.summary-item span {
  display: block;
  color: var(--muted);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.summary-item strong {
  display: block;
  margin-top: 7px;
  color: var(--text);
  font-family: var(--display);
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  line-height: 1;
  overflow-wrap: anywhere;
}

.feed-footer {
  min-height: 78px;
  margin: 0 20px 24px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-radius: 32px;
  background: rgba(255, 255, 255, .68);
  box-shadow: inset 6px 6px 12px rgba(139,92,246,.03), inset -6px -6px 12px rgba(255,255,255,1);
}

#feed-count {
  color: var(--muted);
  font-family: var(--display);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.ops-chart {
  display: block;
  width: calc(100% - 40px);
  min-height: 270px;
  margin: 0 20px 24px;
  padding: 20px;
  border-radius: 32px;
  background: rgba(255, 255, 255, .64);
  box-shadow: inset 6px 6px 12px rgba(139,92,246,.03), inset -6px -6px 12px rgba(255,255,255,1);
}

#decision-chart {
  min-height: 308px;
}

.axis {
  stroke: rgba(99, 95, 105, .24);
  stroke-width: 1;
}

.axis-soft {
  stroke: rgba(99, 95, 105, .14);
}

.chart-track {
  fill: rgba(124, 58, 237, .08);
}

.chart-line,
.activity-line {
  fill: none;
  stroke-width: 4;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.accuracy-line,
.activity-line.processed {
  stroke: var(--violet);
}

.activity-line.archived {
  stroke: var(--emerald);
}

.activity-line.escalated {
  stroke: var(--amber);
}

.activity-area {
  opacity: .18;
}

.activity-area.processed {
  fill: var(--violet);
}

.activity-area.archived {
  fill: var(--emerald);
}

.activity-area.escalated {
  fill: var(--amber);
}

.chart-dot,
.activity-dot.processed {
  fill: var(--violet);
}

.activity-dot.archived {
  fill: var(--emerald);
}

.activity-dot.escalated {
  fill: var(--amber);
}

.chart-text {
  fill: var(--muted);
  font-family: var(--display);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.chart-value,
.chart-total {
  fill: var(--text);
  font-weight: 900;
}

.chart-percent {
  fill: var(--muted);
  font-size: 11px;
}

.breakdown-label {
  font-size: 12px;
  font-weight: 900;
}

.breakdown-bar.decision-archive,
.breakdown-label.decision-archive {
  fill: var(--emerald);
}

.breakdown-bar.decision-unsubscribe-and-archive,
.breakdown-label.decision-unsubscribe-and-archive {
  fill: var(--sky);
}

.breakdown-bar.decision-needs-human,
.breakdown-label.decision-needs-human {
  fill: var(--amber);
}

.breakdown-bar.decision-reply-worthy,
.breakdown-label.decision-reply-worthy {
  fill: var(--violet);
}

.breakdown-bar.decision-quarantine,
.breakdown-label.decision-quarantine {
  fill: var(--pink);
}

.activity-legend.processed {
  fill: var(--violet);
}

.activity-legend.archived {
  fill: var(--emerald);
}

.activity-legend.escalated {
  fill: var(--amber);
}

[hidden] {
  display: none !important;
}

@media (max-width: 1180px) {
  .topbar {
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    min-width: 0;
    justify-content: space-between;
  }

  .lock-hint {
    text-align: left;
  }

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

  .counter-grid > div:first-child {
    grid-column: span 3;
  }

  .chart-grid,
  .layout-grid {
    grid-template-columns: 1fr;
  }

  .layout-grid {
    grid-template-areas:
      "feed"
      "trace"
      "accuracy";
  }
}

@media (max-width: 720px) {
  .topbar,
  main {
    width: min(100% - 28px, 1540px);
  }

  .topbar-actions,
  .auth-area,
  .signed-in {
    align-items: stretch;
    flex-direction: column;
  }

  .status-pill {
    width: fit-content;
  }

  .counter-grid,
  .cost-strip,
  .run-summary {
    grid-template-columns: 1fr;
  }

  .counter-grid > div:first-child {
    grid-column: span 1;
  }

  .counter-grid > div,
  .counter-grid > div:first-child,
  .panel,
  .feed-panel {
    border-radius: 32px;
  }

  .panel-head,
  .feed-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .select-label,
  select,
  .feed-footer button {
    width: 100%;
  }

  select {
    max-width: none;
  }

  h1 {
    font-size: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
