.app-body {
  background: #f4f6f2;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px clamp(18px, 4vw, 54px);
  color: var(--ink);
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.app-header nav {
  display: flex;
  align-items: center;
  gap: 20px;
  color: var(--ink);
}

.app-brand .brand-mark {
  color: #fff;
  border-color: var(--field);
  background: var(--field);
}

.link-button {
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.app-shell {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding: 48px 0 80px;
}

.auth-panel,
.dashboard-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(23, 32, 28, 0.07);
}

.auth-panel {
  width: min(520px, 100%);
  margin: 28px auto;
  padding: clamp(24px, 5vw, 42px);
}

.auth-panel h1,
.dashboard-hero h1 {
  margin-bottom: 14px;
  font-size: clamp(2.2rem, 7vw, 4.2rem);
  line-height: 0.98;
}

.auth-panel p,
.dashboard-hero p,
.empty-state {
  color: var(--muted);
  line-height: 1.6;
}

.auth-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.auth-form label {
  display: grid;
  gap: 8px;
  font-weight: 800;
}

.auth-form input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  color: var(--ink);
  background: #fbfcfa;
  font: inherit;
}

.auth-form input:focus {
  border-color: var(--field);
  outline: 3px solid rgba(39, 116, 93, 0.16);
}

.form-error {
  border-left: 4px solid var(--alert);
  padding: 10px 12px;
  color: var(--ink) !important;
  background: rgba(216, 91, 57, 0.1);
}

.auth-switch {
  margin: 22px 0 0;
}

.auth-switch a {
  color: var(--field);
  font-weight: 850;
}

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

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

.dashboard-section {
  padding: 24px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading .button {
  margin-left: auto;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.4rem;
}

.section-heading span {
  display: grid;
  min-width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  background: var(--field);
  font-weight: 900;
}

.event-list {
  display: grid;
  gap: 12px;
}

.event-card {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(130px, 0.75fr) minmax(130px, 0.75fr);
  gap: 24px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  color: inherit;
  text-decoration: none;
  background: #fbfcfa;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.event-main {
  display: grid;
  align-content: center;
}

.event-card h3 {
  margin-bottom: 6px;
}

.event-card:hover,
.event-card:focus-visible {
  border-color: rgba(39, 116, 93, 0.42);
  box-shadow: 0 12px 34px rgba(23, 32, 28, 0.1);
  outline: none;
  transform: translateY(-1px);
}

.event-card:hover h3,
.event-card:focus-visible h3 {
  color: var(--field);
}

.event-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.event-meta span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.event-meta strong {
  display: block;
  margin: 6px 0 0;
  font-weight: 850;
}

.event-meta {
  display: grid;
  min-height: 54px;
  align-content: center;
  justify-items: center;
  text-align: center;
}

.event-access {
  justify-self: end;
  min-width: 130px;
  justify-items: center;
  text-align: center;
}

.event-access strong {
  display: block;
  line-height: normal;
}

.status-pill {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border-radius: 7px;
  padding: 7px 12px 6px;
  font-size: 0.84rem;
  font-weight: 900;
  line-height: 1.1;
  white-space: nowrap;
  vertical-align: middle;
}

.status-pill.is-closed {
  border: 1px solid rgba(216, 91, 57, 0.22);
  color: var(--alert);
  background: #fff;
}

.status-pill.is-open {
  color: #fff;
  background: var(--field);
}

.joined-events {
  margin-top: 20px;
}

.form-page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin: 8px auto 28px;
}

.form-page-heading h1 {
  margin-bottom: 14px;
  font-size: clamp(2.5rem, 8vw, 4.8rem);
  line-height: 0.96;
}

.form-page-heading p {
  max-width: 620px;
  color: var(--muted);
  line-height: 1.6;
}

.event-form-panel {
  margin-left: 0;
}

.button.secondary.dark {
  border-color: var(--line);
  color: var(--ink);
  background: #fff;
}

.event-page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin: 8px auto 28px;
}

.event-page-heading h1 {
  margin-bottom: 14px;
  font-size: clamp(2.5rem, 8vw, 4.8rem);
  line-height: 0.96;
}

.event-page-heading p {
  color: var(--muted);
  line-height: 1.6;
}

.event-heading-actions {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.event-topline {
  display: grid;
  gap: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px 24px 18px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(23, 32, 28, 0.07);
}

.event-topline h2 {
  margin: 12px 0 8px;
  font-size: 1.4rem;
}

.event-topline p {
  margin: 0;
  color: var(--muted);
}

.event-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  width: fit-content;
  max-width: 100%;
}

.event-toolbar form {
  margin: 0;
}

.event-share-stack {
  display: grid;
  justify-items: start;
  gap: 10px;
}

.toolbar-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  padding: 0 11px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 850;
  cursor: pointer;
}

.toolbar-button.primary {
  color: #1f211b;
  background: var(--safety);
}

.toolbar-button:hover,
.toolbar-button:focus-visible {
  background: #f4f6f2;
  outline: none;
}

.toolbar-button.primary:hover,
.toolbar-button.primary:focus-visible {
  background: #e7aa04;
}

.event-toolbar > :first-child .toolbar-button,
.event-toolbar > .toolbar-button:first-child {
  border-radius: 7px 0 0 7px;
}

.event-toolbar > :last-child .toolbar-button,
.event-toolbar > .toolbar-button:last-child {
  border-right: 0;
  border-radius: 0 7px 7px 0;
}

.inline-join-code {
  display: inline-grid;
  grid-template-columns: auto auto;
  gap: 4px 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fbfcfa;
}

.inline-join-code span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.inline-join-code strong {
  font-size: 1.08rem;
  line-height: 1;
}

.share-menu {
  position: relative;
  display: inline-flex;
}

.share-options {
  position: absolute;
  z-index: 5;
  top: calc(100% + 8px);
  right: 0;
  display: none;
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: #fff;
  box-shadow: var(--shadow);
}

.share-menu.is-open .share-options,
.share-menu:focus-within .share-options {
  display: grid;
}

.share-options a,
.share-options button {
  display: flex;
  min-height: 36px;
  align-items: center;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.share-options a:hover,
.share-options a:focus-visible,
.share-options button:hover,
.share-options button:focus-visible {
  background: #f4f6f2;
  outline: none;
}

.join-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

.join-panel {
  width: 100%;
  margin: 0;
}

.join-panel h2 {
  margin-bottom: 10px;
  font-size: 1.6rem;
}

.join-panel p {
  color: var(--muted);
  line-height: 1.6;
}

.event-generators {
  margin-top: 20px;
}

.generator-list {
  display: grid;
  gap: 12px;
}

.generator-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 18px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fbfcfa;
}

.event-generators.is-editing .generator-card {
  cursor: pointer;
}

.event-generators.is-editing .generator-card:hover,
.event-generators.is-editing .generator-card:focus-within {
  border-color: rgba(39, 116, 93, 0.42);
  box-shadow: 0 12px 34px rgba(23, 32, 28, 0.08);
}

.generator-card h3 {
  margin-bottom: 6px;
}

.generator-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.generator-card .generator-card-notes {
  margin-top: 8px;
  max-width: 62ch;
  line-height: 1.45;
}

.generator-card-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.generator-card span {
  border-radius: 7px;
  padding: 6px 8px;
  color: var(--muted);
  background: #fff;
  font-size: 0.8rem;
  font-weight: 850;
}

.generator-remove-form {
  display: none;
  margin: 0;
}

.event-generators.is-editing .generator-remove-form {
  display: block;
}

.toolbar-button.danger {
  color: #fff;
  background: var(--alert);
}

.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(23, 32, 28, 0.48);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  width: min(820px, 100%);
  max-height: calc(100vh - 24px);
  overflow: auto;
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.modal-heading h2 {
  margin-bottom: 0;
  font-size: 1.55rem;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font-weight: 900;
  cursor: pointer;
}

.generator-form {
  display: grid;
  gap: 12px;
}

.generator-input-list {
  display: grid;
  gap: 10px;
}

.fuel-tank-list {
  display: grid;
  gap: 10px;
}

.fuel-tank-area {
  display: grid;
  gap: 10px;
}

.generator-input-card,
.form-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: #fbfcfa;
}

.generator-input-card {
  display: grid;
  gap: 10px;
}

.form-card {
  display: grid;
  gap: 10px;
}

.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.card-heading h3 {
  margin: 0;
  font-size: 0.98rem;
}

.generator-form:not(.is-synced) [data-add-generator] {
  display: none;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  align-items: start;
}

.generator-form label {
  min-width: 0;
  display: grid;
  gap: 5px;
  font-weight: 850;
}

.generator-form label span {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.generator-form input,
.generator-form select,
.generator-form textarea {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  color: var(--ink);
  background: #fbfcfa;
  font: inherit;
}

.generator-form textarea {
  min-height: 76px;
  padding: 8px 10px;
  resize: vertical;
  line-height: 1.4;
}

.generator-form select,
.auth-form select {
  appearance: none;
  padding-right: 38px;
  background-color: #fbfcfa;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 18px,
    calc(100% - 12px) 18px;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px;
  cursor: pointer;
}

.generator-form select:focus,
.generator-form textarea:focus,
.auth-form select:focus {
  border-color: var(--field);
  outline: 3px solid rgba(39, 116, 93, 0.16);
}

.generator-form fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.generator-form legend {
  padding: 0 6px;
  font-weight: 900;
}

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

.tank-generator-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.tank-generator-options label {
  gap: 12px;
  padding-right: 6px;
}

.generator-form input[type="radio"],
.generator-form input[type="checkbox"],
.auth-form input[type="radio"],
.auth-form input[type="checkbox"] {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  border: 2px solid var(--line);
  accent-color: var(--field);
  background: #fff;
}

.generator-form input[type="radio"],
.auth-form input[type="radio"] {
  border-radius: 50%;
}

.generator-form input[type="checkbox"],
.auth-form input[type="checkbox"] {
  border-radius: 5px;
}

.generator-form input[type="radio"]:focus-visible,
.generator-form input[type="checkbox"]:focus-visible,
.auth-form input[type="radio"]:focus-visible,
.auth-form input[type="checkbox"]:focus-visible {
  outline: 3px solid rgba(39, 116, 93, 0.18);
  outline-offset: 2px;
}

.generator-input-card .form-grid {
  grid-template-columns: repeat(3, minmax(150px, 1fr));
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 2px;
}

@media (max-width: 820px) {
  .app-header nav {
    display: flex;
  }

  .dashboard-grid,
  .form-page-heading {
    grid-template-columns: 1fr;
  }

  .form-page-heading,
  .event-page-heading,
  .event-topline {
    display: grid;
  }

  .dashboard-hero {
    display: grid;
  }

  .event-card {
    grid-template-columns: 1fr 1fr;
  }

  .event-main {
    grid-column: 1 / -1;
  }

  .event-access {
    justify-self: start;
  }

  .event-toolbar {
    justify-content: flex-start;
  }

  .event-heading-actions,
  .event-share-stack {
    justify-items: start;
  }

  .share-options {
    right: auto;
    left: 0;
  }

  .join-choice-grid {
    grid-template-columns: 1fr;
  }

  .form-grid,
  .generator-input-card .form-grid,
  .generator-card {
    grid-template-columns: 1fr;
  }

  .generator-card div:last-child {
    justify-content: flex-start;
  }
}
