:root {
  color-scheme: light;
  --bg: #e9e0cf;
  --bg-deep: #d9ccb8;
  --surface: rgba(255, 251, 242, 0.9);
  --surface-solid: #fffaf0;
  --surface-alt: rgba(93, 61, 48, 0.07);
  --line: rgba(91, 53, 43, 0.18);
  --text: #3e2a22;
  --muted: #76685e;
  --brown: #5b352b;
  --green: #4f6d4b;
  --green-soft: #e3ebdb;
  --blue: #53736b;
  --blue-soft: #e0ebe6;
  --amber: #a36a3d;
  --amber-soft: #f4e1c8;
  --red: #9d5145;
  --red-soft: #f0d6cd;
  --violet: #6e5a6f;
  --violet-soft: #eadde7;
  --gold: #b48a4a;
  --geometry: rgba(91, 53, 43, 0.12);
  --shadow: 0 22px 54px rgba(62, 42, 34, 0.13);
  --numeric-font: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.48), rgba(217, 204, 184, 0.52)),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  position: relative;
}

.geometry-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.34;
  background-image:
    radial-gradient(circle at center, transparent 0 34px, var(--geometry) 35px, transparent 36px),
    radial-gradient(circle at center, transparent 0 34px, rgba(79, 109, 75, 0.1) 35px, transparent 36px),
    linear-gradient(30deg, rgba(91, 53, 43, 0.1) 1px, transparent 1px),
    linear-gradient(150deg, rgba(91, 53, 43, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(180, 138, 74, 0.07) 1px, transparent 1px);
  background-position: 0 0, 52px 30px, 0 0, 0 0, 0 0;
  background-size: 104px 60px, 104px 60px, 72px 124px, 72px 124px, 72px 72px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.86), transparent 74%);
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.topbar,
.panel-heading,
.topbar-actions,
.kpi,
.status-banner,
.activity-item,
.funnel-row {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-mark {
  width: 246px;
  max-width: 42vw;
  height: auto;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brown);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 32px;
  line-height: 1.15;
  font-weight: 600;
}

h2 {
  font-size: 17px;
  line-height: 1.25;
}

.panel-heading p,
.kpi small,
.timestamp,
.status-banner span,
.activity-meta {
  color: var(--muted);
}

.timestamp,
.kpi small,
.pill,
.status-banner strong,
.status-banner span,
.activity-copy strong,
.activity-meta {
  font-family: var(--numeric-font);
  font-variant-numeric: tabular-nums;
}

.topbar-actions {
  gap: 10px;
}

.timestamp {
  font-size: 13px;
  white-space: nowrap;
  color: var(--brown);
}

.icon-button,
.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.74);
  color: var(--text);
  box-shadow: none;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.icon-link {
  text-decoration: none;
}

.icon-button:hover,
.icon-link:hover {
  border-color: #a9b5ae;
}

.icon-button svg,
.icon-link svg,
.kpi-icon svg,
.activity-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.status-banner {
  justify-content: flex-start;
  gap: 12px;
  min-height: 58px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(62, 42, 34, 0.08);
}

.status-banner strong,
.status-banner span {
  display: block;
  font-size: 14px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(91, 53, 43, 0.26);
  background: var(--gold);
}

.status-banner.loading .status-dot {
  background: var(--blue);
}

.status-banner.warning .status-dot {
  background: var(--amber);
}

.status-banner.alert .status-dot {
  background: var(--red);
}

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

.kpi {
  position: relative;
  min-height: 118px;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  overflow: hidden;
}

.kpi > * {
  position: relative;
  z-index: 1;
}

.kpi-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
  flex: 1;
  align-content: center;
}

.kpi span,
.kpi small {
  display: block;
  font-size: 13px;
  line-height: 1.25;
}

.kpi strong {
  display: block;
  margin: 3px 0 2px;
  color: var(--brown);
  font-family: var(--numeric-font);
  font-size: 36px;
  font-weight: 800;
  line-height: 1.02;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.kpi-icon,
.activity-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex: 0 0 auto;
  border: 1px solid rgba(91, 53, 43, 0.12);
  box-shadow: inset 0 0 0 5px rgba(255, 250, 240, 0.54);
}

.kpi-icon.success,
.activity-icon.success {
  color: var(--green);
  background: var(--green-soft);
}

.kpi-icon.info,
.activity-icon.info {
  color: var(--blue);
  background: var(--blue-soft);
}

.kpi-icon.warning,
.activity-icon.warning {
  color: var(--amber);
  background: var(--amber-soft);
}

.kpi-icon.alert,
.activity-icon.alert {
  color: var(--red);
  background: var(--red-soft);
}

.kpi-icon.violet,
.activity-icon.violet {
  color: var(--violet);
  background: var(--violet-soft);
}

.main-grid,
.lower-grid {
  display: grid;
  gap: 14px;
}

.main-grid {
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.8fr);
  margin-bottom: 14px;
}

.lower-grid {
  grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.15fr);
}

.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.panel-heading {
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 0;
}

.panel-heading.compact {
  padding-bottom: 14px;
}

.panel-heading p {
  margin-top: 4px;
  font-size: 13px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(91, 53, 43, 0.12);
  background: rgba(227, 235, 219, 0.78);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pill.quiet {
  color: var(--muted);
  background: var(--surface-alt);
}

.chart-wrap {
  height: 390px;
  padding: 10px 20px 18px;
}

#gscrChart {
  width: 100%;
  height: 100%;
}

.activity-list {
  display: grid;
  gap: 10px;
  padding: 18px 20px 20px;
}

.activity-item {
  gap: 12px;
  min-height: 62px;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-alt);
  border: 1px solid rgba(91, 53, 43, 0.08);
}

.activity-copy {
  min-width: 0;
}

.activity-copy strong,
.activity-copy span {
  display: block;
  overflow-wrap: anywhere;
}

.activity-copy strong {
  font-size: 14px;
}

.activity-meta {
  margin-top: 2px;
  font-size: 12px;
}

.funnel {
  display: grid;
  gap: 12px;
  padding: 0 20px 20px;
}

.funnel-row {
  display: grid;
  grid-template-columns: 110px 1fr 74px;
  gap: 12px;
  align-items: center;
}

.funnel-label,
.funnel-value {
  font-size: 13px;
  font-weight: 700;
}

.funnel-value {
  font-family: var(--numeric-font);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.funnel-track {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(91, 53, 43, 0.08);
}

.funnel-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.table-wrap {
  max-height: 310px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

td {
  font-family: var(--numeric-font);
}

td:first-child {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-solid);
  color: var(--muted);
  font-weight: 700;
}

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

@media (max-width: 980px) {
  .shell {
    padding: 18px;
  }

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

  .kpi-grid,
  .main-grid,
  .lower-grid {
    grid-template-columns: 1fr;
  }

  .chart-wrap {
    height: 320px;
  }
}

@media (max-width: 620px) {
  h1 {
    font-size: 24px;
  }

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

  .timestamp {
    max-width: 190px;
    white-space: normal;
  }

  .kpi {
    min-height: 96px;
    align-items: flex-start;
  }

  .funnel-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .funnel-value {
    text-align: left;
  }
}
