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

:root {
  --bg-app: #f0eeeb;
  --bg-panel: #ffffff;
  --border: #e2ddd6;
  --text: #2c2a28;
  --text-muted: #7a746c;
  --accent: #8b7355;
  --accent-hover: #6d5a43;
  --decor-line: #b8a088;
  --collage-bg: #f7f4ee;
  --collage-photo-bg: #ece7df;
  --radius: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);

  --collage-width: 3600px;
  --collage-height: 2400px;
}

body {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  background: var(--bg-app);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
}

.app {
  display: grid;
  grid-template-columns: 360px 1fr;
  height: 100vh;
}

/* ── Panel lateral ── */

.panel {
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.panel__header {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.panel__header h1 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.panel__subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.panel__section {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.panel__section--scroll {
  flex: 0 0 auto;
  overflow-y: visible;
  min-height: auto;
  max-height: 280px;
  overflow-y: auto;
}

.panel__section h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.field span {
  font-size: 0.82rem;
  font-weight: 600;
}

.field input[type="text"],
.field input[type="number"],
.field textarea,
.field input[type="file"],
.field select {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #faf9f7;
  color: var(--text);
}

.field input[type="file"] {
  padding: 0.4rem;
  font-size: 0.8rem;
}

.field textarea {
  resize: vertical;
  min-height: 60px;
}

.field-row {
  display: flex;
  gap: 0.75rem;
}

.field--inline {
  flex: 1;
}

.field--checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.field--checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.field--checkbox span {
  font-weight: 400;
}

.field input[type="color"] {
  width: 100%;
  height: 38px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #faf9f7;
  cursor: pointer;
}

.typo-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.6rem;
  background: #faf9f7;
}

.typo-group summary {
  cursor: pointer;
  padding: 0.55rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
  list-style: none;
}

.typo-group summary::-webkit-details-marker {
  display: none;
}

.typo-group[open] > :not(summary) {
  padding: 0 0.65rem 0.65rem;
}

.typo-group .field:last-child {
  margin-bottom: 0;
}

.hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.panel__actions {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-top: 1px solid var(--border);
}

.btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: var(--accent-hover);
}

.btn--secondary {
  background: #f5f3f0;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn--secondary:hover {
  background: #ebe8e3;
}

/* ── Lista de alumnos ── */

.students-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.student-item {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 0.6rem;
  align-items: center;
  padding: 0.5rem;
  background: #faf9f7;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.student-item__thumb {
  width: 48px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  background: #e8e4de;
}

.student-item__fields {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.student-item__fields input {
  font-family: inherit;
  font-size: 0.82rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
}

.student-item__index {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ── Área de vista previa ── */

.preview-area {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.zoom-controls button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

#btn-reset-view {
  font-size: 0.9rem;
}

.zoom-controls button:hover {
  background: #f5f3f0;
}

#zoom-label {
  min-width: 40px;
  text-align: center;
  font-size: 0.82rem;
}

.zoom-input-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.zoom-input-row--toolbar {
  margin: 0 0.15rem;
}

.zoom-input-row input[type="number"] {
  width: 72px;
  font-family: inherit;
  font-size: 0.82rem;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  text-align: right;
}

.zoom-input-row--toolbar input[type="number"] {
  width: 64px;
}

.zoom-input-suffix {
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.field .zoom-input-row {
  margin-top: 0.35rem;
}

.field .zoom-input-row input[type="number"] {
  flex: 1;
  max-width: 120px;
}

.preview-wrapper {
  flex: 1;
  overflow: hidden;
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 1px 1px, #d8d3cb 1px, transparent 0);
  background-size: 20px 20px;
  touch-action: none;
  cursor: default;
}

.preview-wrapper.is-pan-ready {
  cursor: grab;
}

.preview-wrapper.is-panning {
  cursor: grabbing;
}

/* ── Collage (plantilla de impresión) ── */

.collage {
  position: relative;
  width: var(--collage-width);
  height: var(--collage-height);
  background: var(--collage-bg);
  display: flex;
  flex-direction: column;
  padding:
    calc(var(--collage-height) * 0.055)
    calc(var(--collage-width) * 0.042)
    calc(var(--collage-height) * 0.04);
  flex-shrink: 0;
  transform-origin: center center;
  overflow: hidden;
}

.preview-wrapper .collage {
  box-shadow: var(--shadow);
}

.collage__title {
  flex-shrink: 0;
  font-family: var(--title-font, 'Cormorant Garamond', Georgia, serif);
  font-size: var(--title-size, 62px);
  font-weight: var(--title-weight, 600);
  text-align: center;
  letter-spacing: var(--title-letter-spacing, 0.06em);
  margin: 0 0 calc(var(--collage-height) * 0.024);
  color: var(--title-color, #1a1816);
  line-height: 1.2;
  z-index: 1;
}

.collage__body {
  flex: 1;
  min-height: 0;
  z-index: 1;
}

.collage__body--side-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
  column-gap: calc(var(--collage-width) * 0.038);
  align-items: stretch;
}

.collage__body--center-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr) minmax(0, 1fr);
  column-gap: calc(var(--collage-width) * 0.024);
  align-items: stretch;
}

.collage__body--top-hero-grid {
  display: flex;
  flex-direction: column;
  gap: calc(var(--collage-height) * 0.02);
  min-height: 0;
}

.collage__body--hero-corner-grid {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.collage__body--hero-focus {
  display: flex;
  flex-direction: column;
  gap: calc(var(--collage-height) * 0.018);
  min-height: 0;
}

.collage__unified-grid-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: calc(var(--collage-height) * 0.016);
}

.collage__unified-grid {
  flex: 1;
  min-height: 0;
  position: relative;
}

.collage__hero--corner {
  min-height: 0;
  padding: 0;
  z-index: 1;
}

.collage__hero--focus {
  flex: 0 0 58%;
  min-height: 0;
  padding: calc(var(--collage-height) * 0.02);
  overflow: visible;
}

.collage__grid-wrap--compact {
  flex: 1;
  min-height: 0;
  max-height: 38%;
}

.collage__header-row {
  flex: 0 0 34%;
  min-height: 0;
  display: flex;
  align-items: stretch;
}

.collage__grid-wrap--full {
  flex: 1;
  min-height: 0;
}

.collage__grid-wrap--side {
  min-height: 0;
  height: 100%;
}

.collage__grid-wrap {
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.collage__grid {
  height: 100%;
  display: grid;
  gap: calc(var(--collage-height) * 0.008) calc(var(--collage-width) * 0.008);
  align-content: stretch;
}

.collage__grid--no-empty {
  align-content: start;
}

.collage__cell--is-hero .collage__photo-frame {
  box-shadow: 0 0 0 calc(var(--collage-width) * 0.003) var(--decor-line, #b8a088);
}

.collage__cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--collage-height) * 0.004);
  min-height: 0;
  overflow: hidden;
}

.collage__photo-frame {
  flex: 1 1 0;
  min-height: 0;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: var(--photo-aspect-ratio, 3 / 4);
  align-self: center;
  overflow: hidden;
  position: relative;
  background: var(--collage-photo-bg);
  cursor: pointer;
  touch-action: none;
}

.collage__side-col {
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.collage__center-col {
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.collage__footer--full {
  flex-shrink: 0;
  margin-top: 0;
}

.collage__footer {
  flex-shrink: 0;
  text-align: center;
  font-family: var(--footer-font, 'Source Sans 3', sans-serif);
  font-size: var(--footer-size, 20px);
  line-height: var(--footer-line-height, 1.5);
  color: var(--footer-color, #5a5550);
  margin-top: calc(var(--collage-height) * 0.022);
  padding-top: calc(var(--collage-height) * 0.018);
  font-weight: var(--footer-weight, 300);
  z-index: 1;
}

.collage__hero {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding-left: calc(var(--collage-width) * 0.018);
  padding-right: calc(var(--collage-width) * 0.008);
  overflow: hidden;
}

.collage__hero--center {
  padding-left: calc(var(--collage-width) * 0.012);
  padding-right: calc(var(--collage-width) * 0.012);
}

.collage__hero--banner {
  flex: 0 0 40%;
  min-height: 0;
  padding: 0;
  align-self: flex-start;
  height: 100%;
}

.collage__hero-placeholder {
  width: 100%;
  height: 100%;
  background: var(--collage-photo-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a09890;
  font-size: calc(var(--collage-height) * 0.018);
  font-weight: 300;
  letter-spacing: 0.05em;
}

.collage__decor-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.collage__decor-svg line,
.collage__decor-svg path,
.collage__decor-svg circle,
.collage__decor-svg ellipse,
.collage__decor-svg rect,
.collage__decor-svg polygon {
  vector-effect: non-scaling-stroke;
}

.collage__decor-svg line {
  stroke: var(--decor-line);
  stroke-width: 1.5;
}

/* ── Plantillas ── */

.collage--template-colorful .collage__center-col {
  background: linear-gradient(165deg, #ff6eb4 0%, #ff4fa3 55%, #ff85c8 100%);
  border-radius: calc(var(--collage-width) * 0.014);
  padding: calc(var(--collage-height) * 0.018);
  box-sizing: border-box;
}

.collage--template-colorful .collage__hero-placeholder {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.collage--template-colorful .collage__hero-banner-name {
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.collage--template-chalkboard .collage__title {
  text-shadow: 1px 2px 0 rgba(0, 0, 0, 0.35);
}

.collage--template-chalkboard .collage__hero-placeholder {
  color: #888;
}

.collage--template-chalkboard .collage__hero-banner-name {
  color: #fff;
}

/* ── Estera escolar verde ── */

.collage--template-school-mat {
  background-color: #2a6849;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.14) 1px, transparent 1px);
  background-size: calc(var(--collage-width) * 0.013) calc(var(--collage-width) * 0.013);
}

.collage--template-school-mat .collage__photo-frame {
  border: calc(var(--collage-width) * 0.004) solid #ffffff;
  box-shadow:
    calc(var(--collage-width) * 0.002) calc(var(--collage-width) * 0.002) 0 rgba(255, 255, 255, 0.5),
    calc(var(--collage-width) * -0.001) calc(var(--collage-width) * -0.001) 0 rgba(255, 255, 255, 0.35);
}

.collage--template-school-mat .collage__title {
  text-shadow: 1px 2px 0 rgba(0, 0, 0, 0.25);
}

/* ── Álbum teal ── */

.collage--template-yearbook-teal {
  background-color: #3a5860;
  background-image:
    linear-gradient(rgba(180, 210, 225, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(180, 210, 225, 0.12) 1px, transparent 1px);
  background-size: calc(var(--collage-width) * 0.01) calc(var(--collage-width) * 0.01);
}

.collage--template-yearbook-teal .collage__hero--banner {
  flex: 0 0 42%;
}

.collage--template-yearbook-teal .collage__photo-frame {
  border-radius: calc(var(--collage-width) * 0.004);
  box-shadow: 0 calc(var(--collage-height) * 0.004) calc(var(--collage-height) * 0.012) rgba(0, 0, 0, 0.25);
}

.collage--template-yearbook-teal .collage__title {
  letter-spacing: 0.04em;
}

/* ── Pizarra amigos ── */

.collage--template-chalk-friends .collage__photo-frame {
  border: calc(var(--collage-width) * 0.003) solid rgba(255, 255, 255, 0.85);
  box-shadow:
    inset 0 0 0 calc(var(--collage-width) * 0.001) rgba(255, 255, 255, 0.3),
    calc(var(--collage-width) * 0.002) calc(var(--collage-width) * 0.002) 0 rgba(255, 255, 255, 0.15);
}

.collage--template-chalk-friends .collage__center-col {
  background: rgba(255, 255, 255, 0.04);
  border-radius: calc(var(--collage-width) * 0.008);
}

.collage--template-chalk-friends .collage__hero-placeholder {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
  border: calc(var(--collage-width) * 0.003) dashed rgba(255, 255, 255, 0.35);
}

.collage--template-chalk-friends .collage__hero-banner-name {
  color: #fff;
}

.collage--template-chalk-friends .collage__title {
  text-shadow: 1px 2px 0 rgba(0, 0, 0, 0.4);
}

/* ── Primaria colorida (tríptico) ── */

.collage--template-vivid-triptych .collage__center-col {
  background: linear-gradient(165deg, #ff6eb4 0%, #ff4fa3 55%, #ff85c8 100%);
  border-radius: calc(var(--collage-width) * 0.014);
  padding: calc(var(--collage-height) * 0.018);
  box-sizing: border-box;
}

.collage--template-vivid-triptych .collage__grid-wrap--side {
  background: rgba(255, 255, 255, 0.55);
  border-radius: calc(var(--collage-width) * 0.01);
  padding: calc(var(--collage-height) * 0.012);
  box-sizing: border-box;
}

.collage--template-vivid-triptych .collage__hero-placeholder {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.collage--template-vivid-triptych .collage__hero-banner-name {
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

/* ── Graduación tiza ── */

.collage--template-chalk-graduate .collage__hero--focus .collage__photo-frame--hero-slot {
  transform: rotate(-4deg);
  border: calc(var(--collage-width) * 0.012) solid #ffffff;
  box-shadow: calc(var(--collage-width) * 0.008) calc(var(--collage-height) * 0.01) calc(var(--collage-height) * 0.02) rgba(0, 0, 0, 0.35);
}

.collage--template-chalk-graduate .collage__hero--focus .collage__hero-placeholder {
  transform: rotate(-4deg);
  border: calc(var(--collage-width) * 0.012) solid rgba(255, 255, 255, 0.6);
  color: rgba(255, 255, 255, 0.65);
}

.collage--template-chalk-graduate .collage__title {
  text-shadow: 1px 2px 0 rgba(0, 0, 0, 0.35);
}

.collage--template-chalk-graduate .collage__photo-frame {
  border: calc(var(--collage-width) * 0.002) solid rgba(255, 255, 255, 0.5);
}

.collage__photo-frame--hero {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}

.collage__photo-frame--hero-fixed {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: var(--hero-aspect-ratio, 3 / 4);
  margin: auto;
}

.collage.is-collage-selected {
  box-shadow: 0 0 0 2px rgba(139, 115, 85, 0.35);
}

.collage__text-editable {
  pointer-events: auto;
  cursor: text;
  border-radius: 2px;
}

.collage__text-editable.is-text-selected {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.collage__text-editable:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.collage__caption {
  pointer-events: auto;
}

.collage__photo-frame.is-selected {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  cursor: grab;
  box-shadow: 0 0 0 1px rgba(139, 115, 85, 0.25);
}

.collage__photo-frame.is-selected:active {
  cursor: grabbing;
}

.collage__photo-frame:hover:not(.is-selected)::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(139, 115, 85, 0.12);
  pointer-events: none;
}

.collage__photo-img {
  position: absolute;
  top: 50%;
  left: 50%;
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  will-change: transform;
}

.collage__caption {
  flex-shrink: 0;
  text-align: center;
  font-size: var(--caption-name-size, 18px);
  line-height: 1.35;
  color: var(--caption-name-color, #3a3632);
  width: 100%;
  word-break: break-word;
}

.collage__caption-name {
  font-family: var(--caption-name-font, 'Source Sans 3', sans-serif);
  font-weight: var(--caption-name-weight, 600);
  display: block;
}

.collage__caption-sub {
  font-family: var(--caption-sub-font, 'Source Sans 3', sans-serif);
  font-size: var(--caption-sub-size, 16px);
  font-weight: var(--caption-sub-weight, 300);
  display: block;
  color: var(--caption-sub-color, #5a5550);
}

.collage__cell--empty .collage__photo-frame {
  background: var(--collage-photo-bg);
}

.btn--small {
  padding: 0.4rem 0.65rem;
  font-size: 0.78rem;
}

.editor-actions {
  margin-bottom: 0.5rem;
}

.student-item__actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.4rem;
}

.collage__photo-frame--hero-slot {
  position: relative;
}

.collage__hero-banner {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--collage-height, 2400px) * 0.018) calc(var(--collage-width, 3600px) * 0.03);
  overflow: hidden;
  border-top: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
  pointer-events: none;
}

.collage__hero-banner-glass {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.collage__hero-banner-name {
  position: relative;
  z-index: 1;
  pointer-events: auto;
  cursor: text;
  font-family: var(--caption-name-font, 'Source Sans 3', sans-serif);
  font-size: calc(var(--collage-height, 2400px) * 0.028);
  font-weight: var(--caption-name-weight, 600);
  letter-spacing: 0.04em;
  color: #ffffff;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  line-height: 1.2;
  word-break: break-word;
}

.student-item__badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.student-item--hero {
  border-color: var(--accent);
  background: #faf7f2;
}

.btn--small.btn--active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.app--readonly .collage__photo-frame {
  cursor: default;
}

.app--readonly .collage__photo-frame.is-selected {
  outline: none;
  cursor: default;
}

.app--readonly .collage__photo-frame:hover:not(.is-selected)::after {
  display: none;
}

.app--names-only .collage__photo-frame {
  cursor: default;
  pointer-events: none;
}

.app--names-only .collage__text-editable {
  pointer-events: auto;
  cursor: text;
}

.app--names-only .collage__caption {
  pointer-events: auto;
}

/* ── Proyecto en base de datos ── */

.project-status {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #f5f3f0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.project-status__label {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.project-status__hint {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.project-links {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.field--compact {
  margin-bottom: 0;
}

.field--compact span {
  font-size: 0.75rem;
}

.link-row {
  display: flex;
  gap: 0.35rem;
}

.link-row input {
  flex: 1;
  min-width: 0;
  font-size: 0.75rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(26, 24, 22, 0.55);
}

.modal-overlay[hidden] {
  display: none;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(247, 244, 238, 0.82);
  backdrop-filter: blur(4px);
}

.loading-overlay[hidden] {
  display: none;
}

.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  max-width: 320px;
  padding: 1.5rem 1.75rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  text-align: center;
}

.loading-spinner {
  width: 42px;
  height: 42px;
  border: 3px solid #e8e2d9;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: loading-spin 0.85s linear infinite;
}

.loading-title {
  margin: 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
}

.loading-detail {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
}

@keyframes loading-spin {
  to { transform: rotate(360deg); }
}

.modal {
  width: min(100%, 420px);
  padding: 1.25rem;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.modal__title {
  margin: 0 0 0.5rem;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-weight: 600;
}

.modal__text {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.modal__error {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  color: #b42318;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.pin-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: #f7f4ee;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.pin-display__label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.pin-display__value {
  font-size: 1.35rem;
  letter-spacing: 0.15em;
  font-variant-numeric: tabular-nums;
}

/* ── Responsive ── */

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    min-height: 100vh;
  }

  body {
    overflow: auto;
  }

  .panel {
    max-height: none;
  }

  .preview-wrapper {
    min-height: 60vh;
  }
}
