:root {
  --ink: #152018;
  --muted: #5c6b60;
  --line: rgba(21, 32, 24, 0.12);
  --accent: #1f6b4a;
  --accent-soft: #d8efe4;
  --paper: #f3f6f2;
  --panel: rgba(255, 255, 255, 0.72);
  --shadow: 0 24px 60px rgba(21, 32, 24, 0.08);
  --font-sans: "DM Sans", Georgia, sans-serif;
  --font-display: "Instrument Serif", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--paper);
}

body {
  position: relative;
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 12% -10%, #cfe8d8 0%, transparent 60%),
    radial-gradient(700px 420px at 90% 0%, #e7efd8 0%, transparent 55%),
    linear-gradient(180deg, #eef4ee 0%, #f7f8f4 45%, #f1f3ee 100%);
}

.shell {
  width: min(1080px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.brand-mark {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  letter-spacing: -0.03em;
  line-height: 1;
  animation: rise 700ms ease both;
}

.brand-sub {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  animation: rise 700ms ease both;
  animation-delay: 80ms;
}

.hero {
  margin-top: 2.25rem;
  padding: 2rem 2rem 1.75rem;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  animation: rise 800ms ease both;
  animation-delay: 120ms;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
}

.total {
  margin: 0.45rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(4.5rem, 12vw, 7.5rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  color: var(--accent);
}

.meta {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  max-width: 42rem;
}

.actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.4rem;
  flex-wrap: wrap;
}

button {
  appearance: none;
  border: 0;
  background: var(--ink);
  color: #f7faf7;
  font: inherit;
  font-weight: 500;
  padding: 0.75rem 1.15rem;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

button:hover {
  transform: translateY(-1px);
  background: #0f1712;
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.status {
  color: var(--muted);
  font-size: 0.9rem;
}

.history {
  margin-top: 2.5rem;
  animation: rise 850ms ease both;
  animation-delay: 180ms;
}

.calls {
  margin-top: 2rem;
  padding: 1.5rem 1.75rem;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  animation: rise 820ms ease both;
  animation-delay: 150ms;
}

.calls-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: end;
  margin: 0.75rem 0 1.25rem;
}

.calls-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.calls-controls select {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  padding: 0.65rem 0.8rem;
  min-width: 10rem;
}

.calls-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.events-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.event-card {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.event-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 400;
}

.event-card .event-names {
  margin: 0.25rem 0 0.85rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.event-card .pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.event-card .pair .stat-value {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

a.event-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

a.event-card-link:hover {
  border-color: rgba(31, 107, 74, 0.45);
  background: rgba(255, 255, 255, 0.85);
  transform: translateY(-2px);
}

.event-card-cta {
  margin: 0.9rem 0 0;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
}

.call-matrix {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 0.5rem;
}

a.stat.call-stat {
  text-decoration: none;
  color: inherit;
  transition: border-color 160ms ease, transform 160ms ease;
}

a.stat.call-stat:hover {
  border-color: rgba(31, 107, 74, 0.45);
  transform: translateY(-2px);
}

.call-stat .stat-value {
  font-size: clamp(1.4rem, 3vw, 2.1rem);
}

.call-stat-small {
  font-size: clamp(1rem, 2.2vw, 1.35rem) !important;
  line-height: 1.25 !important;
  word-break: break-word;
}

.section-title {
  margin: 1.5rem 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 400;
}

.click-row {
  cursor: pointer;
}

.click-row:hover {
  background: rgba(216, 239, 228, 0.35);
}

.call-table-wrap td code {
  font-size: 0.82rem;
}

@media (max-width: 900px) {
  .call-matrix {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.detail-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.75rem;
}

.back-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  padding: 0.65rem 0;
}

.back-link:hover {
  text-decoration: underline;
}

.detail-controls {
  margin: 0;
}

.detail-panel {
  margin-top: 1.25rem;
  padding: 1.5rem 1.75rem;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.detail-list {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: min(70vh, 820px);
  overflow-y: auto;
  padding-right: 0.25rem;
}

.event-row {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
}

.event-row > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.9rem 1rem;
  display: grid;
  gap: 0.55rem;
}

.event-row > summary::-webkit-details-marker {
  display: none;
}

.event-row[open] > summary {
  border-bottom: 1px solid var(--line);
  background: rgba(216, 239, 228, 0.35);
}

.event-row-main,
.event-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: baseline;
}

.event-row-time,
.event-row-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.event-user {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
}

.event-user .eyebrow {
  letter-spacing: 0.08em;
}

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

.event-row-body {
  padding: 0.85rem 1rem 1rem;
}

.params-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.params-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.params-table th,
.params-table td {
  text-align: left;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--line);
  white-space: normal;
  word-break: break-word;
}

.params-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.stat-value {
  margin: 0.35rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--accent);
}

code {
  font-size: 0.9em;
}

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

.history-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 400;
}

.history-head p {
  margin: 0.4rem 0 1.25rem;
  color: var(--muted);
}

.chart {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  min-height: 140px;
  padding: 1rem 1rem 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.bar {
  flex: 1 1 0;
  min-width: 12px;
  background: linear-gradient(180deg, #2f8f66, #1f6b4a);
  opacity: 0.85;
  transition: height 400ms ease;
}

.bar:hover {
  opacity: 1;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  text-align: left;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

tbody tr:last-child td {
  border-bottom: 0;
}

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

@media (max-width: 640px) {
  .shell {
    width: min(100% - 1.5rem, 1080px);
    padding-top: 1.5rem;
  }

  .hero {
    padding: 1.4rem;
  }
}
