:root {
  --bg: #f3f7f3;
  --panel: #ffffff;
  --panel-soft: #f8faf8;
  --text: #132218;
  --muted: #6d7a70;
  --line: #dfe7e1;
  --green: #2f7d4b;
  --green-dark: #1f5e37;
  --mint: #79c997;
  --shadow: 0 12px 34px rgba(26, 54, 36, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(121, 201, 151, 0.16), transparent 34rem),
    var(--bg);
}

button, input { font: inherit; }
button { cursor: pointer; }

.hidden { display: none !important; }

.shell {
  width: min(1440px, calc(100% - 36px));
  margin: 0 auto;
  padding: 30px 0 56px;
}

.login-wrap {
  min-height: calc(100vh - 86px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(430px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -0.06em;
  box-shadow: 0 8px 20px rgba(47, 125, 75, 0.22);
}

.brand-mark.small {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  font-size: 22px;
}

.eyebrow, .section-kicker {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.13em;
  color: var(--green);
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(28px, 4vw, 38px); letter-spacing: -0.04em; }
h2 { margin-bottom: 0; font-size: 20px; letter-spacing: -0.025em; }
.muted { color: var(--muted); }
.small-text { font-size: 13px; }

form { display: grid; gap: 16px; margin-top: 26px; }
label { display: grid; gap: 8px; color: #334239; font-size: 14px; font-weight: 700; }
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px 14px;
  color: var(--text);
  outline: none;
}
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(47, 125, 75, 0.12); }

.primary, .ghost, .range-btn {
  border: 0;
  border-radius: 11px;
  transition: 150ms ease;
}
.primary {
  padding: 13px 16px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
}
.primary:hover { background: var(--green-dark); }
button:disabled { cursor: wait; opacity: 0.6; }

.error, .access-error {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff1f1;
  border: 1px solid #f2caca;
  color: #8b3030;
  font-size: 14px;
}

.access-error { margin: 24px 0; }

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.brand-row { display: flex; gap: 14px; align-items: center; }
.brand-row h1 { margin-bottom: 0; }
.topbar > div > .muted { margin: 10px 0 0 56px; }

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ghost, .range-btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.82);
  color: #34443a;
  padding: 10px 13px;
  font-weight: 750;
}
.ghost:hover, .range-btn:hover { border-color: #b8cbbd; background: #fff; }

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  background: #e8f5ec;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 800;
}
.live-pill span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #41a766;
  box-shadow: 0 0 0 4px rgba(65, 167, 102, 0.12);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
}

.range-group {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 13px;
  background: #e8eee9;
}
.range-btn { padding: 8px 11px; border-color: transparent; background: transparent; }
.range-btn.active { background: #fff; border-color: var(--line); box-shadow: 0 2px 8px rgba(28, 54, 37, 0.06); }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric-card, .panel {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.94);
  box-shadow: var(--shadow);
}

.metric-card {
  border-radius: 17px;
  padding: 18px;
}
.metric-card p { margin: 0 0 9px; color: var(--muted); font-size: 13px; font-weight: 700; }
.metric-card strong { display: block; font-size: 28px; line-height: 1; letter-spacing: -0.04em; }
.metric-card span { display: block; margin-top: 9px; color: var(--muted); font-size: 12px; }

.panel {
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 18px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.chart-panel { overflow: hidden; }
#activityChart { width: 100%; max-width: 100%; display: block; }

.legend { display: flex; gap: 15px; color: var(--muted); font-size: 12px; }
.legend span { display: inline-flex; gap: 7px; align-items: center; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.legend-events { background: var(--green); }
.legend-signups { background: var(--mint); border-radius: 50% !important; }
.legend-visitors { width: 15px !important; height: 3px !important; background: var(--green-dark); border-radius: 999px !important; }

.split-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
}

.breakdown-list, .totals-list { display: grid; gap: 14px; }
.break-row { display: grid; gap: 7px; }
.break-label, .stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 14px;
}
.break-label span, .stat-row span { color: #425147; }
.break-label strong, .stat-row strong { font-size: 15px; }
.break-track { height: 8px; overflow: hidden; border-radius: 999px; background: #edf2ee; }
.break-track > div { height: 100%; border-radius: inherit; background: var(--green); }

.stat-row {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.stat-row:last-child { border-bottom: 0; padding-bottom: 0; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
tbody tr:last-child td { border-bottom: 0; }
.event-pill {
  display: inline-flex;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  font-weight: 700;
  color: #3d4b42;
}

@media (max-width: 1120px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .shell { width: min(100% - 22px, 1440px); padding-top: 18px; }
  .topbar, .toolbar { align-items: stretch; flex-direction: column; }
  .top-actions { justify-content: flex-start; }
  .topbar > div > .muted { margin-left: 0; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-grid { grid-template-columns: 1fr; }
  .panel-head { flex-direction: column; }
}
@media (max-width: 440px) {
  .metric-grid { grid-template-columns: 1fr; }
  .login-card { padding: 24px; }
}


.success {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #edf8f0;
  border: 1px solid #c7e8d0;
  color: var(--green-dark);
  font-size: 14px;
}

dialog {
  width: min(470px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: transparent;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(15, 30, 20, 0.36);
  backdrop-filter: blur(3px);
}

.dialog-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  padding: 24px;
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.dialog-head h2 { margin-bottom: 0; }
.dialog-actions { justify-content: flex-end; margin-top: 4px; }

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}

.icon-button:hover {
  color: var(--text);
  border-color: #b8cbbd;
}

@media (max-width: 520px) {
  .dialog-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .dialog-actions button {
    width: 100%;
  }
}
