:root {
  --bg: #f4efe7;
  --panel: #fffaf4;
  --line: #e8dccb;
  --text: #2f2419;
  --muted: #7e6b5a;
  --accent: #b65f38;
  --accent-deep: #8d4526;
  --chip: #f2e3d5;
  --ok: #215f45;
  --shadow: 0 20px 50px rgba(74, 43, 22, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(182, 95, 56, 0.10), transparent 28%),
    linear-gradient(180deg, #f8f2eb, var(--bg));
  color: var(--text);
}

.page-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 20px 72px;
}

.hero-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 28px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.hero-card h1,
.panel h2,
.panel h3 {
  margin: 0;
}

.hero-copy,
.panel-header p,
.eyebrow,
th,
td,
label span {
  color: var(--muted);
}

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

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-icon {
  width: 72px;
  height: 72px;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand-logo {
  width: min(320px, 34vw);
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 16px 28px rgba(74, 43, 22, 0.10));
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 700;
}

.panel {
  padding: 24px;
}

.panel-header {
  margin-bottom: 20px;
}

.stack {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
}

input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font: inherit;
}

button {
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: var(--accent);
  color: white;
}

button:hover {
  background: var(--accent-deep);
}

button.secondary {
  background: var(--chip);
  color: var(--text);
}

.toolbar,
.users-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 24px;
  margin-top: 24px;
}

.admin-menu {
  display: grid;
  gap: 10px;
  align-content: start;
}

.menu-item {
  text-align: left;
  background: white;
  color: var(--text);
  border: 1px solid var(--line);
}

.menu-item.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.admin-content {
  min-width: 0;
}

.content-section {
  background: white;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
}

.section-intro {
  margin-bottom: 16px;
}

.section-intro p {
  margin: 8px 0 0;
  color: var(--muted);
}

.session-heading {
  display: flex;
  align-items: center;
  gap: 14px;
}

.session-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex: 0 0 auto;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 24px 0 28px;
}

.stat-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
}

.stat-card.clickable {
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.stat-card.clickable:hover {
  transform: translateY(-2px);
  border-color: rgba(182, 95, 56, 0.45);
  box-shadow: 0 14px 28px rgba(74, 43, 22, 0.08);
}

.stat-card strong {
  display: block;
  font-size: 34px;
  color: var(--accent-deep);
  margin-top: 4px;
}

.section-note {
  margin: 0;
  color: var(--muted);
}

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

.activity-grid {
  display: grid;
  gap: 24px;
}

.activity-grid h4 {
  margin: 0 0 12px;
}

.invite-form {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: end;
  margin-bottom: 24px;
}

.invite-link-cell {
  display: grid;
  gap: 8px;
  min-width: 260px;
}

.invite-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.invite-link-cell a {
  color: var(--accent-deep);
  text-decoration: none;
  word-break: break-all;
}

.usage-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

button.compact {
  padding: 10px 12px;
  width: fit-content;
}

.metric-dialog {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(920px, calc(100vw - 32px));
  width: 100%;
}

.metric-dialog::backdrop {
  background: rgba(35, 22, 13, 0.35);
  backdrop-filter: blur(4px);
}

.metric-dialog-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.metric-dialog-header,
.metric-dialog-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.metric-dialog-controls {
  margin-top: 16px;
}

.metric-dialog select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font: inherit;
}

.metric-chart-wrap {
  margin-top: 20px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  min-height: 320px;
}

.metric-chart-empty {
  margin-top: 20px;
  color: var(--muted);
}

.metric-chart-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
}

.metric-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.metric-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--chip);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 840px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }
}

.badge.ok {
  background: rgba(33, 95, 69, 0.12);
  color: var(--ok);
}

.error {
  color: #a12626;
  margin-top: 16px;
}

code {
  background: #f4eadf;
  padding: 2px 6px;
  border-radius: 6px;
}

@media (max-width: 640px) {
  .page-shell {
    padding: 24px 16px 48px;
  }

  .admin-layout,
  .hero-card,
  .toolbar,
  .users-header {
    align-items: stretch;
    flex-direction: column;
  }

  .brand-lockup,
  .session-heading {
    align-items: flex-start;
  }

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

  .brand-logo {
    width: min(260px, 100%);
  }
}
