:root {
  --ink: #17212b;
  --muted: #63717f;
  --line: #dfe6dc;
  --surface: #ffffff;
  --surface-soft: #f8faf6;
  --wash: #eef4ec;
  --accent: #4f8a44;
  --accent-dark: #2f6732;
  --accent-soft: #e6f1e2;
  --danger: #b3261e;
  --shadow: 0 18px 45px rgba(30, 48, 36, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden],
.is-hidden {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(79, 138, 68, 0.14), rgba(255, 255, 255, 0) 34%),
    var(--wash);
  font-family: Urbanist, Arial, sans-serif;
  font-size: 16px;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  padding: 10px 16px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.button-link {
  display: inline-grid;
  place-items: center;
  min-height: 42px;
  border-radius: 7px;
  padding: 10px 16px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

button:hover,
.button-link:hover {
  background: var(--accent-dark);
}

button:active {
  transform: translateY(1px);
}

button.secondary,
.button-link.secondary {
  color: var(--ink);
  background: #eef3ea;
}

button.secondary:hover {
  background: #dfe9da;
}

button.secondary:hover,
.button-link.secondary:hover {
  background: #dfe9da;
}

.shell {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0;
}

.admin-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 32px rgba(30, 48, 36, 0.08);
}

.admin-brand {
  color: var(--accent-dark);
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-links a,
.nav-links button {
  min-height: 38px;
  border-radius: 7px;
  padding: 9px 12px;
  color: var(--ink);
  background: transparent;
  font-weight: 800;
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a.active,
.nav-links button:hover {
  color: #fff;
  background: var(--accent);
}

.nav-links button {
  color: var(--danger);
}

.hamburger-button {
  display: none;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--ink);
  background: #eef3ea;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.overview-card {
  display: block;
  min-height: 150px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  text-decoration: none;
  box-shadow: 0 12px 32px rgba(30, 48, 36, 0.08);
}

.overview-card span {
  display: block;
  color: var(--accent-dark);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.overview-card strong {
  display: block;
  margin: 10px 0 8px;
  font-size: 1.55rem;
}

.overview-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.dashboard-timeline-panel {
  margin-top: 18px;
}

.empty-state {
  margin: 0;
}

.login-panel,
.panel,
.stats-grid article,
.stats-grid .stat-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 34px;
  align-items: center;
  min-height: 440px;
  margin: 8vh auto 0;
  padding: 46px;
}

.login-copy {
  max-width: 560px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.05;
}

h1 {
  font-size: 3rem;
}

h2 {
  font-size: 1.35rem;
}

.muted {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.form-stack,
.data-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(79, 138, 68, 0.17);
}

.message {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-weight: 800;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.events-topbar {
  align-items: center;
}

.event-topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-add-button {
  width: 52px;
  height: 52px;
  min-height: 52px;
  padding: 0;
  border-radius: 50%;
  font-size: 2rem;
  line-height: 1;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stats-grid article,
.stats-grid .stat-card {
  padding: 17px;
}

.stats-grid .stat-card {
  min-height: auto;
  border: 1px solid var(--line);
  color: var(--ink);
  text-align: left;
}

.stats-grid .stat-card:hover,
.stats-grid .stat-card:focus-visible {
  background: #fff;
  border-color: var(--accent);
  outline: 0;
}

.stats-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.stats-grid strong {
  display: block;
  font-size: 1.75rem;
  line-height: 1.1;
}

.sponsor-search-panel {
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 32px rgba(30, 48, 36, 0.08);
}

.sponsor-lookup {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.tabs button,
.tab-link {
  display: inline-grid;
  place-items: center;
  min-height: 38px;
  border-radius: 7px;
  padding: 10px 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  box-shadow: none;
  font-weight: 800;
  text-decoration: none;
}

.tabs button.active,
.tab-link.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.panel {
  padding: 22px;
  box-shadow: 0 12px 32px rgba(30, 48, 36, 0.08);
}

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

.event-type-modal-panel {
  max-width: 460px;
}

.event-type-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(23, 33, 43, 0.46);
}

.modal-panel {
  width: min(980px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(23, 33, 43, 0.22);
}

.modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.modal-heading h2 {
  margin: 0;
}

.modal-close {
  flex: 0 0 auto;
}

.modal-panel .data-form {
  border: 0;
  border-radius: 0;
  min-width: 0;
}

.data-form {
  align-items: end;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.event-form {
  grid-template-columns: 130px minmax(180px, 1fr) minmax(150px, 0.8fr) 140px minmax(180px, 0.9fr) minmax(220px, 1.2fr) auto;
}

.timeline-entry-form {
  grid-template-columns: 130px minmax(180px, 1fr) minmax(150px, 0.8fr) minmax(180px, 0.9fr) minmax(220px, 1.2fr) auto;
}

.event-form .image-preview {
  grid-column: 1 / 5;
}

.event-form .timeline-note-field {
  grid-column: span 3;
}

.timeline-entry-form .image-preview {
  grid-column: 1 / 5;
}

.event-form .actions {
  grid-column: 5 / -1;
  justify-self: end;
}

.timeline-entry-form .actions {
  grid-column: 5 / -1;
  justify-self: end;
}

.sponsorship-form {
  grid-template-columns: 110px minmax(180px, 1.2fr) minmax(180px, 1fr) 140px 160px minmax(220px, 1.3fr);
}

.sponsorship-logo-field {
  grid-column: span 2;
}

.sponsorship-logo-preview {
  grid-column: span 4;
}

.sponsorship-form .actions {
  grid-column: 1 / -1;
  justify-self: start;
}

.cost-form {
  grid-template-columns: 150px minmax(220px, 1.4fr) minmax(160px, 1fr) 140px 150px minmax(220px, 1.2fr) auto;
}

.report-form {
  grid-template-columns: 150px minmax(220px, 1.2fr) minmax(160px, 0.9fr) minmax(220px, 1fr) minmax(240px, 1.2fr) auto;
}

.drink-form,
.accounting-form {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.drink-modal-panel {
  width: min(820px, calc(100vw - 32px));
}

.accounting-modal-panel {
  width: min(760px, calc(100vw - 32px));
}

.report-modal-panel {
  width: min(820px, calc(100vw - 32px));
}

.event-modal-panel {
  width: min(980px, calc(100vw - 48px));
}

.timeline-entry-modal-panel {
  width: min(720px, calc(100vw - 32px));
}

.drink-modal-panel .modal-heading {
  align-items: center;
}

.drink-modal-panel .drink-form,
.accounting-modal-panel .accounting-form,
.report-modal-panel .report-form,
.event-modal-panel .event-form,
.timeline-entry-modal-panel .timeline-entry-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.drink-modal-panel .wide,
.drink-modal-panel .actions,
.accounting-modal-panel .wide,
.accounting-modal-panel .actions,
.report-modal-panel .wide,
.report-modal-panel .actions,
.event-modal-panel .wide,
.event-modal-panel .timeline-note-field,
.event-modal-panel .image-preview,
.event-modal-panel .actions,
.timeline-entry-modal-panel .wide,
.timeline-entry-modal-panel .image-preview,
.timeline-entry-modal-panel .actions {
  grid-column: 1 / -1;
}

.drink-modal-panel .actions,
.accounting-modal-panel .actions,
.report-modal-panel .actions,
.event-modal-panel .actions,
.timeline-entry-modal-panel .actions {
  justify-self: end;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.wide {
  grid-column: span 2;
}

.actions {
  display: flex;
  gap: 8px;
}

.view-toggle {
  display: inline-flex;
  gap: 6px;
  margin-top: 18px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.view-toggle button {
  min-height: 36px;
  color: var(--ink);
  background: transparent;
}

.view-toggle button.active {
  color: #fff;
  background: var(--accent);
}

.event-view-toggle {
  margin-top: 0;
}

.event-list-panel {
  margin-top: 18px;
}

.event-list-panel .view-toggle {
  margin-top: 0;
  margin-bottom: 14px;
}

.image-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  color: var(--muted);
  font-weight: 800;
}

.image-preview img {
  width: 74px;
  height: 48px;
  border-radius: 7px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.image-preview button {
  min-height: 36px;
  padding: 7px 10px;
}

.photo-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.photo-preview-item {
  display: grid;
  gap: 6px;
  width: 116px;
}

.photo-preview-item img {
  width: 116px;
  height: 76px;
}

.photo-preview-item button {
  min-height: 32px;
  padding: 6px 8px;
}

.sponsor-logo-cell {
  width: 86px;
}

.sponsor-logo-thumb {
  display: block;
  width: 58px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  object-fit: contain;
}

.sponsor-logo-empty {
  color: var(--muted);
  font-weight: 900;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 130px 170px 130px 130px auto auto;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.filter-result {
  margin: 0;
  color: var(--muted);
  font-weight: 900;
  align-self: center;
  white-space: nowrap;
}

.accounting-filter {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin: 16px 0 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.more-actions {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.timeline {
  position: relative;
  display: grid;
  gap: 0;
  margin: 24px auto 4px;
  padding: 8px 0;
  max-width: 980px;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  border-left: 2px dashed #6f766f;
  transform: translateX(-1px);
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 82px 1fr;
  min-height: 104px;
}

.timeline-marker {
  position: relative;
  z-index: 1;
  grid-column: 2;
  display: grid;
  place-items: center;
  align-self: start;
  width: 72px;
  height: 72px;
  margin: 8px auto 0;
  border: 5px solid var(--accent);
  border-radius: 50%;
  background: #fff;
  color: var(--accent);
  box-shadow: 0 0 0 8px var(--wash);
}

.timeline-marker span {
  font-size: 1.05rem;
  font-weight: 900;
}

.timeline-marker.minor {
  width: 22px;
  height: 22px;
  margin-top: 32px;
  border-width: 4px;
  box-shadow: 0 0 0 8px var(--wash);
}

.timeline-content {
  position: relative;
  align-self: start;
  padding: 2px 16px 12px;
  cursor: pointer;
}

.timeline-content::before {
  content: "";
  position: absolute;
  top: 42px;
  width: 72px;
  border-top: 2px dashed #6f766f;
}

.timeline-item.left .timeline-content {
  grid-column: 1;
  text-align: right;
}

.timeline-item.left .timeline-content::before {
  right: -72px;
}

.timeline-item.right .timeline-content {
  grid-column: 3;
  text-align: left;
}

.timeline-item.right .timeline-content::before {
  left: -72px;
}

.timeline-label {
  display: inline-block;
  max-width: 100%;
  margin-bottom: 6px;
  border-radius: 999px;
  padding: 4px 10px;
  color: #182018;
  background: #f0b447;
  font-size: 0.9rem;
  font-weight: 900;
}

.timeline-title-row {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  vertical-align: top;
}

.timeline-item.right .timeline-title-row,
.timeline-loose-item .timeline-title-row {
  justify-content: flex-start;
}

.timeline-detail-icon {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-bottom: 6px;
  border: 2px solid currentColor;
  border-radius: 50%;
  color: var(--accent);
  background: #fff;
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 3px 10px rgba(30, 48, 36, 0.12);
}

.timeline-item:not(.timeline-loose-item) .timeline-label {
  padding: 8px 18px;
  font-size: 1.25rem;
}

.timeline-item:not(.timeline-loose-item):hover .timeline-detail-icon,
.timeline-item:not(.timeline-loose-item):focus-visible .timeline-detail-icon {
  color: #fff;
  background: var(--accent);
}

.timeline-content time {
  display: block;
  color: var(--accent);
  font-size: 1.35rem;
  font-weight: 900;
}

.timeline-content h3 {
  margin: 4px 0;
  font-size: 1rem;
  line-height: 1.2;
}

.timeline-content p {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.timeline-anecdote {
  max-width: 36ch;
}

.timeline-content img {
  display: block;
  width: min(220px, 100%);
  aspect-ratio: 16 / 9;
  margin-top: 8px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.timeline-image-button {
  display: block;
  width: min(220px, 100%);
  min-height: 0;
  margin-top: 8px;
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.timeline-image-button:hover,
.timeline-image-button:focus-visible {
  background: transparent;
  outline: 3px solid rgba(79, 138, 68, 0.24);
  outline-offset: 3px;
}

.timeline-image-button img {
  width: 100%;
  margin-top: 0;
}

.timeline-item:focus-visible .timeline-content,
.timeline-item.selected .timeline-content {
  border-radius: 8px;
  outline: 3px solid rgba(79, 138, 68, 0.2);
  background: rgba(255, 255, 255, 0.72);
}

.timeline-item.left .timeline-content img,
.timeline-item.left .timeline-image-button {
  margin-left: auto;
}

.timeline-loose-item .timeline-content {
  cursor: default;
}

.timeline-start-item {
  position: relative;
  display: grid;
  justify-items: center;
  min-height: 96px;
  padding-top: 8px;
}

.timeline-start-item .timeline-marker {
  grid-column: auto;
  margin-top: 0;
}

.timeline-start-item time {
  display: block;
  position: relative;
  z-index: 1;
  margin-top: 12px;
  padding: 0 8px;
  color: var(--accent);
  background: var(--surface);
  font-size: 1.35rem;
  font-weight: 900;
}

.image-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  padding: 28px;
  background: rgba(23, 33, 43, 0.82);
}

.image-preview-overlay.is-open {
  display: grid;
}

.image-preview-dialog {
  position: relative;
  width: min(1120px, 100%);
  max-height: calc(100vh - 56px);
}

.image-preview-dialog img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 56px);
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

.image-preview-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  min-height: 38px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
}

.image-preview-nav {
  position: absolute;
  top: 50%;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 56px;
  min-height: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: #fff;
  background: transparent;
  box-shadow: none;
  transform: translateY(-50%);
}

.image-preview-nav::before {
  content: "";
  display: block;
  width: 13px;
  height: 13px;
  border-top: 3px solid currentColor;
  border-right: 3px solid currentColor;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.55));
}

.image-preview-previous::before {
  transform: rotate(-135deg);
}

.image-preview-next::before {
  transform: rotate(45deg);
}

.image-preview-nav:hover,
.image-preview-nav:focus-visible {
  background: rgba(0, 0, 0, 0.12);
}

.image-preview-previous {
  left: 12px;
}

.image-preview-next {
  right: 12px;
}

.image-preview-counter {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 1;
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  font-weight: 900;
  transform: translateX(-50%);
}

.year-color-1 .timeline-marker,
.year-color-1 .timeline-content time {
  color: #4f8a44;
  border-color: #4f8a44;
}

.year-color-1 .timeline-label {
  background: #a7d48f;
}

.year-color-2 .timeline-marker,
.year-color-2 .timeline-content time {
  color: #3f72d8;
  border-color: #3f72d8;
}

.year-color-2 .timeline-label {
  background: #9fb8f2;
}

.year-color-3 .timeline-marker,
.year-color-3 .timeline-content time {
  color: #d49320;
  border-color: #d49320;
}

.year-color-3 .timeline-label {
  background: #f0c15c;
}

.year-color-4 .timeline-marker,
.year-color-4 .timeline-content time {
  color: #d95f7a;
  border-color: #d95f7a;
}

.year-color-4 .timeline-label {
  background: #f2a1b1;
}

.year-color-5 .timeline-marker,
.year-color-5 .timeline-content time {
  color: #7f63d9;
  border-color: #7f63d9;
}

.year-color-5 .timeline-label {
  background: #b9a3ef;
}

.year-color-6 .timeline-marker,
.year-color-6 .timeline-content time {
  color: #2fa6a0;
  border-color: #2fa6a0;
}

.year-color-6 .timeline-label {
  background: #8bd9d3;
}

.year-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.year-summary:empty {
  display: none;
}

.year-card {
  position: relative;
  overflow: hidden;
  min-height: 142px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  box-shadow: 0 10px 24px rgba(30, 48, 36, 0.06);
}

.year-card:hover,
.year-card.active {
  color: var(--ink);
  background: #fff;
  border-color: var(--accent);
}

.year-card span,
.year-card small {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.year-card strong {
  display: block;
  margin: 5px 0;
  font-size: 1.35rem;
}

.year-card i {
  position: absolute;
  right: auto;
  bottom: 0;
  left: 0;
  display: block;
  height: 6px;
  background: var(--accent);
}

.sponsorship-detail {
  margin-top: 18px;
}

.event-detail {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.detail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.detail-heading h3 {
  margin: 0;
  font-size: 1.15rem;
}

.event-detail-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(300px, 1.1fr);
  gap: 14px;
}

.event-detail-card {
  min-height: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.event-detail-card img {
  width: 100%;
  max-height: 220px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
}

.event-photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.event-photo-button {
  min-height: 0;
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.event-photo-button:hover,
.event-photo-button:focus-visible {
  background: transparent;
  outline: 3px solid rgba(79, 138, 68, 0.24);
  outline-offset: 3px;
}

.event-photo-button img {
  display: block;
  width: 100%;
  height: 92px;
  max-height: none;
  margin: 0;
  object-fit: cover;
}

.event-detail-card h4 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.event-drinks-card,
.event-reports-card {
  grid-column: 1 / -1;
  margin-top: 24px;
}

.event-drinks-card .event-accounting-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.event-drinks-card table {
  min-width: 780px;
}

.event-reports-card table {
  min-width: 720px;
}

.event-detail-card dl {
  display: grid;
  gap: 9px;
  margin: 0;
}

.event-detail-card dl div {
  display: grid;
  grid-template-columns: 95px 1fr;
  gap: 12px;
}

.event-detail-card dt {
  color: var(--muted);
  font-weight: 900;
}

.event-detail-card dd {
  margin: 0;
  font-weight: 800;
}

.event-accounting-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.event-accounting-summary span,
.event-accounting-summary button {
  display: block;
  min-height: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  box-shadow: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.event-accounting-summary button:hover,
.event-accounting-summary button:focus-visible,
.event-accounting-summary button.active {
  border-color: var(--accent);
  background: #eef3ea;
}

.event-accounting-summary button:active {
  transform: none;
}

.event-accounting-summary small {
  display: block;
  color: var(--muted);
  font-weight: 900;
}

.event-accounting-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 1.2rem;
}

.event-accounting-summary strong.is-profit {
  color: #15803d;
}

.event-accounting-summary strong.is-loss {
  color: #b91c1c;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.drink-evolution-panel {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.compact-heading {
  align-items: end;
  padding: 0;
  border: 0;
}

.drink-evolution-toggle {
  min-width: 84px;
}

.drink-evolution-content {
  margin-top: 14px;
}

.drink-evolution-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) minmax(180px, 1fr) minmax(120px, 0.7fr);
  gap: 10px;
}

.drink-evolution-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.drink-evolution-summary div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.drink-evolution-summary span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.drink-evolution-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 1.1rem;
}

.drink-evolution-wrap table {
  min-width: 900px;
}

.drink-order-filter {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
  align-items: end;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.price-trend {
  display: block;
  width: 120px;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ecdf;
}

.price-trend span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

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

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fbfdf9;
}

.is-clickable-row {
  cursor: pointer;
}

.is-clickable-row:hover,
.is-clickable-row:focus-visible {
  background: #eef7ea;
  outline: 3px solid rgba(79, 138, 68, 0.22);
  outline-offset: -3px;
}

.is-clickable-row a {
  color: inherit;
  font-weight: 800;
  text-decoration: none;
}

.is-clickable-row a:hover,
.is-clickable-row a:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

.accounting-overview-panel {
  margin-bottom: 18px;
}

.financial-overview-wrap {
  margin-top: 0;
}

.financial-overview {
  min-width: 960px;
  font-variant-numeric: tabular-nums;
}

.financial-overview th {
  color: #fff;
  background: #111;
}

.financial-overview th,
.financial-overview td {
  padding: 9px 10px;
}

.financial-overview tbody tr:hover {
  background: #f8faf6;
}

.financial-overview .is-clickable-row {
  cursor: pointer;
}

.financial-overview .is-clickable-row:hover,
.financial-overview .is-clickable-row:focus-visible {
  background: #eef7ea;
  outline: 3px solid rgba(79, 138, 68, 0.22);
  outline-offset: -3px;
}

.financial-overview .financial-year {
  width: 86px;
  border-right: 1px solid var(--line);
  color: #111;
  background: #f5f7f2;
  font-size: 2.15rem;
  line-height: 1;
  text-align: center;
  vertical-align: middle;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.financial-overview .money {
  text-align: right;
  white-space: nowrap;
}

.financial-overview .is-profit {
  color: #15803d;
  font-weight: 900;
}

.financial-overview .is-loss {
  color: #b91c1c;
  font-weight: 900;
}

.financial-overview .is-summary-row td {
  font-weight: 900;
}

.financial-overview .is-year-start th,
.financial-overview .is-year-start td {
  border-top: 4px solid #111;
}

.financial-overview .financial-total-row th,
.financial-overview .financial-total-row td {
  border-top: 2px solid #111;
  border-bottom: 0;
  font-weight: 900;
}

.financial-overview .financial-total-row th {
  color: #111;
  background: #f5f7f2;
  text-align: right;
}

.financial-overview .financial-total-row td:nth-last-child(2) {
  color: #fff;
  background: var(--accent);
}

th {
  color: var(--muted);
  background: #f3f7f1;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

td:last-child {
  width: 160px;
}

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.row-actions button {
  min-height: 34px;
  padding: 7px 10px;
}

.file-link {
  color: var(--accent-dark);
  font-weight: 900;
  text-decoration: none;
}

.file-link:hover {
  text-decoration: underline;
}

.file-size {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 800;
}

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

.danger:hover {
  background: #8d1f1a;
}

@media (max-width: 1050px) {
  .event-form,
  .timeline-entry-form,
  .sponsorship-form,
  .cost-form,
  .report-form,
  .drink-form,
  .accounting-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .accounting-filter {
    grid-template-columns: minmax(0, 1fr);
  }

  .drink-evolution-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sponsor-lookup {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

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

  .event-form .image-preview,
  .timeline-entry-form .image-preview,
  .sponsorship-logo-field,
  .sponsorship-logo-preview,
  .event-form .actions,
  .timeline-entry-form .actions,
  .sponsorship-form .actions {
    grid-column: auto;
  }

  .event-form .actions,
  .timeline-entry-form .actions,
  .sponsorship-form .actions {
    justify-self: start;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 24px, 1240px);
    padding: 20px 0;
  }

  .login-panel,
  .stats-grid,
  .event-form,
  .timeline-entry-form,
  .sponsorship-form,
  .cost-form,
  .report-form,
  .drink-form,
  .accounting-form {
    grid-template-columns: 1fr;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .drink-evolution-filters,
  .drink-evolution-summary,
  .event-drinks-card .event-accounting-summary,
  .drink-order-filter,
  .accounting-filter {
    grid-template-columns: 1fr;
  }

  .modal-overlay {
    padding: 12px;
  }

  .modal-panel {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }

  .drink-modal-panel .drink-form,
  .accounting-modal-panel .accounting-form,
  .report-modal-panel .report-form,
  .event-modal-panel .event-form,
  .timeline-entry-modal-panel .timeline-entry-form {
    grid-template-columns: 1fr;
  }

  .drink-modal-panel .modal-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .drink-modal-panel .modal-close {
    align-self: flex-start;
  }

  .sponsor-lookup {
    grid-template-columns: 1fr;
  }

  .filter-result {
    white-space: normal;
  }

  .event-accounting-summary,
  .event-detail-card dl div {
    grid-template-columns: 1fr;
  }

  .admin-nav {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .hamburger-button {
    display: inline-grid;
    place-items: center;
    margin-left: auto;
  }

  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .admin-nav.open .nav-links {
    display: flex;
  }

  .timeline {
    gap: 10px;
    margin: 14px 0 0;
    padding: 4px 0 8px;
  }

  .timeline::before {
    left: 21px;
    border-left-width: 2px;
    opacity: 0.85;
  }

  .timeline-item {
    grid-template-columns: 42px minmax(0, 1fr);
    min-height: auto;
    padding-bottom: 8px;
  }

  .timeline-marker {
    grid-column: 1;
    width: 42px;
    height: 42px;
    margin-top: 8px;
    border-width: 4px;
    box-shadow: 0 0 0 5px var(--wash);
  }

  .timeline-marker span {
    font-size: 0.72rem;
  }

  .timeline-marker.minor {
    width: 14px;
    height: 14px;
    margin-top: 20px;
    border-width: 3px;
    box-shadow: 0 0 0 5px var(--wash);
  }

  .timeline-item.left .timeline-content,
  .timeline-item.right .timeline-content {
    grid-column: 2;
    text-align: left;
  }

  .timeline-content {
    margin-left: 10px;
    padding: 12px 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 8px 22px rgba(30, 48, 36, 0.06);
  }

  .timeline-item.left .timeline-content::before,
  .timeline-item.right .timeline-content::before {
    left: -11px;
    right: auto;
    width: 11px;
    top: 28px;
  }

  .timeline-label {
    margin-bottom: 4px;
    white-space: normal;
    line-height: 1.05;
  }

  .timeline-title-row {
    justify-content: flex-start;
  }

  .timeline-detail-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
    font-size: 0.82rem;
  }

  .timeline-item:not(.timeline-loose-item) .timeline-label {
    padding: 7px 12px;
    font-size: 1.1rem;
  }

  .timeline-content time {
    font-size: 1.15rem;
    line-height: 1.05;
  }

  .timeline-content h3 {
    font-size: 0.96rem;
  }

  .timeline-content p {
    font-size: 0.95rem;
    line-height: 1.35;
  }

  .timeline-anecdote {
    max-width: none;
  }

  .timeline-item.left .timeline-content img,
  .timeline-item.left .timeline-image-button {
    margin-left: 0;
  }

  .timeline-image-button,
  .timeline-content img {
    width: 100%;
  }

  .timeline-start-item {
    padding-top: 2px;
  }

  .timeline-start-item .timeline-marker {
    width: 58px;
    height: 58px;
    border-width: 5px;
  }

  .timeline-start-item time {
    margin-top: 8px;
    font-size: 1.25rem;
  }

  .image-preview-overlay {
    padding: 14px;
  }

  .image-preview-dialog,
  .image-preview-dialog img {
    max-height: calc(100vh - 28px);
  }

  .image-preview-close {
    top: 8px;
    right: 8px;
  }

  .image-preview-nav {
    top: 50%;
    bottom: auto;
    width: 42px;
    height: 54px;
    transform: translateY(-50%);
  }

  .image-preview-previous {
    left: 8px;
  }

  .image-preview-next {
    right: 8px;
  }

  .image-preview-counter {
    bottom: 62px;
  }

  .login-panel,
  .panel {
    padding: 18px;
  }

  .login-panel {
    margin-top: 20px;
    min-height: auto;
  }

  .wide {
    grid-column: auto;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .events-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .event-topbar-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .topbar-actions {
    flex-wrap: wrap;
  }

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

  h1 {
    font-size: 2.3rem;
  }
}
