:root {
  --bg: #f6f9f5;
  --card: #ffffff;
  --ink: #202822;
  --ink-soft: #64705f;
  --accent: #0a5532;
  --accent-dark: #073d24;
  --accent-soft: #e7efe9;
  --accent-ink: #ffffff;
  --border: #e1e8dd;
  --ok: #1f7a45;
  --ok-bg: #e3f1e8;
  --pending: #b8842a;
  --pending-bg: #fbf0dd;
  --done: #7c8579;
  --done-bg: #eef0ec;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(10, 40, 25, 0.05), 0 4px 12px rgba(10, 40, 25, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131a15;
    --card: #1c261e;
    --ink: #edf3ec;
    --ink-soft: #a5b3a0;
    --accent: #3f9c6c;
    --accent-dark: #2c7350;
    --accent-soft: #1e2f22;
    --border: #2b3a2e;
    --ok-bg: #1c3324;
    --pending-bg: #332a15;
    --done-bg: #28312a;
    --shadow: 0 1px 2px rgba(0,0,0,0.2), 0 4px 14px rgba(0,0,0,0.28);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.4;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: var(--radius);
  padding: 26px 24px;
  box-shadow: var(--shadow);
}

header.top h1 {
  font-size: 1.6rem;
  margin: 0;
  color: #ffffff;
  letter-spacing: -0.01em;
}

header.top p {
  margin: 5px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.92rem;
}

.hero-link {
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.55);
  padding: 9px 16px;
  border-radius: 10px;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.hero-link:hover {
  background: rgba(255, 255, 255, 0.14);
}

.legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.legend-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  box-shadow: var(--shadow);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.legend-dot.disponible { background: var(--ok); }
.legend-dot.en_proceso { background: var(--pending); }
.legend-dot.entregado { background: var(--done); }

.legend-item strong {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 2px;
}

.legend-item span {
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.35;
}

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

.search-bar input[type="search"] {
  flex: 2;
  min-width: 220px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
  font-size: 0.92rem;
  font-family: inherit;
}

.search-bar select {
  flex: 1;
  min-width: 180px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
  font-size: 0.9rem;
  font-family: inherit;
}

.cat-tag {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--ink-soft);
  background: var(--accent-soft);
  padding: 3px 9px;
  border-radius: 999px;
  width: fit-content;
}

.demo-banner {
  background: var(--pending-bg);
  color: var(--pending);
  border: 1px solid var(--pending);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.filters button {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
}

.filters button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

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

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.grid .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(10, 40, 25, 0.07), 0 8px 20px rgba(10, 40, 25, 0.1);
}

.card .thumb {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 10px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  overflow: hidden;
}

.card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card h3 {
  margin: 0;
  font-size: 1rem;
}

.card .meta {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  width: fit-content;
}

.badge.disponible { background: var(--ok-bg); color: var(--ok); }
.badge.en_proceso { background: var(--pending-bg); color: var(--pending); }
.badge.entregado { background: var(--done-bg); color: var(--done); }

button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s ease;
}

button.primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

button.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 0.9rem;
  cursor: pointer;
}

button.danger {
  background: transparent;
  color: #c0392b;
  border: 1px solid #c0392b;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 0.9rem;
  cursor: pointer;
}

button.danger:hover:not(:disabled) {
  background: #c0392b;
  color: #ffffff;
}

button.danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 60px 20px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal h2 {
  margin: 0;
  font-size: 1.1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.field input, .field select, .field textarea {
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  font-size: 0.95rem;
  font-family: inherit;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}

footer.foot {
  text-align: center;
  margin-top: 40px;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

footer.foot a { color: var(--ink-soft); }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  z-index: 60;
}

.staff-list .card { flex-direction: row; align-items: center; flex-wrap: wrap; }
.staff-list .card .info { flex: 1; min-width: 160px; }
.staff-list .card .thumb { width: 60px; aspect-ratio: 1; font-size: 1.4rem; }
.staff-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.passcode-gate {
  max-width: 320px;
  margin: 80px auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.claims-note {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-top: 4px;
}
