:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #657386;
  --line: #dfe5ee;
  --accent: #7c5cff;
  --accent-2: #a78bfa;
  --accent-soft: #f2efff;
  --accent-line: #c8bbff;
  --shadow: 0 10px 30px rgba(27, 39, 54, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

button {
  font: inherit;
}

select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: #101820;
  color: #fff;
  padding: 20px 14px;
}

.brand {
  display: grid;
  gap: 4px;
  padding: 6px 6px 18px;
}

.brand span {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
}

.brand strong {
  font-size: 20px;
  letter-spacing: 0;
}

.activity-nav {
  display: grid;
  gap: 8px;
}

.activity-nav button,
.member-controls button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0;
}

.activity-nav button {
  width: 100%;
  background: transparent;
  color: #c8d3df;
  padding: 10px 12px;
  text-align: left;
}

.activity-nav button:hover,
.activity-nav button.active {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.content {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.summary,
.metric,
.activity,
.member-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(22px, 4vw, 34px);
  line-height: 1.18;
}

h2 {
  font-size: 18px;
}

.status {
  flex: 0 0 auto;
  min-width: 92px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.status.ok {
  color: #075d46;
  border-color: #a9dccd;
  background: #edf9f5;
}

.status.error {
  color: #7a200d;
  border-color: #efb8aa;
  background: #fff1ed;
}

.summary-meta {
  flex: 0 0 auto;
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.summary-meta .status {
  justify-self: end;
}

.summary-meta time {
  color: var(--ink);
  font-weight: 800;
}

.member-panel {
  margin-top: 16px;
  border-radius: 8px;
  overflow: hidden;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.section-title.compact {
  padding-bottom: 12px;
}

.section-title span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.sort-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sort-controls select,
.sort-controls button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.sort-controls select {
  padding: 6px 30px 6px 10px;
}

.sort-controls button {
  cursor: pointer;
  padding: 6px 10px;
}

.sort-controls button:hover,
.sort-controls select:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.member-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, max-content));
  gap: 8px;
  padding: 18px 20px;
}

.member-controls button {
  background: #f8fafc;
  color: var(--ink);
  padding: 8px 12px;
  white-space: nowrap;
}

.member-controls button:hover,
.member-controls button.active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.metric {
  min-width: 0;
  border-radius: 8px;
  padding: 20px;
}

.metric-head {
  display: flex;
  align-items: baseline;
}

.metric-head span {
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 16px;
  font-size: clamp(36px, 7vw, 58px);
  line-height: 1;
}

.metric strong .delta {
  font-size: clamp(16px, 3vw, 24px);
}

.total-metric strong {
  color: var(--accent);
}

.delta {
  display: inline-block;
  margin-left: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  vertical-align: middle;
}

.delta.up {
  color: #087f5b;
}

.delta.down {
  color: #b42318;
}

.time-value {
  display: block;
}

.baseline-mark {
  display: block;
  width: max-content;
  max-width: 220px;
  margin-top: 5px;
  border: 1px solid #cdd7e3;
  border-radius: 999px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  white-space: normal;
}

.activity {
  margin-top: 16px;
  border-radius: 8px;
  overflow: hidden;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

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

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

td {
  font-size: 14px;
}

@media (max-width: 860px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 12px;
  }

  .brand {
    padding-bottom: 12px;
  }

  .activity-nav {
    display: flex;
    overflow-x: auto;
  }

  .activity-nav button {
    width: auto;
    flex: 0 0 auto;
  }

  .content {
    width: min(100% - 20px, 1120px);
    padding-top: 12px;
  }

  .summary {
    display: block;
  }

  .summary,
  .member-panel,
  .metric,
  .activity {
    border-radius: 8px;
  }

  .summary {
    padding: 16px;
  }

  h1 {
    font-size: 22px;
  }

  .status {
    width: max-content;
  }

  .summary-meta {
    margin-top: 14px;
    text-align: left;
  }

  .summary-meta .status {
    justify-self: start;
  }

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

  .sort-controls {
    width: 100%;
  }

  .sort-controls select {
    min-width: 0;
    flex: 1 1 auto;
  }

  .sort-controls button {
    flex: 0 0 auto;
  }

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

  .metric {
    padding: 14px 10px;
  }

  .metric-head span {
    font-size: 14px;
  }

  .metric strong {
    font-size: clamp(30px, 10vw, 44px);
  }

  .member-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 14px;
  }

  .member-controls button {
    min-width: 0;
    width: 100%;
    padding: 10px 8px;
    font-size: clamp(15px, 4vw, 18px);
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .member-controls button:first-child {
    grid-column: span 1;
  }
}
