:root {
  --olive-dark: #222d00;
  --olive: #777730;
  --lime: #ddd66b;
  --cream: #fce4c9;
  --brown: #714633;
  --off-white: #f7f3ea;
  --accent: #f78731;
  --ink: #1d1c14;
  --shadow: rgba(22, 20, 10, 0.18);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font-title: "Monoton", cursive;
  --font-body: "Figtree", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: radial-gradient(circle at top left, #fbf3d9 0%, #f7f0dd 45%, #e7e1cc 100%);
  color: var(--ink);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

.admin-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 36px 20px 70px;
}

.admin-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.admin-actions {
  background: transparent;
  padding: 0;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.admin-kicker {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.7rem;
  color: var(--olive);
}

h1,
h2,
h3 {
  font-family: var(--font-title);
  margin: 0;
  color: var(--olive-dark);
}

.admin-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.google-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 2px solid var(--olive-dark);
  background: transparent;
  color: var(--olive-dark);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.google-btn:hover {
  transform: translateY(-2px);
  background: var(--olive-dark);
  color: var(--lime);
}

.google-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
}

.google-icon svg {
  width: 20px;
  height: 20px;
}

.primary-btn {
  border: 2px solid var(--olive-dark);
  background: var(--lime);
  color: var(--olive-dark);
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.primary-btn .btn-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(34, 45, 0, 0.2);
  border-top-color: var(--olive-dark);
  display: none;
  animation: spin 0.8s linear infinite;
}

.primary-btn.loading .btn-spinner {
  display: inline-block;
}

.primary-btn.loading .btn-text {
  display: none;
}

.primary-btn.loading {
  pointer-events: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.primary-btn:hover {
  transform: translateY(-2px);
  background: var(--olive-dark);
  color: var(--lime);
}

.primary-btn.danger {
  background: #b33b2c;
  color: #fff1eb;
}

.ghost-btn {
  border: 2px solid var(--olive-dark);
  background: transparent;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--olive-dark);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.back-btn {
  padding: 10px 16px;
  min-height: 36px;
}

.status-panel {
  background: #fff9ea;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
  box-shadow: 0 12px 26px rgba(40, 35, 20, 0.12);
}

.toast {
  position: sticky;
  top: 10px;
  z-index: 10;
  background: #f3edc8;
  border: 2px solid var(--olive-dark);
  color: var(--olive-dark);
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 0 14px;
  box-shadow: 0 10px 18px rgba(20, 16, 8, 0.12);
}

.toast.error {
  background: #ffe7e3;
  border-color: #b33b2c;
  color: #5a231b;
}

.admin-panel {
  display: grid;
  gap: 24px;
}

.card {
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: 0 20px 35px rgba(28, 24, 12, 0.14);
}

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

.card-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.admin-search {
  border: 2px solid rgba(34, 45, 0, 0.25);
  background: #fffaf0;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.95rem;
  min-width: 180px;
}

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

.form-grid label {
  display: grid;
  gap: 8px;
  font-size: 0.9rem;
  color: #5a5843;
}

.form-grid input,
.form-grid select {
  border-radius: 18px;
  padding: 14px 16px;
  border: 2px solid rgba(34, 45, 0, 0.25);
  background: #fffaf0;
  font-size: 1rem;
  box-shadow: inset 0 0 0 1px rgba(34, 45, 0, 0.06);
  max-width: 100%;
  width: 100%;
  min-width: 0;
}

.form-grid input:focus,
.form-grid select:focus {
  outline: none;
  border-color: var(--olive-dark);
  box-shadow: 0 0 0 3px rgba(221, 214, 107, 0.45);
}

.form-grid .full {
  grid-column: 1 / -1;
}

.image-preview {
  border-radius: 16px;
  padding: 12px;
  background: #fff7e3;
  border: 1px dashed rgba(34, 45, 0, 0.2);
}

.image-preview img {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 12px;
}

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

.record-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #fdf8ed;
  align-items: center;
}

.record-thumb {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  background: #efe7cf;
  box-shadow: 0 8px 14px rgba(18, 16, 8, 0.18);
}

.record-row small {
  color: #6a684f;
}

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

.confirm-dialog {
  border: none;
  border-radius: 18px;
  padding: 22px;
  max-width: 320px;
  width: min(92vw, 420px);
  max-height: 90vh;
  overflow-x: hidden;
  overflow-y: auto;
}

.confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

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

.edit-dialog {
  max-width: 540px;
  width: min(92vw, 540px);
  max-height: 90vh;
  overflow-x: hidden;
  overflow-y: auto;
}

.user-menu {
  position: relative;
  margin-left: auto;
}

.user-chip {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--olive-dark);
  background: transparent;
  color: var(--olive-dark);
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
}

.user-badge {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5a5843;
  margin-top: 6px;
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: 50px;
  background: #ffffff;
  border: 2px solid var(--olive-dark);
  border-radius: 16px;
  padding: 12px;
  display: none;
  min-width: 220px;
  box-shadow: 0 14px 24px rgba(20, 16, 8, 0.2);
  z-index: 5;
}

.user-dropdown p {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: #5a5843;
}

.user-dropdown.show {
  display: block;
}

body.admin-locked .admin-panel {
  display: none;
}

body.admin-auth .auth-hide {
  display: none !important;
}

.netlify-identity-widget .form,
.netlify-identity-widget .login,
.netlify-identity-widget .password,
.netlify-identity-widget .toggle,
.netlify-identity-widget .forgot-password,
.netlify-identity-widget .separator {
  display: none !important;
}

@media (max-width: 720px) {
  .admin-shell {
    padding: 18px 12px 46px;
  }

  .card {
    padding: 16px;
  }

  .form-grid input,
  .form-grid select {
    padding: 12px 12px;
    font-size: 16px;
  }

  .confirm-dialog,
  .edit-dialog {
    width: min(92vw, 520px);
    max-height: 85vh;
    padding: 16px;
    overflow-x: hidden;
  }

  .admin-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: center;
  }

  .admin-actions .ghost-btn,
  .admin-actions .google-btn {
    justify-content: center;
    font-size: 0.68rem;
    padding: 8px 10px;
    white-space: nowrap;
  }

  .user-menu {
    grid-column: 2 / 3;
    justify-self: end;
  }

  .record-row {
    grid-template-columns: 1fr;
  }

  .record-actions {
    justify-content: flex-end;
  }

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

  .card-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .admin-search {
    width: 100%;
    font-size: 16px;
  }
}
