:root {
  --verde: #00b86b;
  --verde-dark: #00824b;
  --oscuro: #0e1413;
  --gris: #586068;
  --borde: #e7ecea;
  --bg: #f6f8f7;
  color-scheme: light;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Inter, sans-serif;
  background: var(--bg);
  color: var(--oscuro);
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  background: #fff;
  border-bottom: 1px solid var(--borde);
  position: sticky;
  top: 0;
  z-index: 5;
}
header h1 { font-size: 18px; margin: 0; }
header .tag { color: var(--gris); font-size: 13px; }
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13px;
}
button.primary { background: var(--verde); color: #04140d; }
button.dark { background: var(--oscuro); color: #fff; }
button.ghost { background: transparent; border: 1px solid var(--borde); color: var(--oscuro); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
input, select {
  font-family: inherit;
  padding: 7px 10px;
  border: 1px solid var(--borde);
  border-radius: 8px;
  font-size: 13px;
}
main { max-width: 1300px; margin: 0 auto; padding: 24px 28px 80px; }
.filtros { display: flex; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.page-tabs { display: inline-flex; background: #eef1f0; border-radius: 10px; padding: 3px; gap: 2px; }
.page-tab {
  background: transparent; border: none; border-radius: 8px; padding: 7px 14px;
  font-size: 13px; font-weight: 600; color: var(--gris); cursor: pointer;
}
.page-tab.active { background: #fff; color: var(--oscuro); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.card {
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.card img { width: 100%; display: block; background: #eee; aspect-ratio: 4/5; object-fit: cover; }
.card .body { padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.card .id { font-family: monospace; font-size: 11px; color: var(--gris); word-break: break-all; }
.card .verBtn { align-self: stretch; }
.badge {
  display: inline-flex; align-self: flex-start;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 100px;
}
.badge.creado { background: #eef1f0; color: var(--gris); }
.badge.programado { background: #fff4d6; color: #8a6d00; }
.badge.publicado { background: #eafaf0; color: var(--verde-dark); }
.row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.meta { font-size: 12px; color: var(--gris); }
#actividad {
  margin-top: 40px; background: #fff; border: 1px solid var(--borde); border-radius: 14px; padding: 16px 20px;
}
#actividad h2 { font-size: 14px; margin: 0 0 10px; }
#actividad pre { font-size: 11px; max-height: 240px; overflow-y: auto; margin: 0; white-space: pre-wrap; color: var(--gris); }
.overlay {
  display: none; position: fixed; inset: 0; background: rgba(14,20,19,0.55);
  align-items: center; justify-content: center; z-index: 50; padding: 24px;
}
.overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: 16px; max-width: 920px; width: 100%;
  max-height: 90vh; overflow-y: auto; position: relative; padding: 20px 24px 28px;
}
.modal .closeBtn { position: absolute; top: 14px; right: 14px; }
.modal-grid { display: grid; grid-template-columns: 300px 1fr; gap: 24px; margin-top: 10px; }
.modal-preview img { width: 100%; border-radius: 10px; background: #eee; display: block; }
.modal-detail { display: flex; flex-direction: column; gap: 4px; }
.modal-detail .id { font-family: monospace; font-size: 12px; color: var(--gris); }
.section { border-top: 1px solid var(--borde); padding-top: 14px; margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.section h3 { font-size: 13px; margin: 0; color: var(--oscuro); }
.section textarea {
  font-family: inherit; font-size: 13px; padding: 10px; border: 1px solid var(--borde);
  border-radius: 8px; resize: vertical; width: 100%;
}
@media (max-width: 700px) {
  .modal-grid { grid-template-columns: 1fr; }
}
/* ══════ LOGIN (split, estilo CRM) ══════ */
#login-screen { position: fixed; inset: 0; background: #fff; display: flex; }
.login-split { display: flex; width: 100%; }
.login-left { flex: 1 1 50%; position: relative; overflow: hidden; background: #04130d; order: 2; }
.login-left .ruins-art { position: absolute; inset: 0; }
.login-left .ruins-art svg { width: 100%; height: 100%; }
.login-left .ruins-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(2,30,20,.50) 0%, rgba(2,26,18,.66) 55%, rgba(1,16,11,.82) 100%);
}
.login-left .ruins-logo {
  position: absolute; top: 46px; left: 52px; z-index: 3;
  height: 30px; width: auto; filter: brightness(0) invert(1);
}
.ruins-content {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; padding: 56px; color: #fff;
}
.ruins-content .rc-eyebrow {
  font-size: 11.5px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  color: var(--verde); margin-bottom: 16px; text-shadow: 0 1px 10px rgba(0,0,0,.45);
}
.ruins-content h2 {
  font-size: 38px; line-height: 1.12; font-weight: 800; letter-spacing: -.6px;
  max-width: 14ch; margin: 0 auto 18px; text-shadow: 0 2px 18px rgba(0,0,0,.5);
}
.ruins-content h2 em { font-style: normal; color: var(--verde); }
.ruins-content p {
  font-size: 15px; line-height: 1.65; color: rgba(255,255,255,.9);
  max-width: 40ch; margin: 0 auto; text-shadow: 0 1px 12px rgba(0,0,0,.45);
}
.ruins-content .rc-loc {
  display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 30px;
  font-size: 12px; color: rgba(255,255,255,.75);
}
.login-right {
  flex: 1 1 50%; order: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 40px; background: #fff;
}
.login-box { width: 100%; max-width: 360px; }
.login-logo { text-align: center; margin-bottom: 34px; }
.login-logo .brand-logo { height: 34px; width: auto; display: block; margin: 0 auto 22px; }
.login-logo h1 { font-size: 25px; font-weight: 600; letter-spacing: -.5px; color: var(--oscuro); }
.login-logo p { font-size: 14px; color: var(--gris); margin-top: 8px; line-height: 1.5; }
.login-field { margin-bottom: 16px; }
.login-field label {
  display: block; font-size: 12.5px; font-weight: 500; color: var(--oscuro); margin-bottom: 7px;
}
.login-field input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--borde);
  border-radius: 8px; font-size: 14px; font-family: inherit;
  color: var(--oscuro); outline: none; transition: border-color .15s, box-shadow .15s;
  background: #fff;
}
.login-field input:focus { border-color: var(--verde); box-shadow: 0 0 0 3px rgba(0,184,107,.13); }
.login-error { font-size: 12.5px; color: #dc2626; text-align: center; min-height: 18px; margin: 10px 0 2px; }
.login-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px; background: var(--verde-dark); color: #fff;
  border: none; border-radius: 8px; font-size: 14.5px; font-weight: 600;
  cursor: pointer; margin-top: 8px; transition: background .15s; font-family: inherit;
}
.login-btn:hover { background: #006b3e; }
.login-btn:active { transform: scale(.99); }
.login-btn svg { transition: transform .15s; }
.login-btn:hover svg { transform: translateX(3px); }
@media (max-width: 860px) {
  .login-left { display: none; }
  .login-right { flex: 1 1 100%; }
}
