:root {
  --verde-oscuro: #054924;
  --verde: #0f7a3d;
  --verde-hover: #0b5f2f;
  --verde-claro: #e5f3ea;
  --verde-texto: #054924;
  --pasillo-claro: #fdf1e2;
  --pasillo-texto: #a15c07;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f4f6f4;
  color: #1f2430;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.85rem 1.5rem;
  background: white;
  border-bottom: 3px solid var(--verde-oscuro);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.marca {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.topbar h1 {
  font-size: 1.3rem;
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--verde-oscuro);
}

.marca-num {
  font-weight: 400;
  opacity: 0.75;
}

.marca-agua {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9aa89f;
}

.pie {
  text-align: center;
  padding: 1.5rem 1rem 2rem;
  font-size: 0.75rem;
  color: #9aa89f;
  letter-spacing: 0.03em;
}

.btn {
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 1px solid #d0d3d9;
  background: white;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.15s ease;
}

.btn:hover {
  background: #f0f1f3;
}

.btn-primary {
  background: var(--verde);
  border-color: var(--verde);
  color: white;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--verde-hover);
}

.btn-danger {
  color: #c62828;
  border-color: #f1b3b3;
}

.btn-danger:hover {
  background: #fdecec;
}

.toolbar {
  display: flex;
  gap: 0.75rem;
  padding: 1.1rem 1.5rem;
  flex-wrap: wrap;
}

.toolbar input,
.toolbar select {
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #cfd6d1;
  font-size: 16px;
  background: white;
}

.toolbar input:focus,
.toolbar select:focus {
  outline: 2px solid var(--verde);
  outline-offset: -1px;
}

#buscador {
  flex: 1;
  min-width: 220px;
}

.galeria {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  padding: 0 1.5rem 2rem;
}

.tarjeta {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s ease;
}

.tarjeta:hover {
  box-shadow: 0 4px 14px rgba(11, 61, 36, 0.15);
}

.tarjeta .foto-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #e9eaed;
  cursor: zoom-in;
  overflow: hidden;
}

.tarjeta .foto-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tarjeta .info {
  padding: 0.75rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.tarjeta .etiquetas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tarjeta .categoria,
.tarjeta .pasillo {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.72rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-weight: 600;
}

.tarjeta .categoria {
  background: var(--verde-claro);
  color: var(--verde-texto);
}

.tarjeta .pasillo {
  background: var(--pasillo-claro);
  color: var(--pasillo-texto);
}

.tarjeta .nombre {
  font-weight: 700;
  font-size: 1.15rem;
  color: #12181f;
  margin: 0.35rem 0 0;
}

.tarjeta .fecha {
  font-size: 0.8rem;
  color: #6b7280;
}

.tarjeta .acciones {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.tarjeta .acciones .btn {
  flex: 1;
  padding: 0.4rem;
  font-size: 0.85rem;
}

.vacio {
  text-align: center;
  color: #6b7280;
  padding: 3rem 1rem;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 30, 20, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}

.overlay[hidden] {
  display: none;
}

.modal {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-small {
  max-width: 320px;
}

.modal h2 {
  margin-top: 0;
  color: var(--verde-oscuro);
}

.modal form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.modal label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.modal input[type="text"],
.modal input[type="search"],
.modal input:not([type="file"]):not([type="hidden"]) {
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid #cfd6d1;
  font-size: 16px;
}

.modal input:focus {
  outline: 2px solid var(--verde);
  outline-offset: -1px;
}

.preview {
  margin-top: 0.5rem;
  max-width: 100%;
  max-height: 180px;
  border-radius: 8px;
  object-fit: contain;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.error {
  color: #c62828;
  font-size: 0.85rem;
}

.hint {
  color: #6b7280;
  font-size: 0.85rem;
  margin-top: -0.5rem;
}

#lightbox {
  cursor: zoom-out;
}

#lightbox img {
  max-width: 95vw;
  max-height: 95vh;
  border-radius: 8px;
}
