:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1a1f2b;
  --muted: #5f6b7a;
  --primary: #1d7d5f;
  --primary-dark: #155a44;
  --accent: #f5b041;
  --border: #e3e7ee;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(1120px, 92%);
  margin: 0 auto;
}

.header {
  position: sticky;
  top: 0;
  z-index: 3000;
  isolation: isolate;
  background: rgba(247, 248, 250, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand > div {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  object-fit: contain;
}

.brand h1 {
  font-size: 1.1rem;
  margin: 0;
  letter-spacing: 0.02em;
}

.brand span {
  font-size: 0.8rem;
  color: var(--muted);
}

.nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}

.nav a {
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--muted);
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.nav a.active,
.nav a:hover {
  color: var(--primary);
  background: rgba(29, 125, 95, 0.08);
  border-color: rgba(29, 125, 95, 0.18);
}

.nav-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  width: 48px;
  min-width: 0;
  max-width: 240px;
  transition: width 0.25s ease;
}

.nav-search:focus-within {
  width: 240px;
}

.search-input {
  width: 100%;
  min-width: 0;
  padding: 10px 40px 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.nav-search:not(:focus-within) .search-input::placeholder {
  color: transparent;
}

.nav-search:not(:focus-within) .search-input {
  padding-right: 16px;
}

.search-input:focus {
  outline: none;
  border-color: rgba(29, 125, 95, 0.45);
  box-shadow: 0 0 0 3px rgba(29, 125, 95, 0.12);
}

.search-button {
  position: absolute;
  right: 8px;
  transition: transform 0.2s ease;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--muted);
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.nav-search:not(:focus-within) .search-button {
  right: 50%;
  transform: translateX(50%);
}

.search-button:hover {
  color: var(--primary);
  background: rgba(29, 125, 95, 0.1);
}

@media (max-width: 960px) {
  .nav {
    flex-wrap: wrap;
  }

  .nav-search {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
  }
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  max-height: 320px;
  overflow-y: auto;
  z-index: 10;
}
.search-results-section + .search-results-section {
  border-top: 1px solid var(--border);
}

.search-results-title {
  padding: 10px 14px 6px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--surface);
}
.search-result {
  display: block;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.search-result:last-child {
  border-bottom: none;
}

.search-result strong {
  display: block;
  font-size: 0.95rem;
}

.search-result span {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}

.search-empty {
  padding: 12px 14px;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hero {
  padding: 80px 0 56px;
  display: grid;
  gap: 32px;
}

.hero-grid {
  display: grid;
  gap: 32px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: center;
}

.hero-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
}

.hero-card h2 {
  font-size: clamp(2rem, 2.7vw, 2.8rem);
  margin-top: 0;
}

.hero-card p {
  color: var(--muted);
  margin-bottom: 24px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 12px 28px rgba(29, 125, 95, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(29, 125, 95, 0.3);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.stats {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-card {
  background: var(--surface);
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.stat-card h3 {
  margin: 0;
  font-size: 1.6rem;
  color: var(--primary);
}

.stat-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

.section {
  padding: 56px 0;
}

.section h2 {
  margin-top: 0;
  font-size: 1.8rem;
}

.section p {
  color: var(--muted);
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}
.cave-hero {
  display: grid;
  gap: 20px;
}

.cave-hero-header {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
  justify-content: space-between;
}

.cave-hero h2 {
  margin-bottom: 8px;
}

.cave-location {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

.cave-meta {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  min-width: min(360px, 100%);
}

.meta-card {
  background: rgba(29, 125, 95, 0.08);
  border: 1px solid rgba(29, 125, 95, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

.meta-card span {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

meta-card strong {
  display: block;
  font-size: 1.1rem;
  color: var(--text);
}

.cave-description {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text);
}

.map-shell {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  min-height: 380px;
}

.map-shell.large {
  min-height: 680px;
}
.map-shell.map-wrapper {
  position: relative;
}

.map-shell .map-toolbar {
  position: relative;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 4px;
}

.map-shell .map-search {
  position: relative;
  width: min(240px, 100%);
  order: 2;
  margin-left: auto;
}


.map-shell .map-search .search-input {
  font-size: 0.9rem;
  padding-right: 36px;
  box-shadow: var(--shadow);
}

.map-shell .map-search .search-button {
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
}

.map-shell .map-search .search-results {
  max-height: 240px;
}

.map-shell .map-search .search-result {
  background: transparent;
  border: none;
  text-align: left;
  width: 100%;
  cursor: pointer;
  color: inherit;
}

.map-shell.map-wrapper .map-canvas {
  height: 100%;
  min-height: inherit;
  width: 100%;
  flex: 1;
}

.map-shell.map-wrapper .map-notice {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  max-width: min(90%, 420px);
  text-align: center;
  box-shadow: var(--shadow);
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid rgba(245, 176, 65, 0.65);
  font-weight: 600;
  font-size: 1rem;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.9);
}
.map-shell.map-wrapper .map-legend {
  position: relative;
  z-index: 1;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  font-size: 0.95rem;
  color: var(--text);
  width: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.map-legend-inline {
  display: inline-flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 16px;
  width: auto;
  max-width: 220px;
}
.map-legend h3 {
  margin: 0;
  font-size: 0.95rem;
}
.map-legend ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 16px;
}
.map-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.map-legend .legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid;
  flex-shrink: 0;
}
.map-legend .legend-swatch.is-verified {
  background: #1d7d5f;
  border-color: #0f4c3a;
}
.map-legend .legend-swatch.is-unverified {
  background: #f28c28;
  border-color: #b36212;
}
.map-shell .leaflet-container,
.map-shell .leaflet-pane,
.map-shell .leaflet-control {
  z-index: 1;
}
.map-shell .leaflet-control-layers {
  max-width: 220px;
  font-size: 0.9rem;
}

.map-shell .leaflet-control-layers-expanded {
  max-height: 240px;
  overflow-y: auto;
}
map-shell .leaflet-control-layers .leaflet-control-layers-list {
  display: block;
}
map-shell .leaflet-control-layers .leaflet-control-layers-toggle {
  display: none;
}
.logos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}

.logo-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 16px;
  text-align: center;
  display: grid;
  gap: 12px;
  justify-items: center;
}

.logo-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(29, 125, 95, 0.12);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.2rem;
}

.grid-two {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.list {
  display: grid;
  gap: 12px;
}
.list--two-columns {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.list-item {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border);
  display: grid;
  gap: 6px;
}
.list-item-link {
  text-decoration: none;
  color: inherit;
}

.list-item-link:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}
.list-item strong {
  font-size: 1.05rem;
}
.search-page-header {
  display: grid;
  gap: 6px;
  margin-bottom: 20px;
}

.search-meta {
  margin: 0;
  color: var(--muted);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(29, 125, 95, 0.1);
  color: var(--primary-dark);
}

.footer {
  padding: 32px 0 48px;
  color: var(--muted);
}

.detail-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.detail-sections {
  display: grid;
  gap: 28px;
}

.detail-section {
  display: grid;
  gap: 16px;
}
.detail-subsections {
  display: grid;
  gap: 20px;
}

.detail-subsection {
  display: grid;
  gap: 12px;
}

.detail-subsection-title {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
}

.detail-section h3 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--text);
  padding-left: 12px;
  border-left: 4px solid rgba(29, 125, 95, 0.3);
}
.detail-card {
  background: linear-gradient(
    135deg,
    rgba(29, 125, 95, 0.08),
    rgba(255, 255, 255, 0.92)
  );
  border-radius: var(--radius-md);
  padding: 16px 18px;
  border: 1px solid rgba(29, 125, 95, 0.15);
  box-shadow: 0 10px 24px rgba(10, 30, 26, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.detail-card--media {
  gap: 12px;
}

.detail-media {
  margin: 0;
  display: grid;
  gap: 10px;
}

.detail-media img {
  width: 100%;
  height: auto;
  border-radius: calc(var(--radius-md) - 4px);
  border: 1px solid rgba(29, 125, 95, 0.15);
  background: #fff;
}
.bibliography-hero {
  display: grid;
  gap: 24px;
}

.bibliography-search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid rgba(29, 125, 95, 0.18);
  box-shadow: 0 14px 30px rgba(10, 30, 26, 0.12);
}

.bibliography-search__icon {
  font-size: 1.2rem;
}

.bibliography-search input {
  flex: 1;
  border: none;
  font-size: 1rem;
  background: transparent;
  outline: none;
}

.bibliography-search .btn {
  padding: 10px 20px;
}

.bibliography-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.bibliography-page-header .search-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.pagination {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.pagination-button {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}

.pagination-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.pagination-button.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.pagination-ellipsis {
  color: var(--muted);
  padding: 0 4px;
}
.detail-media figcaption {
  font-size: 0.9rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.detail-link {
  font-size: 0.98rem;
  color: var(--primary-dark);
  text-decoration: underline;
  overflow-wrap: anywhere;
}
.detail-card h4 {
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--primary-dark);
}

.detail-card p {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}
.detail-card--wide {
  grid-column: 1 / -1;
}
.detail-section--rilievi {
  padding: 18px;
  border-radius: var(--radius-md);
  background: #f7faf9;
  border: 1px solid rgba(29, 125, 95, 0.12);
  box-shadow: 0 12px 26px rgba(10, 30, 26, 0.08);
}

.detail-section--rilievi h3 {
  padding-left: 0;
  border-left: none;
  font-size: 1.25rem;
  color: var(--primary-dark);
}

.detail-section--rilievi .detail-subsection {
  padding: 12px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid rgba(29, 125, 95, 0.1);
}

.detail-section--rilievi .detail-card {
  background: #ffffff;
  border: 1px solid rgba(29, 125, 95, 0.1);
  box-shadow: 0 8px 18px rgba(10, 30, 26, 0.08);
}
.rilievi-notice {
  margin-top: 12px;
}

.nav-auth {
  margin-left: 8px;
}

.auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 24, 22, 0.55);
  display: none;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 80;
}

.auth-modal.is-open {
  display: grid;
  opacity: 1;
  pointer-events: auto;
}

.auth-modal__panel {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 24px;
  width: min(440px, 92vw);
  box-shadow: 0 24px 60px rgba(10, 30, 26, 0.25);
  position: relative;
}

.auth-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
}

.auth-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.auth-tab {
  border: 1px solid rgba(29, 125, 95, 0.2);
  background: #f7faf9;
  border-radius: 999px;
  padding: 6px 16px;
  cursor: pointer;
  font-weight: 600;
  color: var(--primary-dark);
}

.auth-tab.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.auth-form {
  display: none;
  gap: 12px;
}

.auth-form.is-active {
  display: grid;
}

.auth-form label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  color: var(--text);
}

.auth-form input {
  border: 1px solid rgba(29, 125, 95, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.95rem;
}

.auth-form__message {
  margin: 0;
  min-height: 1.2em;
  font-size: 0.9rem;
  color: #b24b2d;
}

.auth-form__message.is-success {
  color: var(--primary-dark);
}

.detail-media__button {
  border: none;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
}

.detail-media img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  border-radius: calc(var(--radius-md) - 4px);
  border: 1px solid rgba(29, 125, 95, 0.15);
  background: #fff;
  box-shadow: 0 6px 16px rgba(10, 30, 26, 0.08);
}
.bibliography-list {
  display: grid;
  border-top: 1px solid rgba(29, 125, 95, 0.15);
}

.bibliography-item {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) 220px 140px;
  gap: 16px;
  padding: 18px 4px;
  border-bottom: 1px solid rgba(29, 125, 95, 0.12);
  align-items: center;
}

.bibliography-year {
  font-weight: 600;
  color: var(--text);
}

.bibliography-title {
  color: var(--text);
  line-height: 1.5;
}

.bibliography-author {
  font-weight: 600;
  color: var(--primary-dark);
  text-transform: uppercase;
}

.bibliography-view {
  justify-self: end;
  color: var(--primary-dark);
  font-weight: 600;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
}

@media (max-width: 900px) {
  .bibliography-item {
    grid-template-columns: 70px minmax(0, 1fr);
    grid-template-rows: auto auto;
  }

  .bibliography-author {
    grid-column: 1 / -1;
    text-transform: none;
    font-weight: 500;
  }

  .bibliography-view {
    grid-column: 1 / -1;
    justify-self: start;
  }
}
@media (max-width: 700px) {
  .bibliography-search {
    flex-direction: column;
    align-items: stretch;
    border-radius: var(--radius-md);
  }

  .bibliography-search .btn {
    width: 100%;
    justify-content: center;
  }
}
.bibliography-modal {
  position: fixed;
  inset: 0;
  background: rgba(12, 22, 18, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
}

.bibliography-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.bibliography-modal__dialog {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 28px;
  width: min(720px, 100%);
  position: relative;
  box-shadow: 0 18px 40px rgba(10, 30, 26, 0.25);
}

.bibliography-modal__close {
  border: none;
  background: transparent;
  font-size: 28px;
  position: absolute;
  top: 12px;
  right: 16px;
  cursor: pointer;
  color: var(--text);
}

.bibliography-modal__content h3 {
  margin: 0 0 16px;
  font-size: 20px;
  color: var(--primary-dark);
}
.bibliography-cover {
  margin: 0 0 16px;
  display: flex;
  justify-content: center;
}

.bibliography-cover__button {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(10, 30, 26, 0.15);
}

.bibliography-cover__button img {
  width: 120px;
  height: auto;
  display: block;
  border-radius: 12px;
}

.bibliography-modal__list {
  margin: 0;
  display: grid;
  gap: 12px;
}

.bibliography-modal__item {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(29, 125, 95, 0.12);
}

.bibliography-modal__item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.bibliography-modal__item dt {
  font-weight: 600;
  color: var(--primary-dark);
}

.bibliography-modal__item dd {
  margin: 0;
  color: var(--text);
}

.bibliography-modal__empty {
  margin: 0;
  color: var(--muted);
}
.bibliography-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.bibliography-page {
  border-radius: 999px;
  border: 1px solid rgba(29, 125, 95, 0.2);
  padding: 6px 12px;
  background: #ffffff;
  color: var(--primary-dark);
  cursor: pointer;
  font-weight: 600;
}

.bibliography-page.is-active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

@media (max-width: 700px) {
  .bibliography-modal__dialog {
    padding: 20px;
  }

  .bibliography-modal__item {
    grid-template-columns: 1fr;
  }
}
.image-modal {
  position: fixed;
  inset: 0;
  background: rgba(12, 22, 18, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
}

.image-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.image-modal__dialog {
  position: relative;
  max-width: min(960px, 90vw);
  max-height: 90vh;
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 18px 18px 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  display: grid;
  gap: 12px;
}

.image-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: rgba(29, 125, 95, 0.1);
  color: var(--primary-dark);
  border-radius: 999px;
  width: 36px;
  height: 36px;
  font-size: 1.4rem;
  cursor: pointer;
}

.image-modal__content {
  display: grid;
  place-items: center;
  max-height: 70vh;
  overflow: auto;
}

.image-modal__image {
  max-width: 100%;
  height: auto;
  border-radius: calc(var(--radius-md) - 6px);
}

.image-modal__caption {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  text-align: center;
  word-break: break-word;
}

.notice {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(245, 176, 65, 0.15);
  border: 1px solid rgba(245, 176, 65, 0.35);
}
.notice-success {
  background: rgba(39, 174, 96, 0.15);
  border-color: rgba(39, 174, 96, 0.35);
  color: #1f7a44;
}

.notice-error {
  background: rgba(192, 57, 43, 0.12);
  border-color: rgba(192, 57, 43, 0.35);
  color: #8e2a1d;
}
.admin-title {
  margin-bottom: 24px;
}

.admin-shell {
  display: block;
  margin-top: 16px;
}
.admin-auth-present [data-admin-login] {
  display: none !important;
}

.admin-auth-present [data-admin-dashboard] {
  display: block !important;
}
.admin-hero {
  padding-bottom: 24px;
}

.admin-grid {
  display: grid;
  gap: 24px;
}

.admin-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.admin-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.admin-note {
  margin: 0;
  color: var(--muted);
}

.admin-form {
  display: grid;
  gap: 12px;
}
.admin-form .field {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

.admin-form .input {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  font-weight: 400;
}

.admin-form .input:focus {
  outline: 2px solid rgba(52, 152, 219, 0.35);
  border-color: rgba(52, 152, 219, 0.55);
}
.admin-form .btn {
  justify-self: flex-start;
}

.admin-table {
  display: grid;
  gap: 8px;
}

.admin-stats {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.admin-stat {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(46, 204, 113, 0.08);
  border: 1px solid rgba(46, 204, 113, 0.2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-stat__label {
  font-size: 0.9rem;
  color: var(--muted);
}

.admin-stat__value {
  font-size: 1.4rem;
  font-weight: 600;
}

.admin-table__row {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.9fr 1fr 1.2fr;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--gray-100);
}

.admin-table__head {
  font-weight: 600;
  background: var(--gray-200);
}

.admin-username {
  font-weight: 600;
}

.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-pagination {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-pagination .btn[aria-current="page"] {
  background: rgba(29, 125, 95, 0.1);
  border-color: rgba(29, 125, 95, 0.3);
  color: var(--primary-dark);
}
.admin-password {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
}

.admin-empty {
  margin: 0;
  color: var(--muted);
}

.btn-danger {
  border-color: rgba(192, 57, 43, 0.5);
  color: #8e2a1d;
}

.btn-danger:hover {
  background: rgba(192, 57, 43, 0.08);
}

.switch {
  position: relative;
  display: inline-flex;
  width: 52px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #ff4d4d;
  border-radius: 999px;
  transition: 0.2s ease;
  box-shadow:
    inset 0 0 0 1px rgba(255, 77, 77, 0.35),
    inset 0 2px 6px rgba(0, 0, 0, 0.12);
}

.slider::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  top: 3px;
  background: #f4f4f4;
  border-radius: 50%;
  transition: 0.2s ease;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.28);
}

.switch input:checked + .slider {
  background: #2ecc71;
  box-shadow:
    inset 0 0 0 1px rgba(46, 204, 113, 0.4),
    inset 0 2px 6px rgba(0, 0, 0, 0.12);
}

.switch input:checked + .slider::before {
  transform: translateX(24px);
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--muted);
}

@media (max-width: 960px) {
  .admin-table__row {
    grid-template-columns: 1fr;
  }

  .admin-table__head {
    display: none;
  }
}
@media (max-width: 720px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero {
    padding-top: 48px;
  }

  .hero-card {
    padding: 24px;
  }

  .nav {
    width: 100%;
  }
}