/* Piel de Atrium para la lista de espacios del Dashboard de SilverBullet (pantalla 02, paleta A).
   Caddy la inyecta en /.dashboard; espacios.js arma la pantalla solo en la lista (/.dashboard/)
   y deja las demás páginas del Dashboard (perfil, administración) como están. */

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/.atrium/fuentes/ibm-plex-sans-variable.woff2") format("woff2");
  font-weight: 100 700;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/.atrium/fuentes/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

body.atr-espacios {
  --atr-fondo: #ffffff;
  --atr-lateral: #f7f7f5;
  --atr-borde: #e9e9e7;
  --atr-borde-suave: #efefed;
  --atr-borde-control: #e3e3e1;
  --atr-borde-hover: #c9c9c6;
  --atr-hover: #ededeb;
  --atr-texto: #191919;
  --atr-suave: #4a4a47;
  --atr-tenue: #4a4a47;
  --atr-pie: #6b6b68;
  --atr-acento: #2b5fd9;
  --atr-acento-hover: #1e46a8;
  --atr-acento-suave: #e3ebfb;
  --atr-gris-suave: #ededeb;
  --atr-avatar: #dcd7cf;
  --atr-error: #b42318;
  --atr-error-suave: #fdecea;
  --atr-sombra-hover: 0 2px 10px rgba(25, 25, 25, 0.06);
  --atr-velo: rgba(25, 25, 25, 0.32);
  /* Hues of the redesign for icons and activity dots. */
  --atr-azul: #2b5fd9;
  --atr-naranja: #c2410c;
  --atr-morado: #6d4ac2;
  --atr-turquesa: #0f7a6e;
  --atr-rosa: #b4235a;
  --atr-verde: #25643f;
  --atr-gris: #4a4a47;
  --atr-amarillo: #b07a12;
  --atr-rojo: #a3330e;

  min-height: 100vh;
  background: var(--atr-fondo);
  color: var(--atr-texto);
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  color-scheme: light;
}

/* Dark mode: D12 values, following the system unless SilverBullet sets a theme. */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) body.atr-espacios {
    --atr-fondo: #191919;
    --atr-lateral: #202020;
    --atr-borde: #2f2f2d;
    --atr-borde-suave: #2a2a28;
    --atr-borde-control: #3a3a38;
    --atr-borde-hover: #4a4a47;
    --atr-hover: #2c2c2b;
    --atr-texto: #e6e6e4;
    --atr-suave: #c4c4c0;
    --atr-tenue: #c4c4c0;
    --atr-pie: #9b9b97;
    --atr-acento: #7ba3f0;
    --atr-acento-hover: #a3c0f6;
    --atr-acento-suave: #22324f;
    --atr-gris-suave: #2c2c2b;
    --atr-avatar: #3a3733;
    --atr-error: #f0a88e;
    --atr-error-suave: #3a2018;
    --atr-sombra-hover: none;
    --atr-velo: rgba(0, 0, 0, 0.55);
    --atr-azul: #7ba3f0;
    --atr-naranja: #f0a070;
    --atr-morado: #b9a3f0;
    --atr-turquesa: #6fcfc0;
    --atr-rosa: #f09ab9;
    --atr-verde: #8fd3a8;
    --atr-gris: #9b9b97;
    --atr-amarillo: #e3c06a;
    --atr-rojo: #f0a88e;
    color-scheme: dark;
  }
}
html[data-theme="dark"] body.atr-espacios {
  --atr-fondo: #191919;
  --atr-lateral: #202020;
  --atr-borde: #2f2f2d;
  --atr-borde-suave: #2a2a28;
  --atr-borde-control: #3a3a38;
  --atr-borde-hover: #4a4a47;
  --atr-hover: #2c2c2b;
  --atr-texto: #e6e6e4;
  --atr-suave: #c4c4c0;
  --atr-tenue: #c4c4c0;
  --atr-pie: #9b9b97;
  --atr-acento: #7ba3f0;
  --atr-acento-hover: #a3c0f6;
  --atr-acento-suave: #22324f;
  --atr-gris-suave: #2c2c2b;
  --atr-avatar: #3a3733;
  --atr-error: #f0a88e;
  --atr-error-suave: #3a2018;
  --atr-sombra-hover: none;
  --atr-velo: rgba(0, 0, 0, 0.55);
  --atr-azul: #7ba3f0;
  --atr-naranja: #f0a070;
  --atr-morado: #b9a3f0;
  --atr-turquesa: #6fcfc0;
  --atr-rosa: #f09ab9;
  --atr-verde: #8fd3a8;
  --atr-gris: #9b9b97;
  --atr-amarillo: #e3c06a;
  --atr-rojo: #f0a88e;
  color-scheme: dark;
}

/* SilverBullet centers its standalone pages in 720 px. */
body.sb-standalone.sb-page.atr-espacios {
  max-width: none;
  margin: 0;
  padding: 0;
  background: var(--atr-fondo);
  font-size: 14px;
}

/* SilverBullet's Dashboard stays mounted (it handles the session and logging out), hidden. */
body.atr-espacios #root {
  display: none;
}
body:not(.atr-espacios) .atr-pantalla {
  display: none;
}

.atr-pantalla {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.atr-pantalla *,
.atr-pantalla *::before,
.atr-pantalla *::after {
  box-sizing: border-box;
}
.atr-pantalla a {
  color: var(--atr-acento);
}
.atr-pantalla a:hover {
  color: var(--atr-acento-hover);
}
.atr-pantalla :focus-visible {
  outline: 2px solid var(--atr-acento);
  outline-offset: 2px;
}
.atr-pantalla code {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  background: none;
  padding: 0;
  color: inherit;
}
.atr-oculto {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- Header -------------------------------------------------------------- */

.atr-cabecera {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--atr-borde-suave);
}
.atr-marca {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--atr-texto);
  text-decoration: none;
}
.atr-pantalla a.atr-marca,
.atr-pantalla a.atr-marca:hover {
  color: var(--atr-texto);
}
.atr-marca svg {
  flex: none;
}
.atr-marca span {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.atr-acciones {
  display: flex;
  align-items: center;
  gap: 10px;
}
.atr-boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--atr-borde-control);
  background: var(--atr-fondo);
  color: var(--atr-texto);
  font: 500 14px/1 "IBM Plex Sans", system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
}
.atr-pantalla a.atr-boton,
.atr-pantalla a.atr-boton:hover {
  color: var(--atr-texto);
}
.atr-boton svg {
  flex: none;
  color: var(--atr-pie);
}
.atr-boton:hover {
  background: var(--atr-lateral);
}
.atr-boton-principal {
  background: var(--atr-acento);
  border-color: var(--atr-acento);
  color: var(--atr-fondo);
}
.atr-boton-principal:hover {
  background: var(--atr-acento-hover);
  border-color: var(--atr-acento-hover);
}
.atr-boton:disabled {
  opacity: 0.6;
  cursor: default;
}
.atr-avatar {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: var(--atr-avatar);
  color: var(--atr-texto);
  font: 600 11px "IBM Plex Sans", system-ui, sans-serif;
  cursor: pointer;
}

/* SilverBullet's profile menu (Editar perfil, Cerrar sesión), opened from our avatar. */
body.atr-espacios .sb-anchored-menu {
  top: 54px !important;
  right: 24px !important;
  left: auto !important;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
}

/* --- Main ---------------------------------------------------------------- */

.atr-principal {
  width: 100%;
  max-width: 1088px; /* 1040 de contenido, como el diseño */
  margin: 0 auto;
  padding: 56px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}
/* SilverBullet's stylesheet adds margins between sibling sections; the gap above replaces them. */
body.atr-espacios .atr-principal > * {
  margin: 0;
}
.atr-saludo {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
body.atr-espacios .atr-saludo h1 {
  margin: 0;
  font-family: inherit;
  font-weight: 700;
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--atr-texto);
}
.atr-saludo p {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  color: var(--atr-tenue);
}

.atr-aviso {
  margin: 0;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--atr-lateral);
  color: var(--atr-tenue);
  font-size: 14px;
}
.atr-aviso-error {
  background: var(--atr-error-suave);
  color: var(--atr-error);
}

/* Section label, with an action at the right (Nuevo espacio) or a note. */
.atr-seccion-titulo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  min-height: 30px;
}
body.atr-espacios .atr-seccion-titulo h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--atr-pie);
}
.atr-seccion-titulo > span {
  font-size: 12px;
  color: var(--atr-pie);
}

/* --- Space cards ----------------------------------------------------------- */

.atr-espacios-lista {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.atr-pantalla .atr-nuevo-espacio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--atr-tenue);
  font: 400 14px/1 "IBM Plex Sans", system-ui, sans-serif;
  cursor: pointer;
}
.atr-pantalla .atr-nuevo-espacio:hover {
  background: var(--atr-hover);
  color: var(--atr-texto);
}

.atr-tarjetas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 12px;
}
.atr-tarjeta {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: 12px;
  background: var(--atr-fondo);
  border: 1px solid var(--atr-borde);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.atr-tarjeta:hover,
.atr-tarjeta:focus-within {
  border-color: var(--atr-borde-hover);
  box-shadow: var(--atr-sombra-hover);
}
.atr-tarjeta-arriba {
  display: flex;
  align-items: center;
  gap: 10px;
}
.atr-icono {
  display: flex;
  flex: none;
}
.atr-icono-fila {
  display: flex;
  align-items: center;
  gap: 12px;
}
/* Letter tile, when atrium-library does not load. */
.atr-inicial {
  --atr-tam: 34px;
  flex: none;
  width: var(--atr-tam);
  height: var(--atr-tam);
  border-radius: calc(var(--atr-tam) * 0.27);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: calc(var(--atr-tam) * 0.45);
}
.atr-rol {
  flex: none;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}
.atr-rol-editor {
  background: var(--atr-acento-suave);
  color: var(--atr-acento-hover);
}
.atr-rol-lectura {
  background: var(--atr-gris-suave);
  color: var(--atr-tenue);
}
.atr-rol-admin {
  background: var(--atr-texto);
  color: var(--atr-fondo);
}
.atr-pantalla a.atr-tarjeta-nombre {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--atr-texto);
  text-decoration: none;
  overflow-wrap: anywhere;
}
/* The whole card opens the space. */
.atr-tarjeta-nombre::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
}
.atr-pantalla a.atr-tarjeta-nombre:focus-visible {
  outline: none;
}
.atr-pantalla a.atr-tarjeta-nombre:focus-visible::after {
  outline: 2px solid var(--atr-acento);
  outline-offset: 2px;
}
.atr-tarjeta-descripcion {
  font-size: 14px;
  line-height: 1.5;
  color: var(--atr-tenue);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* «Último cambio …», and «Personas» (editors) and settings (admins) above the card's link. */
.atr-tarjeta-pie {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 26px;
  font-size: 12px;
  color: var(--atr-pie);
}
.atr-ultimo-cambio {
  flex: 1;
  min-width: 0;
  margin-right: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* «Personas» y la tuerca aparecen al pasar el cursor por la tarjeta, como el diseño */
.atr-tarjeta .atr-configurar { opacity: 0; transition: opacity 0.12s ease; }
.atr-tarjeta:is(:hover, :focus-within) .atr-configurar { opacity: 1; }
@media (hover: none) {
  .atr-tarjeta .atr-configurar { opacity: 1; }
}
.atr-tarjeta[hidden] { display: none; }
.atr-tarjetas-bloque { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.atr-tarjetas-bloque > .atr-tarjetas { align-self: stretch; }
.atr-pantalla .atr-ver-todos {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--atr-borde-control, #E3E3E1);
  border-radius: 8px;
  background: var(--atr-fondo);
  color: var(--atr-texto);
  font: 500 14px "IBM Plex Sans", system-ui, sans-serif;
  cursor: pointer;
}
.atr-pantalla .atr-ver-todos > span { display: flex; color: var(--atr-pie); }
.atr-pantalla .atr-ver-todos:hover { background: var(--atr-hover); }
.atr-pantalla .atr-configurar {
  position: relative;
  z-index: 1;
  flex: none;
  display: inline-flex;
  padding: 5px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--atr-pie);
  cursor: pointer;
}
.atr-pantalla .atr-configurar:hover {
  color: var(--atr-texto);
  background: var(--atr-hover);
}

/* --- Recent activity ----------------------------------------------------- */

.atr-actividad {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.atr-actividad .atr-seccion-titulo {
  align-items: baseline;
  min-height: 0;
  padding-bottom: 8px;
}
.atr-actividad ul {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--atr-borde-suave);
}
.atr-actividad li {
  margin: 0;
  border-bottom: 1px solid var(--atr-borde-suave);
}
.atr-pantalla a.atr-fila {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 12px 8px;
  color: var(--atr-texto);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.45;
}
.atr-pantalla a.atr-fila:hover {
  background: var(--atr-lateral);
  color: var(--atr-texto);
}
.atr-cuando {
  flex: none;
  width: 52px;
  color: var(--atr-pie);
  font-size: 13px;
}
.atr-espacio-icono {
  flex: none;
  display: flex;
}
.atr-que {
  flex: 1 1 240px;
  min-width: 0;
  font-weight: 500;
}
.atr-accion {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--atr-tenue);
}
.atr-punto {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--atr-gris);
}
.atr-punto-azul { background: var(--atr-azul); }
.atr-punto-naranja { background: var(--atr-naranja); }
.atr-punto-morado { background: var(--atr-morado); }
.atr-punto-turquesa { background: var(--atr-turquesa); }
.atr-punto-rosa { background: var(--atr-rosa); }
.atr-punto-verde { background: var(--atr-verde); }
.atr-punto-amarillo { background: var(--atr-amarillo); }
.atr-punto-rojo { background: var(--atr-rojo); }

/* --- New space dialog ------------------------------------------------------ */

.atr-dialogo {
  width: min(480px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--atr-borde);
  border-radius: 12px;
  background: var(--atr-fondo);
  color: var(--atr-texto);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
}
.atr-dialogo::backdrop {
  background: var(--atr-velo);
}
.atr-dialogo form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
}
body.atr-espacios .atr-dialogo h2 {
  margin: 0;
  font-family: inherit;
  font-weight: 700;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.atr-dialogo p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--atr-tenue);
}
body.atr-espacios .atr-dialogo .atr-campo {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
}
body.atr-espacios .atr-dialogo .atr-campo input:not([type="radio"]),
body.atr-espacios .atr-dialogo .atr-campo textarea {
  font: 400 15px/1.4 "IBM Plex Sans", system-ui, sans-serif;
  color: var(--atr-texto);
  background: var(--atr-fondo);
  border: 1px solid var(--atr-borde-control);
  border-radius: 8px;
  padding: 9px 12px;
}
body.atr-espacios .atr-dialogo .atr-campo textarea {
  resize: vertical;
  min-height: 72px;
}
body.atr-espacios .atr-dialogo .atr-campo small {
  font-weight: 400;
  font-size: 13px;
  color: var(--atr-pie);
}
.atr-dialogo-botones {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.atr-dialogo {
  max-height: calc(100vh - 32px);
  overflow: auto;
}
.atr-dialogo select {
  height: 36px;
  font: 400 14px "IBM Plex Sans", system-ui, sans-serif;
  color: var(--atr-texto);
  background: var(--atr-fondo);
  border: 1px solid var(--atr-borde-control);
  border-radius: 8px;
  padding: 0 8px;
}
body.atr-espacios .atr-dialogo .atr-grupo {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
body.atr-espacios .atr-dialogo .atr-grupo legend {
  padding: 0;
  margin-bottom: 6px;
}
.atr-tipos {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
body.atr-espacios .atr-dialogo .atr-tipo {
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--atr-borde);
  border-radius: 8px;
  font-weight: 400;
  cursor: pointer;
}
body.atr-espacios .atr-dialogo .atr-tipo:has(input:checked) {
  border-color: var(--atr-acento);
  background: var(--atr-acento-suave);
}
body.atr-espacios .atr-dialogo .atr-tipo input {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--atr-acento);
}
body.atr-espacios .atr-dialogo .atr-tipo span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
body.atr-espacios .atr-dialogo .atr-tipo strong {
  font-weight: 500;
}
.atr-agregar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.atr-agregar select:first-child {
  flex: 1 1 180px;
  min-width: 0;
}
.atr-personas {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--atr-borde-suave);
  border-radius: 8px;
}
.atr-personas li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--atr-borde-suave);
  font-weight: 400;
}
.atr-personas li:last-child {
  border-bottom: 0;
}
.atr-personas li > span:first-child {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.atr-persona-rol {
  font-size: 13px;
  color: var(--atr-pie);
}
.atr-quitar {
  border: 0;
  background: none;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--atr-pie);
  font: 400 13px "IBM Plex Sans", system-ui, sans-serif;
  cursor: pointer;
}
.atr-quitar:hover {
  color: var(--atr-error);
  background: var(--atr-lateral);
}
.atr-aviso[hidden] {
  display: none;
}

/* --- Phones -------------------------------------------------------------- */

@media (max-width: 700px) {
  .atr-cabecera {
    padding: 10px 16px;
  }
  .atr-boton-grist span {
    display: none;
  }
  body.atr-espacios .sb-anchored-menu {
    top: 50px !important;
    right: 16px !important;
  }
  .atr-principal {
    padding: 32px 16px 56px;
    gap: 36px;
  }
  body.atr-espacios .atr-saludo h1 {
    font-size: 28px;
  }
  .atr-pantalla a.atr-fila {
    gap: 6px 10px;
    padding: 12px 4px;
  }
  .atr-cuando {
    width: 40px;
  }
  .atr-que {
    flex-basis: calc(100% - 120px);
  }
  .atr-accion {
    flex-basis: 100%;
  }
}

/* Dark tiles must not disappear on the dark background. */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) body.atr-espacios .atr-inicial {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  }
}
html[data-theme="dark"] body.atr-espacios .atr-inicial {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}
