*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  font-size: 14px;
  color: #000000;
  background-color: #ffffff;
}

a {
  color: inherit;
}

.hidden {
  display: none;
}

.muted {
  color: #6b7280;
}

.strong {
  font-weight: 600;
}

.num {
  text-align: right;
}

/* Top bar shared by the list and event pages */

body.app {
  min-width: 700px;
}

/* Sticky rather than fixed: below 700px the bar scrolls sideways with the page, so its links stay reachable. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr minmax(0, auto) 1fr;
  align-items: center;
  column-gap: 24px;
  padding: 16px 32px;
  background-color: #000000;
  color: #ffffff;
}

.topbar-logo {
  justify-self: start;
  display: flex;
}

.topbar-logo img {
  display: block;
  height: 32px;
  width: 80px;
}

.topbar-title {
  min-width: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 32px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.event-picker {
  position: relative;
  display: inline-block;
  max-width: 100%;
  vertical-align: top;
}

.event-select {
  appearance: none;
  display: block;
  max-width: 100%;
  height: 32px;
  margin: 0;
  padding: 0 28px 0 4px;
  font: inherit;
  line-height: 32px;
  color: #ffffff;
  background-color: #000000;
  border: 0;
  border-radius: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.event-select:focus-visible {
  outline: 1px solid #ffffff;
  outline-offset: -1px;
}

.event-select option {
  color: #000000;
  background-color: #ffffff;
}

.event-picker-icon {
  position: absolute;
  top: 8px;
  right: 4px;
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.topbar-nav {
  justify-self: end;
  display: flex;
  gap: 24px;
  white-space: nowrap;
}

.topbar-nav a {
  color: #ffffff;
  text-decoration: none;
  font-weight: 500;
}

.topbar-nav a:hover {
  color: #d1d5db;
}

.content {
  padding: 32px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Cards */

.card {
  border: 1px solid #e5e7eb;
  background-color: #ffffff;
}

.card-header {
  margin: 0;
  padding: 12px 16px;
  background-color: #333333;
  color: #ffffff;
  font-size: 20px;
  font-weight: 600;
}

.card-body {
  padding: 16px 24px 24px;
}

/* Tables */

.stats-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
}

.stats-table th,
.stats-table td {
  padding: 12px 16px;
}

.stats-table th {
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid #d1d5db;
}

.stats-table th:first-child {
  width: 30%;
}

.stats-table th.num {
  text-align: right;
  width: 17.5%;
}

.stats-table tbody tr {
  border-bottom: 1px solid #e5e7eb;
}

.accordion-row {
  cursor: pointer;
}

.accordion-row:hover {
  background-color: #f3f4f6;
}

.row-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.accordion-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.3s;
}

.accordion-icon.expanded {
  transform: rotate(180deg);
}

.stats-table .accordion-content {
  display: none;
  background-color: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

.stats-table .accordion-content.active {
  display: table-row;
}

.stats-table .accordion-content > td {
  padding: 0;
}

.breakdown {
  padding: 16px;
}

.breakdown-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
  font-weight: 500;
}

/* Bars */

.bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.bar-label {
  flex: 0 0 220px;
}

.bar-label.wide {
  flex-basis: 300px;
}

.bar-count {
  flex: 0 0 50px;
  text-align: right;
}

.survey-percentage {
  flex: 0 0 60px;
  text-align: right;
}

.survey-count {
  flex: 0 0 50px;
  text-align: right;
}

.stat-bar {
  flex: 1 1 auto;
  height: 20px;
  background-color: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.stat-bar-fill {
  width: 0;
  height: 100%;
  background-color: #b8c0c6;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.empty-note {
  color: #6b7280;
  font-style: italic;
}

/* Brand survey */

.survey-filters {
  display: flex;
  gap: 24px;
  margin: 8px 0 16px;
}

.survey-filters label {
  cursor: pointer;
}

.survey-question {
  margin-bottom: 24px;
}

.survey-question h3 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
}

.survey-total {
  margin-bottom: 8px;
}

/* Test drive event */

.line {
  display: flex;
  justify-content: space-between;
  margin: 16px 0;
}

/* Event list */

.events-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #e5e7eb;
}

.events-table th {
  padding: 12px 24px;
  text-align: left;
  font-weight: 600;
  background-color: #333333;
  color: #ffffff;
}

.events-table th:first-child {
  width: 260px;
}

.events-table td {
  padding: 12px 24px;
  background-color: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}

.events-table tr.row-link {
  cursor: pointer;
}

.events-table tr.row-link:hover td {
  background-color: #f3f4f6;
}

.events-table th:last-child {
  width: 140px;
}

.status-ongoing {
  color: #15803d;
  font-weight: 600;
}

.status-upcoming {
  color: #000000;
}

.status-ended {
  color: #6b7280;
}

.events-table td a {
  text-decoration: none;
  font-weight: 500;
}

.error-text {
  color: #dc2626;
}

/* Login */

body.bare {
  background-color: #ffffff;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.bare .error-text {
  padding: 32px;
}

.login-box {
  width: 100%;
  max-width: 384px;
  padding: 32px;
  background-color: #000000;
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 32px;
}

.login-logo img {
  height: 48px;
}

.login-error {
  margin-bottom: 16px;
  padding: 12px;
  background-color: #7f1d1d;
  color: #fecaca;
  border: 1px solid #991b1b;
}

.login-form {
  display: flex;
  flex-direction: column;
}

.login-form label {
  color: #d1d5db;
  margin-bottom: 4px;
}

.login-form input {
  margin-bottom: 16px;
  padding: 8px 12px;
  font-size: 14px;
  color: #000000;
  background-color: #ffffff;
  border: 1px solid #ffffff;
  border-radius: 0;
}

/* Browsers tint autofilled fields; the inset shadow paints over the tint. */
.login-form input:autofill,
.login-form input:-webkit-autofill {
  -webkit-text-fill-color: #000000;
  caret-color: #000000;
  box-shadow: 0 0 0 1000px #ffffff inset;
}

.login-form input:focus,
.login-form button:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.login-form button {
  margin-top: 8px;
  padding: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
  background-color: #000000;
  border: 1px solid #ffffff;
  border-radius: 0;
  cursor: pointer;
}

.login-form button:hover,
.login-form button:focus-visible {
  color: #000000;
  background-color: #ffffff;
}
