:root {
  /* Paleta espacioarroelo.es */
  --ink: #1a1814;
  --ink-soft: #2a221c;
  --paper: #f7f5f2;
  --plan: #efe8df;
  --line: #2a221c;
  --brand: #a85a35;
  --brand-deep: #452623;
  --brand-bright: #d4845a;
  --full: #d4845a;
  --full-soft: #f6ddc4;
  --morning: #a85a35;
  --afternoon: #452623;
  --free: #1a181473;
  --glow-a: rgba(212, 132, 90, 0.22);
  --glow-b: rgba(168, 90, 53, 0.14);
  --radius: 14px;
  --font: "Outfit", sans-serif;
  --display: "Syne", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.4;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, var(--glow-a), transparent 55%),
    radial-gradient(ellipse 60% 45% at 100% 0%, var(--glow-b), transparent 50%),
    linear-gradient(160deg, #f7f5f2 0%, #efe8df 48%, #f6ddc4 100%);
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(21, 32, 40, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 32, 40, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.75rem clamp(1.25rem, 4vw, 3rem) 1rem;
  animation: rise 0.7s ease both;
}

.eyebrow {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.brand {
  margin: 0.15rem 0 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  letter-spacing: -0.03em;
  line-height: 0.95;
  color: var(--brand-deep);
}

.lede {
  margin: 0.45rem 0 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.top-actions {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
}

.day-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.day-label input {
  font: inherit;
  color: var(--ink);
  border: 1px solid rgba(36, 48, 56, 0.2);
  background: rgba(255, 255, 255, 0.55);
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 1.5rem;
  padding: 0.5rem clamp(1.25rem, 4vw, 3rem) 2rem;
  align-items: start;
}

.mobile-summary {
  display: none;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 0.25rem 1rem 1.5rem;
  }

  .top {
    padding: 1.1rem 1rem 0.6rem;
    align-items: flex-start;
  }

  .brand {
    font-size: clamp(1.9rem, 9vw, 2.6rem);
  }

  .lede {
    font-size: 0.95rem;
  }

  .plan {
    padding: 0.7rem;
  }

  .room {
    width: 100%;
    aspect-ratio: 0.78 / 1;
    max-height: min(72vh, 620px);
  }

  .island {
    gap: 0.28rem;
    padding: 0.28rem;
  }

  .island-north {
    top: 8%;
    left: 10%;
    width: 52%;
    height: 30%;
  }

  .island-south {
    top: 46%;
    left: 10%;
    width: 52%;
    height: 30%;
  }

  /* Más ancho para Javier (9–10) */
  .island-east {
    top: 26%;
    right: 4%;
    width: 26%;
    height: 36%;
  }

  .entrance-corridor {
    right: 0.4%;
    top: 6%;
    width: 7%;
    height: 16%;
    font-size: 0.55rem;
    letter-spacing: 0.1em;
  }

  .wall-n,
  .wall-s {
    font-size: 0.55rem;
    letter-spacing: 0.1em;
  }

  .wall-s {
    top: 82%;
  }

  .desk {
    padding: 0.28rem 0.3rem;
    overflow: visible;
  }

  .desk-num {
    font-size: 0.68rem;
  }

  .desk-people {
    font-size: clamp(0.68rem, 3.4vw, 0.82rem);
    gap: 0.12rem;
  }

  .desk-people .slot-full {
    display: none;
  }

  .desk-people .slot-short {
    display: inline;
  }

  .desk-people .slot-label {
    font-size: 0.7em;
  }

  .desk.is-split .desk-people .am .name,
  .desk.is-split .desk-people .pm .name {
    font-weight: 700;
  }

  .mobile-summary {
    display: block;
    margin-top: 1rem;
    padding: 0.85rem 0.9rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(26, 24, 20, 0.1);
  }

  .mobile-summary-title {
    margin: 0 0 0.55rem;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
  }

  .mobile-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
  }

  .chip {
    appearance: none;
    border: 1px solid rgba(168, 90, 53, 0.35);
    background: linear-gradient(160deg, #f6ddc4, #efe8df);
    color: var(--ink);
    border-radius: 999px;
    padding: 0.45rem 0.7rem;
    font: inherit;
    font-size: 0.82rem;
    line-height: 1.15;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    cursor: pointer;
    text-align: left;
  }

  .chip strong {
    font-weight: 700;
  }

  .chip span {
    font-size: 0.72em;
    color: var(--ink-soft);
    letter-spacing: 0.02em;
  }

  .mobile-empty {
    margin: 0;
    color: var(--ink-soft);
    font-size: 0.9rem;
  }

  .panel {
    position: static;
    padding: 1.1rem 1rem 1.25rem;
  }

  .panel h2 {
    font-size: 1.35rem;
  }

  .roster-cols {
    gap: 0.65rem;
  }
}

@media (max-width: 420px) {
  .room {
    aspect-ratio: 0.72 / 1;
  }

  .island-north,
  .island-south {
    width: 50%;
    left: 8%;
  }

  .island-east {
    width: 30%;
    right: 3%;
  }

  .desk-people {
    font-size: 0.72rem;
  }
}

.plan-wrap {
  animation: rise 0.8s 0.08s ease both;
}

.plan {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.25));
  border: 1px solid rgba(36, 48, 56, 0.12);
  border-radius: calc(var(--radius) + 4px);
  padding: clamp(0.85rem, 2vw, 1.4rem);
  box-shadow: 0 18px 40px rgba(21, 32, 40, 0.06);
}

.room {
  position: relative;
  aspect-ratio: 0.82 / 1;
  width: min(100%, 560px);
  margin: 0 auto;
  background:
    repeating-linear-gradient(
      -18deg,
      transparent,
      transparent 10px,
      rgba(36, 48, 56, 0.015) 10px,
      rgba(36, 48, 56, 0.015) 11px
    ),
    var(--plan);
  border: 3px solid var(--line);
  border-radius: 8px;
}

.wall-label {
  position: absolute;
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(36, 48, 56, 0.45);
}

.wall-n {
  top: 0.55rem;
  left: 42%;
  transform: translateX(-50%);
}

/* Ventana/calle en la pared inferior, entre mesas 7 y 8 */
.wall-s {
  bottom: auto;
  top: 80%;
  left: 42%;
  transform: translateX(-50%);
}

.entrance {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Acceso arriba-derecha: puerta libre; Javier queda debajo, no delante */
.entrance-corridor {
  right: 1.2%;
  top: 8%;
  width: 9%;
  height: 18%;
  flex-direction: column;
  gap: 0.25rem;
  border-right: 3px solid var(--brand);
  border-left: 2px dashed rgba(36, 48, 56, 0.28);
  background: linear-gradient(
    90deg,
    rgba(212, 132, 90, 0.1),
    rgba(168, 90, 53, 0.18)
  );
  writing-mode: vertical-rl;
  letter-spacing: 0.18em;
  color: var(--brand);
  font-weight: 600;
}

.entrance-corridor::before,
.entrance-corridor::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 8px solid var(--brand);
  flex-shrink: 0;
}

.entrance-corridor::before {
  border-top: none;
  border-bottom: 8px solid var(--brand);
}

.island {
  position: absolute;
  display: grid;
  gap: 0.35rem;
  padding: 0.35rem;
  background: rgba(255, 255, 255, 0.35);
  border: 2px solid var(--line);
  border-radius: 6px;
}

.island-north {
  top: 9%;
  left: 18%;
  width: 48%;
  height: 28%;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  grid-template-areas:
    "a b"
    "c d";
}

.island-south {
  top: 48%;
  left: 18%;
  width: 48%;
  height: 28%;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  grid-template-areas:
    "a b"
    "c d";
}

/* Isla de Javier: junto al acceso, pero debajo — no delante de la puerta */
.island-east {
  top: 28%;
  right: 7%;
  width: 18%;
  height: 34%;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr 1fr;
  grid-template-areas:
    "a"
    "b";
}

.desk {
  position: relative;
  appearance: none;
  border: 1.5px solid rgba(36, 48, 56, 0.55);
  border-radius: 4px;
  background: #f7f8f6;
  cursor: pointer;
  padding: 0.25rem;
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  color: var(--ink);
  font: inherit;
}

.desk:hover,
.desk:focus-visible {
  transform: translateY(-1px) scale(1.02);
  border-color: var(--brand);
  box-shadow: 0 8px 18px rgba(21, 32, 40, 0.12);
  outline: none;
  z-index: 2;
}

.desk.is-selected {
  border-color: var(--brand-deep);
  box-shadow: 0 0 0 2px rgba(11, 110, 107, 0.35);
  z-index: 3;
}

.desk-num {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.72rem;
  opacity: 0.55;
}

.desk-people {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: clamp(0.55rem, 1.5vw, 0.72rem);
  font-weight: 600;
  line-height: 1.15;
  flex: 1;
  justify-content: space-between;
}

.desk-people .am,
.desk-people .pm {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.desk-people .slot-label {
  font-size: 0.58em;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
}

.desk-people .slot-short {
  display: none;
}

.desk-people .name {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.2;
}

.desk-people .am {
  color: var(--morning);
}

.desk-people .pm {
  color: var(--afternoon);
}

.desk-people .full {
  color: var(--brand-deep);
}

.desk-people .empty {
  color: var(--free);
  font-weight: 500;
}

.desk.is-full {
  background: linear-gradient(160deg, #e9a87a 0%, var(--full) 100%);
  border-color: var(--brand-deep);
  box-shadow: inset 0 0 0 1px rgba(69, 38, 35, 0.2);
}

.desk.is-full .desk-people .full {
  color: #f7f5f2;
  text-shadow: 0 1px 0 rgba(26, 24, 20, 0.25);
}

.desk.is-full .desk-num {
  color: #f7f5f2;
}

.desk.is-split {
  background: linear-gradient(
    180deg,
    rgba(246, 221, 196, 0.95) 0 50%,
    rgba(69, 38, 35, 0.18) 50% 100%
  );
}

.desk.is-free {
  background: repeating-linear-gradient(
    45deg,
    #f7f5f2,
    #f7f5f2 4px,
    #efe8df 4px,
    #efe8df 8px
  );
}

.legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.4rem;
  margin: 1rem 0 0;
  padding: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.swatch {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  margin-right: 0.4rem;
  vertical-align: -0.1rem;
  border: 1px solid rgba(36, 48, 56, 0.35);
  border-radius: 3px;
}

.swatch.full {
  background: var(--full);
  border-color: var(--brand-deep);
}

.swatch.split {
  background: linear-gradient(
    180deg,
    rgba(168, 90, 53, 0.55) 0 50%,
    rgba(69, 38, 35, 0.55) 50% 100%
  );
}

.swatch.free {
  background: repeating-linear-gradient(45deg, #f7f5f2, #f7f5f2 3px, #efe8df 3px, #efe8df 6px);
}

.panel {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(36, 48, 56, 0.1);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem 1.5rem;
  animation: rise 0.85s 0.14s ease both;
  position: sticky;
  top: 1rem;
}

.panel-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
}

.panel h2 {
  margin: 0.25rem 0 0.4rem;
  font-family: var(--display);
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.panel-hint {
  margin: 0 0 1rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.desk-zone {
  margin: 0 0 0.85rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.desk-form fieldset {
  border: 0;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.desk-form legend {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.35rem;
}

.radio {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.field input {
  font: inherit;
  text-transform: none;
  letter-spacing: normal;
  font-size: 1rem;
  color: var(--ink);
  border: 1px solid rgba(36, 48, 56, 0.2);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: rgba(255, 255, 255, 0.8);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.4rem;
}

.primary,
.ghost {
  font: inherit;
  border-radius: 999px;
  padding: 0.65rem 1.1rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.15s ease;
}

.primary {
  background: var(--brand);
  color: #f7f5f2;
  font-weight: 600;
}

.primary:hover {
  background: var(--brand-deep);
  transform: translateY(-1px);
}

.ghost {
  background: transparent;
  border-color: rgba(36, 48, 56, 0.22);
  color: var(--ink);
}

.ghost:hover {
  background: rgba(255, 255, 255, 0.55);
}

.roster {
  margin-top: 1.6rem;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(36, 48, 56, 0.1);
}

.roster h3 {
  margin: 0 0 0.75rem;
  font-family: var(--display);
  font-size: 1.05rem;
}

.roster-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.roster h4 {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.roster ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.roster li {
  font-size: 0.9rem;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
}

.roster li strong {
  font-weight: 600;
}

.foot {
  padding: 0 1.5rem 2rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Login y sesión */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.login-card {
  position: relative;
  width: min(100%, 24rem);
}

.login-card .brand {
  margin: 0.2rem 0 0;
}

.login-card .lede {
  margin-bottom: 1.4rem;
}

.form-error {
  margin: 0 0 0.75rem;
  color: #9b2c1f;
  font-size: 0.95rem;
}

.user-badge {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: right;
}

.user-badge strong {
  font-size: 0.95rem;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink);
}

.save-status {
  margin: 0.6rem 0 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.save-status.is-error {
  color: #9b2c1f;
}

a.ghost {
  display: inline-block;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

.read-only .form-actions,
.read-only .desk-form fieldset {
  display: none;
}

/* Móvil: cabecera con usuario y plano más aprovechado (va al final para pisar lo anterior). */
@media (max-width: 900px) {
  .top {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .top-actions {
    justify-content: space-between;
    align-items: center;
  }

  .user-badge {
    margin: 0;
    flex-direction: column-reverse;
    text-align: left;
  }

  .top-actions .ghost {
    padding: 0.45rem 0.95rem;
  }

  .room {
    aspect-ratio: 0.92 / 1;
    max-height: none;
  }

  .island-north,
  .island-south {
    left: 5%;
    width: 60%;
    height: 37%;
  }

  .island-north {
    top: 7%;
  }

  .island-south {
    top: 51%;
  }

  .island-east {
    top: 27%;
    right: 3%;
    width: 27%;
    height: 44%;
  }

  .wall-s {
    top: auto;
    bottom: 1%;
  }

  .desk {
    padding: 0.3rem 0.35rem;
    overflow: hidden;
  }

  .desk-num {
    position: absolute;
    top: 0.2rem;
    right: 0.35rem;
    font-size: 0.75rem;
  }

  .desk-people {
    font-size: clamp(0.74rem, 3.5vw, 0.9rem);
    gap: 0;
    justify-content: center;
  }

  /* Media jornada: mañana arriba y tarde abajo, cada una en su mitad. */
  .desk.is-split .desk-people .am,
  .desk.is-split .desk-people .pm {
    flex: 1;
    flex-direction: row;
    align-items: center;
    gap: 0.3rem;
  }
}
