:root {
  --bg: #1a1a1a;
  --bg-elevated: #242424;
  --card: #ffffff;
  --ink: #1c1c1c;
  --muted: #5c5c5c;
  --grid: #e8e8e8;
  --approved: #2ecc71;
  --declined: #e74c3c;
  --radius: 14px;
  --font: "DM Sans", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Class display rules must not override the HTML hidden attribute. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 50% -10%, #2a2a2a 0%, var(--bg) 55%);
  color: #f2f2f2;
}

body {
  min-height: 100vh;
}

.auth-gate {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  text-align: center;
}

.auth-gate p {
  margin: 0;
  color: #c8c8c8;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  background: #f5f5f5;
  color: #111;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.btn-primary:hover {
  background: #fff;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2.5rem;
}

.top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1.25rem;
}

.brand {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.top-bar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.date-field {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: #cfcfcf;
}

.date-field input {
  font: inherit;
  border: 1px solid #3a3a3a;
  background: var(--bg-elevated);
  color: #f5f5f5;
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
}

.user-chip {
  font-size: 0.85rem;
  color: #bdbdbd;
}

.btn-ghost {
  font: inherit;
  font-size: 0.85rem;
  color: #ddd;
  background: transparent;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
}

.btn-ghost:hover {
  border-color: #777;
  color: #fff;
}

.chart-card {
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem 1.1rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.chart-card-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.chart-title {
  margin: 0;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  grid-column: 1 / -1;
  padding: 0 2.5rem;
}

.download-btn {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: none;
  background: #111;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-top: -0.15rem;
}

.download-btn:hover {
  background: #333;
}

.download-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.chart-legend {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0.15rem 0 0.5rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  display: inline-block;
}

.swatch-approved {
  background: var(--approved);
}

.swatch-declined {
  background: var(--declined);
}

.chart-status {
  margin: 0.5rem 0 0;
  text-align: center;
  font-size: 0.92rem;
  color: var(--muted);
}

.chart-status.is-error {
  color: #b42318;
}

.chart-wrap {
  position: relative;
  height: min(520px, 70vh);
  margin-top: 0.25rem;
}

@media (max-width: 720px) {
  .chart-title {
    font-size: 1rem;
    padding: 0 0.25rem;
  }

  .chart-card-header {
    display: flex;
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .download-btn {
    align-self: flex-end;
  }

  .chart-legend {
    justify-content: center;
    flex-wrap: wrap;
  }

  .chart-wrap {
    height: 420px;
  }
}
