:root {
  --green-950: #15372e;
  --green-900: #1d493c;
  --green-700: #2f6a57;
  --green-100: #e2eee7;
  --red-700: #9d382f;
  --red-100: #f8e6e3;
  --amber-100: #fff2cf;
  --amber-800: #76540a;
  --stone-950: #182226;
  --stone-700: #566268;
  --stone-300: #cbd2d0;
  --stone-200: #dfe4e2;
  --stone-100: #f3f5f4;
  --white: #ffffff;
  --radius: 6px;
  --content: 1080px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--stone-100);
  color: var(--stone-950);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

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

a {
  color: inherit;
}

.admin-header {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px max(24px, calc((100vw - var(--content)) / 2));
  background: var(--green-950);
  color: var(--white);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.admin-brand span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  color: #e7c56f;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.88rem;
  font-weight: 800;
}

.admin-header nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.admin-header nav a,
.admin-header nav button {
  min-height: 40px;
  border: 0;
  border-radius: var(--radius);
  padding: 9px 11px;
  background: transparent;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.86rem;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.admin-header nav a:hover,
.admin-header nav button:hover,
.admin-header nav .is-active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.admin-header nav form {
  margin: 0;
}

.admin-main {
  width: min(var(--content), calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.admin-kicker {
  margin: 0 0 4px;
  color: var(--green-700);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1,
h2 {
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.25rem;
}

h2 {
  font-size: 1.08rem;
}

.admin-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.admin-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 9px 14px;
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.admin-button-primary {
  background: var(--green-700);
  color: var(--white);
}

.admin-button-secondary {
  border-color: var(--stone-300);
  background: var(--white);
  color: var(--stone-950);
}

.admin-button-danger {
  border-color: #e4aaa4;
  background: var(--white);
  color: var(--red-700);
}

.admin-button:hover {
  filter: brightness(0.95);
}

.admin-button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(47, 106, 87, 0.24);
  outline-offset: 2px;
}

.notice {
  margin-bottom: 22px;
  border-left: 4px solid var(--green-700);
  padding: 12px 16px;
  background: var(--green-100);
  font-weight: 700;
}

.notice-error {
  border-left-color: var(--red-700);
  background: var(--red-100);
  color: var(--red-700);
}

.admin-event-list {
  border-top: 1px solid var(--stone-300);
}

.admin-event {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  border-bottom: 1px solid var(--stone-300);
  padding: 20px 0;
}

.admin-event-date {
  display: grid;
  color: var(--stone-700);
  font-size: 0.82rem;
}

.admin-event-date strong {
  color: var(--green-900);
  font-size: 1.5rem;
  line-height: 1.1;
}

.admin-event-content {
  min-width: 0;
}

.admin-event-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-event-content p {
  margin: 5px 0 0;
  color: var(--stone-700);
  font-size: 0.9rem;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.68rem;
  font-weight: 850;
}

.badge-published {
  background: var(--green-100);
  color: var(--green-700);
}

.badge-draft {
  background: var(--stone-200);
  color: var(--stone-700);
}

.badge-album {
  background: var(--amber-100);
  color: var(--amber-800);
}

.badge-photos {
  background: #e4edf3;
  color: #28576f;
}

.badge-attachment {
  background: #f0e8d2;
  color: #6c5315;
}

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

.admin-event-actions form {
  margin: 0;
}

.admin-empty {
  border-left: 4px solid var(--green-700);
  padding: 20px;
  background: var(--white);
}

.admin-empty p {
  margin: 6px 0 0;
  color: var(--stone-700);
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  border-top: 1px solid var(--stone-300);
  padding-top: 24px;
}

.form-field {
  display: grid;
  align-content: start;
  gap: 7px;
}

.form-field-wide {
  grid-column: 1 / -1;
}

.form-field label,
.checkbox-field {
  font-size: 0.88rem;
  font-weight: 800;
}

.form-field input,
.form-field textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--stone-300);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--white);
  color: var(--stone-950);
}

.form-field textarea {
  min-height: 160px;
  resize: vertical;
}

.form-field small {
  color: var(--stone-700);
  font-size: 0.78rem;
}

.field-error {
  color: var(--red-700);
  font-size: 0.82rem;
  font-weight: 750;
}

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.checkbox-field input {
  width: 19px;
  height: 19px;
  margin: 2px 0 0;
  accent-color: var(--green-700);
}

.form-actions {
  display: flex;
  gap: 10px;
  border-top: 1px solid var(--stone-300);
  padding-top: 22px;
}

.auth-panel {
  width: min(100%, 520px);
  margin: 40px auto;
  border: 1px solid var(--stone-200);
  border-radius: var(--radius);
  padding: 32px;
  background: var(--white);
  box-shadow: 0 18px 45px rgba(24, 34, 38, 0.08);
}

.auth-panel > p:not(.admin-kicker) {
  margin: 10px 0 24px;
  color: var(--stone-700);
}

.auth-panel .admin-form,
.password-form {
  grid-template-columns: 1fr;
}

.auth-panel .notice {
  margin: 0 0 20px;
}

.password-form {
  max-width: 620px;
}

.event-form {
  margin-bottom: 56px;
}

.admin-media-section,
.admin-photo-section {
  border-top: 1px solid var(--stone-300);
  padding-top: 32px;
  scroll-margin-top: 20px;
}

.admin-photo-section {
  margin-top: 56px;
}

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

.admin-section-heading h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.75rem;
}

.photo-count {
  min-width: 62px;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--green-100);
  color: var(--green-700);
  font-size: 0.78rem;
  font-weight: 850;
  text-align: center;
}

.attachment-type {
  min-width: 54px;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--amber-100);
  color: var(--amber-800);
  font-size: 0.74rem;
  font-weight: 850;
  text-align: center;
}

.current-attachment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  border: 1px solid var(--stone-200);
  border-radius: var(--radius);
  padding: 16px 18px;
  background: var(--white);
}

.current-attachment > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.current-attachment a {
  overflow-wrap: anywhere;
  color: var(--green-700);
  font-weight: 800;
  text-underline-offset: 3px;
}

.current-attachment span {
  color: var(--stone-700);
  font-size: 0.8rem;
}

.current-attachment form {
  flex: 0 0 auto;
  margin: 0;
}

.attachment-upload-form,
.photo-upload-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  margin-bottom: 28px;
  border: 1px solid var(--stone-200);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--white);
}

.attachment-upload-form input[type="file"],
.photo-upload-form input[type="file"] {
  min-height: 48px;
  border: 1px dashed var(--stone-300);
  border-radius: var(--radius);
  padding: 9px;
  background: var(--stone-100);
}

.photo-upload-status {
  min-height: 1.2em;
  color: var(--green-700);
  font-size: 0.8rem;
  font-weight: 750;
}

.photo-upload-status.is-error {
  color: var(--red-700);
}

.admin-photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.admin-photo-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--stone-200);
  border-radius: var(--radius);
  background: var(--white);
}

.admin-photo-preview {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--stone-200);
}

.admin-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--green-950);
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 850;
}

.admin-photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  border-top: 1px solid var(--stone-200);
  padding: 14px 18px 18px;
}

.admin-photo-actions form {
  margin: 0;
}

.admin-button:disabled {
  cursor: not-allowed;
  filter: none;
  opacity: 0.45;
}

.photo-empty {
  margin-top: 8px;
}

.photo-save-notice {
  margin-top: 28px;
}

.event-save-actions {
  margin-top: 56px;
}

@media (max-width: 760px) {
  .admin-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .admin-header nav {
    width: 100%;
    overflow-x: auto;
  }

  .admin-main {
    width: min(var(--content), calc(100% - 28px));
    padding-top: 32px;
  }

  .admin-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-event {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .admin-event-actions {
    grid-column: 1 / -1;
  }

  .admin-event-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .admin-form {
    grid-template-columns: 1fr;
  }

  .form-field-wide {
    grid-column: auto;
  }

  .auth-panel {
    margin: 8px auto;
    padding: 24px;
  }

  .attachment-upload-form,
  .photo-upload-form,
  .admin-photo-grid {
    grid-template-columns: 1fr;
  }

  .attachment-upload-form .admin-button,
  .photo-upload-form .admin-button {
    width: 100%;
  }
}

@media (max-width: 430px) {
  .admin-event {
    grid-template-columns: 1fr;
  }

  .admin-event-actions {
    grid-column: auto;
    align-items: stretch;
    flex-direction: column;
  }

  .admin-event-actions .admin-button {
    width: 100%;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-section-heading {
    align-items: flex-start;
  }

  .current-attachment {
    align-items: stretch;
    flex-direction: column;
  }

  .current-attachment .admin-button,
  .current-attachment form {
    width: 100%;
  }

  .admin-photo-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-photo-actions .admin-button,
  .admin-photo-actions form {
    width: 100%;
  }
}
