:root {
  color-scheme: dark;
  --bg: #07131f;
  --card: #10253a;
  --card-2: #163250;
  --text: #f5f7fa;
  --muted: #9eb4c8;
  --accent: #31d2c9;
  --accent-2: #ff8c42;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: linear-gradient(135deg, var(--bg), #0b1d2d);
  color: var(--text);
  min-height: 100vh;
}
.shell,
.dashboard {
  display: grid;
  gap: 1.5rem;
  padding: 2rem;
}
.site-header {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 10;
}
.site-logo {
  width: 140px;
  max-width: 100%;
  display: block;
}
.platform-links {
  display: grid;
  gap: 0.8rem;
  margin-top: 1.2rem;
}
.platform-links a {
  display: inline-flex;
  justify-content: center;
  width: 100%;
}
.mobile-card {
  max-width: 420px;
  margin: 0 auto;
}
.mobile-note {
  color: var(--muted);
  margin-bottom: 1rem;
}
.shell {
  min-height: 100vh;
  place-items: center;
  padding-top: 6rem;
}
.card {
  background: rgba(16, 37, 58, 0.94);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
}
auth-card { }
.brand h1,
.topbar h1 {
  margin: 0 0 0.3rem;
}
.eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.3rem;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.2rem;
}
.tabs {
  display: flex;
  gap: 0.8rem;
  margin: 1rem 0;
}
.tab-button,
.primary-btn,
.secondary-btn {
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-weight: 600;
}
.tab-button {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(255,255,255,0.1);
}
.tab-button.active {
  background: var(--accent);
  color: #042029;
}
.primary-btn {
  background: var(--accent);
  color: #042029;
}
.secondary-btn {
  background: var(--card-2);
  color: var(--text);
}
.auth-form,
.stacked-form {
  display: grid;
  gap: 0.9rem;
}
label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.95rem;
}
input,
select,
textarea {
  width: 100%;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: var(--bg);
  color: var(--text);
}
.hidden {
  display: none;
}
.message {
  min-height: 1.3rem;
  margin-top: 0.8rem;
  color: var(--accent);
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 2rem 0;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
#user-badge {
  background: rgba(49,210,201,0.16);
  color: var(--accent);
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
}
.dashboard {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  align-items: start;
}
.checklist {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.7rem;
}
.checklist li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: rgba(255,255,255,0.04);
  padding: 0.8rem;
  border-radius: 12px;
}
.search-row {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.results,
.monitor-list,
.activity-log,
.instructions-list,
.editor-grid {
  display: grid;
  gap: 0.8rem;
}
.result-item,
.monitor-item,
.activity-item,
.instruction-card,
.editor-card {
  background: rgba(255,255,255,0.04);
  border-radius: 14px;
  padding: 0.9rem;
}
.catalog-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.catalog-item {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
}
.catalog-photo {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
}
.catalog-photo-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.7rem;
  text-align: center;
  background: rgba(255,255,255,0.06);
}
.table {
  overflow-x: auto;
}
.table table {
  width: 100%;
  border-collapse: collapse;
}
.table th,
.table td {
  padding: 0.7rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-align: left;
}
.small-btn {
  padding: 0.35rem 0.6rem;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  margin-left: 0.4rem;
}
.small-btn.delete {
  background: rgba(255,107,107,0.2);
  color: #ffb3b3;
}
.small-btn.edit {
  background: rgba(49,210,201,0.2);
  color: var(--accent);
}
.map-floor-title {
  margin: 0 0 0.6rem;
  color: var(--muted);
}
.map-container {
  position: relative;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
}
.map-image {
  display: block;
  width: 100%;
  height: auto;
}
.map-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #2f7bff;
  border: 2px solid rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.map-marker-label {
  font-size: 0.55rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.map-marker.active {
  width: 26px;
  height: 26px;
  background: #2f7bff;
  border-color: #fff;
  box-shadow: 0 0 0 6px rgba(47,123,255,0.35);
  z-index: 2;
}
.map-marker.active .map-marker-label {
  font-size: 0.65rem;
}
.card.wide {
  grid-column: 1 / -1;
}
.access-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.access-head h2 {
  margin-top: 0;
}
.access-mode,
.access-filters {
  flex-wrap: wrap;
}
.access-mode {
  margin: 0;
}
.access-login {
  grid-template-columns: 1fr auto;
  max-width: 480px;
}
.tab-button .count {
  display: inline-block;
  min-width: 1.4rem;
  margin-left: 0.3rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  font-size: 0.8rem;
}
.access-table td {
  vertical-align: top;
}
.access-table tr.is-online {
  background: rgba(49,210,201,0.05);
}
.muted {
  color: var(--muted);
  font-size: 0.85rem;
}
.presence {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 0.4rem;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
}
.presence.on {
  background: #3ddc84;
  box-shadow: 0 0 0 3px rgba(61,220,132,0.2);
}
.presence.trying {
  background: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(255,140,66,0.2);
}
.access-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}
.access-badge.allowed { background: rgba(61,220,132,0.18); color: #7ef0b0; }
.access-badge.blocked { background: rgba(255,107,107,0.2); color: #ffb3b3; }
.access-badge.pending { background: rgba(255,140,66,0.2); color: #ffc29a; }
.access-badge.open { background: rgba(255,255,255,0.08); color: var(--muted); }
.access-badge.trusted { background: rgba(49,210,201,0.18); color: var(--accent); }
.you-tag {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--accent);
  color: #042029;
}
.access-actions {
  white-space: nowrap;
}
.access-actions .small-btn {
  margin: 0 0.3rem 0.3rem 0;
}
.small-btn {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}
.small-btn.warn {
  background: rgba(255,140,66,0.2);
  color: #ffc29a;
}
.access-history {
  margin-top: 1rem;
}
.access-history summary {
  cursor: pointer;
  color: var(--muted);
  margin-bottom: 0.8rem;
}
@media (max-width: 700px) {
  .access-login {
    grid-template-columns: 1fr;
  }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
  }
  .search-row {
    flex-direction: column;
  }
}

/* Botón del logo araña (esquina superior derecha, solo admin) */
.spider-btn {
  position: fixed;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 100;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: block;
  transition: transform 0.15s, box-shadow 0.15s;
}
.spider-btn img {
  width: 100%;
  height: 100%;
  display: block;
}
.spider-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 12px rgba(220, 20, 30, 0.7);
}
body:has(.spider-btn) .topbar {
  padding-right: 4.5rem;
}
