/* ================================================
   Design Studio
   ================================================ */

:root {
  --canvas: #F5F3EE;
  --surface: #FFFFFF;
  --surface-2: #FAF8F4;
  --ink: #16140F;
  --ink-2: #3B372F;
  --muted: #7A7469;
  --line: #E7E2D8;
  --line-strong: #D5CFC2;
  --accent: #B4532A;
  --accent-soft: #F6E7DD;
  --ok: #2F6B4F;
  --error: #A3321F;
  --error-soft: #FBEDE9;
  --warn: #8A5A12;
  --warn-soft: #FBF3E2;

  --radius-lg: 18px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(22, 20, 15, 0.05);
  --shadow: 0 1px 2px rgba(22, 20, 15, 0.04), 0 8px 24px rgba(22, 20, 15, 0.06);
  --shadow-lg: 0 2px 4px rgba(22, 20, 15, 0.04), 0 18px 48px rgba(22, 20, 15, 0.10);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Instrument Serif', 'Times New Roman', serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--canvas);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---- Type ---- */
.display {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
}
.display--sm { font-size: 1.75rem; }

.eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.lede {
  color: var(--ink-2);
  font-size: 1.02rem;
  max-width: 62ch;
  margin-top: 0.9rem;
}

.meta { font-size: 0.8rem; color: var(--muted); }

.section-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.9rem;
}

code {
  font-family: var(--font-mono);
  font-size: 0.8em;
}

/* ---- Layout shell ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245, 243, 238, 0.86);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  height: 60px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wordmark {
  font-family: var(--font-display);
  font-size: 1.6rem;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.topnav { display: flex; gap: 4px; }
.topnav a {
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 999px;
  transition: color .15s, background .15s;
}
.topnav a:hover { color: var(--ink); }
.topnav a.is-active { color: var(--ink); background: var(--surface); box-shadow: var(--shadow-sm); }

.page {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 48px 32px 80px;
}

.footer {
  display: flex;
  justify-content: space-between;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 32px;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--muted);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s, opacity .15s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn--primary { background: var(--ink); color: #fff; }
.btn--primary:hover:not(:disabled) { background: #000; }
.btn--primary:disabled { opacity: .45; cursor: not-allowed; }
.btn--ghost { background: var(--surface); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--ink); }
.btn--lg { height: 48px; padding: 0 28px; font-size: 0.95rem; }

.btn-busy { display: none; align-items: center; gap: 8px; }
.btn.is-busy .btn-label { display: none; }
.btn.is-busy .btn-busy { display: inline-flex; }


.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  text-decoration: none;
  font-size: 0.95rem;
  transition: border-color .15s;
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn.is-disabled { opacity: .35; }

.link-arrow {
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--ink-2);
}
.link-arrow:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* ---- Spinner / skeleton ---- */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(22, 20, 15, .15);
  border-top-color: var(--ink);
  animation: spin .7s linear infinite;
  flex: none;
}
.spinner--light { border-color: rgba(255,255,255,.3); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(100deg, #EEEAE2 30%, #F7F5F0 50%, #EEEAE2 70%);
  background-size: 300% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.skeleton-line { display: block; height: 12px; border-radius: 6px; width: 70%; }
.skeleton-line.short { width: 40%; margin-top: 8px; }

/* ---- Notices / badges / chips ---- */
.notices { display: grid; gap: 8px; margin-bottom: 24px; }
.notice {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  background: var(--surface);
  border: 1px solid var(--line);
  margin-bottom: 12px;
}
.notices .notice { margin: 0; }
.notice--error { background: var(--error-soft); border-color: #F1CFC6; color: var(--error); }
.notice--warning { background: var(--warn-soft); border-color: #EEDDB5; color: var(--warn); }

.badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow-sm);
}
.badge--live { color: var(--accent); }
.badge--error { color: var(--error); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  font-size: 0.8rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.12);
  flex: none;
}
.dots { display: inline-flex; gap: 4px; }

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 28px;
}
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs span:last-child { color: var(--ink-2); }

/* ================================================
   Studio
   ================================================ */
.studio-head { margin-bottom: 32px; }

.composer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.composer-brief {
  position: relative;
  padding: 28px 32px 22px;
  border-bottom: 1px solid var(--line);
}
.brief-input {
  width: 100%;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  font-size: 1.2rem;
  line-height: 1.5;
  min-height: 7.5em;
}
.brief-input::placeholder { color: #ADA79B; }

.refs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.ref-thumbs { display: contents; }
.ref-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
}
.ref-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ref-thumb button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 0;
  background: rgba(22, 20, 15, .75);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s;
}
.ref-thumb:hover button, .ref-thumb button:focus-visible { opacity: 1; }
@media (hover: none) { .ref-thumb button { opacity: 1; } }

.ref-add {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px dashed var(--line-strong);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.ref-add:hover { border-color: var(--ink); background: var(--surface-2); }
.ref-add.is-hidden { display: none; }
.ref-hint { font-size: 0.78rem; color: var(--muted); }
.ref-warning { margin-top: 10px; font-size: 0.82rem; color: var(--warn); }

.drop-overlay {
  position: absolute;
  inset: 8px;
  display: none;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: rgba(246, 231, 221, .92);
  color: var(--accent);
  font-weight: 500;
  pointer-events: none;
}
.composer-brief.is-dragging .drop-overlay { display: grid; }

.composer-section {
  padding: 24px 32px;
  border-bottom: 1px solid var(--line);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 0.78rem; font-weight: 500; color: var(--ink-2); }

select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 40px;
  padding: 0 34px 0 12px;
  font-size: 0.88rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237A7469' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
  cursor: pointer;
  text-overflow: ellipsis;
  transition: border-color .15s;
}
select:hover { border-color: var(--ink-2); }
select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(22,20,15,.08); }
select.has-value { border-color: var(--ink); background-color: var(--surface-2); }

/* Color swatches */
.swatch-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  align-items: center;
  gap: 16px;
}
.swatch-row + .swatch-row { margin-top: 12px; }
.swatch-row-label { font-size: 0.85rem; font-weight: 500; }
.swatch-value { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); min-width: 120px; text-align: right; }

.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 0;
  background: var(--swatch, #fff);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.12);
  cursor: pointer;
  transition: transform .12s var(--ease);
}
.swatch:hover { transform: scale(1.12); }
.swatch.is-selected { box-shadow: inset 0 0 0 1px rgba(0,0,0,.12), 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.swatch--auto {
  width: auto;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.75rem;
  font-weight: 500;
}
.swatch--auto:hover { transform: none; background: var(--canvas); }
.swatch--custom {
  background: conic-gradient(#e74c3c, #f1c40f, #2ecc71, #3498db, #9b59b6, #e74c3c);
  overflow: hidden;
}
.swatch--custom.is-selected { background: var(--swatch); }
.swatch--custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.composer-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 32px;
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.footer-controls { display: flex; flex-wrap: wrap; gap: 24px; }
.select-compact { min-width: 220px; }

.segmented {
  display: inline-flex;
  align-self: flex-start;
  padding: 3px;
  border-radius: 999px;
  background: var(--canvas);
  border: 1px solid var(--line);
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 32px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.segmented span:hover { color: var(--ink); }
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }

/* ---- Session cards (recent + library) ---- */
.recent { margin-top: 72px; }
.section-head, .page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.page-head { margin-bottom: 36px; }

.session-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.session-grid--wide { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.session-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}
.session-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.session-cover {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #F1EEE8;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.session-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.session-card:hover .session-cover img { transform: scale(1.03); }
.session-cover-empty { font-size: 0.8rem; color: var(--muted); }
.session-info { padding: 14px 16px 16px; }
.session-info h3 { font-size: 0.98rem; font-weight: 600; margin-bottom: 2px; }
.session-brief {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty {
  text-align: center;
  padding: 80px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
}
.empty p { color: var(--muted); margin: 8px 0 24px; }

/* ================================================
   Collection
   ================================================ */
.collection-head {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 48px;
  align-items: end;
  margin-bottom: 36px;
}
.collection-aside { display: grid; gap: 18px; }
.aside-block { display: grid; gap: 8px; }
.aside-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.ref-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.ref-strip img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  transition: transform .15s;
}
.ref-strip a:hover img { transform: scale(1.05); }

.progress-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 24px;
}
.progress-text { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; font-weight: 500; }
.progress-count { margin-left: auto; color: var(--muted); font-weight: 400; font-size: 0.85rem; }
.progress-bar { height: 4px; border-radius: 4px; background: var(--canvas); margin-top: 12px; overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: var(--ink); border-radius: 4px; transition: width .6s var(--ease); }

.design-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px 24px;
}

.design-frame { position: relative; }
.design-link { display: block; text-decoration: none; }
.design-media {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  transition: box-shadow .25s var(--ease), transform .25s var(--ease);
}
.design-card:hover .design-media { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.design-media img { width: 100%; height: 100%; object-fit: cover; grid-area: 1 / 1; transition: opacity .35s var(--ease); }
.design-media .design-media-alt { object-fit: contain; padding: 12%; background: var(--surface-2); opacity: 0; }
.design-card:hover .design-media-alt { opacity: 1; }
.design-media-empty { font-size: 0.85rem; color: var(--muted); }
.design-num {
  position: absolute;
  top: 12px;
  left: 14px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--ink-2);
  mix-blend-mode: multiply;
}

.design-info { padding: 14px 2px 0; }
.design-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.design-info h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.45rem;
  line-height: 1.15;
}
.design-info .meta { margin-top: 2px; }
.design-error { font-size: 0.8rem; color: var(--error); margin-top: 6px; }

.design-card.is-pending .design-link { pointer-events: none; }
.design-card.is-failed .design-media { background: var(--surface-2); }
.design-card.is-failed h3 { color: var(--muted); }

/* ================================================
   Design detail
   ================================================ */
.detail-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
.detail-topbar .crumbs { margin: 0; }
.pager { display: flex; align-items: center; gap: 10px; flex: none; }
.pager-count { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

.viewer { position: sticky; top: 84px; }
.tabs {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  margin-bottom: 14px;
}
.tab {
  border: 0;
  background: none;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}
.tab.is-active { background: var(--ink); color: #fff; }

.viewer-stage {
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.viewer-stage img { width: 100%; height: 100%; object-fit: contain; }
.viewer-stage[data-panel="artwork"] img { padding: 6%; }
.viewer-empty { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 0.9rem; }
.viewer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.checkerboard {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #F1EEE8 25%, transparent 25%),
    linear-gradient(-45deg, #F1EEE8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #F1EEE8 75%),
    linear-gradient(-45deg, transparent 75%, #F1EEE8 75%);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}

.spec .lede { margin-bottom: 28px; }

.color-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 32px; }
.color-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}
.color-card strong { display: block; font-size: 0.92rem; font-weight: 600; }
.color-card code { color: var(--muted); }
.color-chip {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.1);
  flex: none;
}

.spec-sheet { display: grid; gap: 28px; }
.spec-group .section-label { margin-bottom: 4px; }
.spec-row {
  display: grid;
  grid-template-columns: 42% 1fr;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.spec-row dt { color: var(--muted); }
.spec-row dd { font-weight: 500; }

.head-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

/* ================================================
   Collections: selection, picker, curated pages
   ================================================ */
.grid-hint { margin: -8px 0 18px; }

/* Card overlays */
.card-check {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 30px;
  height: 30px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s;
}
.card-check input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.card-check span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(255,255,255,.92);
  box-shadow: inset 0 0 0 1.5px var(--line-strong), var(--shadow-sm);
  transition: background .15s, box-shadow .15s;
}
.card-check input:checked + span {
  background: var(--ink);
  box-shadow: none;
}
.card-check input:checked + span::after {
  content: "";
  width: 10px;
  height: 6px;
  border: 2px solid #fff;
  border-top: 0;
  border-right: 0;
  transform: translateY(-1px) rotate(-45deg);
}
.card-check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.design-card:hover .card-check,
.design-card.is-selected .card-check,
.is-selecting .card-check { opacity: 1; }
@media (hover: none) { .card-check { opacity: 1; } }

.card-action {
  position: absolute;
  z-index: 2;
  right: 12px;
  bottom: 12px;
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .15s, transform .15s var(--ease);
}
.card-action--danger { background: rgba(255,255,255,.95); color: var(--error); box-shadow: var(--shadow-sm); }
.design-card:hover .card-action,
.card-action:focus-visible { opacity: 1; transform: none; }
.is-selecting .card-action { display: none; }
@media (hover: none) { .card-action { opacity: 1; transform: none; } }

.design-card.is-selected .design-media { box-shadow: 0 0 0 3px var(--ink); }
.is-selecting .design-card:not(.is-selected):not(.is-pending) .design-media img:not(.design-media-alt) { opacity: .6; }
.is-selecting .design-card:hover .design-media-alt { opacity: 0; }
.is-selecting .design-card:hover .design-media { transform: none; }

.in-badge {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.design-source { margin-top: 2px; }

/* Floating selection bar */
.selection-bar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 8px 8px 20px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  animation: rise .2s var(--ease);
}
.selection-bar[hidden] { display: none; }
.selection-count { font-size: 0.9rem; font-weight: 600; margin-right: 8px; white-space: nowrap; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 10px); } }

.btn--text { background: none; color: var(--muted); padding: 0 10px; }
.btn--text:hover { color: var(--ink); }
.btn--danger { color: var(--error); }
.btn--danger:hover { border-color: var(--error); }
.btn--danger-solid { background: var(--error); }
.btn--danger-solid:hover:not(:disabled) { background: #8A2817; }

/* Text inputs */
.text-input {
  height: 40px;
  padding: 0 14px;
  font-size: 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
.text-input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(22,20,15,.08); }
.text-input--display {
  font-family: var(--font-display);
  font-size: 2rem;
  height: 56px;
  border-radius: var(--radius);
  flex: 1;
}
.inline-form { display: flex; gap: 8px; align-items: center; }
.page-head .inline-form .text-input { width: 240px; }

/* Picker dialog */
.modal {
  border: 0;
  padding: 0;
  margin: auto;
  width: min(480px, calc(100vw - 32px));
  max-height: min(640px, calc(100vh - 48px));
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}
.modal::backdrop { background: rgba(22, 20, 15, .35); backdrop-filter: blur(2px); }
.modal[open] { animation: pop .18s var(--ease); }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } }
.modal-inner { display: flex; flex-direction: column; max-height: inherit; }
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 22px 14px;
}
.modal-list {
  overflow-y: auto;
  padding: 0 12px;
  display: grid;
  gap: 2px;
  min-height: 56px;
}
.modal-loading, .modal-empty { padding: 14px 10px; display: flex; align-items: center; gap: 10px; }
.picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  text-align: left;
  cursor: pointer;
  transition: background .12s;
}
.picker-row:hover:not(:disabled) { background: var(--surface-2); }
.picker-row:disabled { cursor: default; }
.picker-text { display: grid; min-width: 0; }
.picker-name { font-weight: 600; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-state { font-size: 0.8rem; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.picker-row:hover:not(:disabled) .picker-state { color: var(--accent); }
.picker-row:disabled .picker-state { color: var(--ok); }
.modal-new {
  display: grid;
  gap: 8px;
  padding: 16px 22px 22px;
  margin-top: 8px;
  border-top: 1px solid var(--line);
}
.modal-new .text-input { flex: 1; }
.modal-error { margin: -10px 22px 18px; font-size: 0.85rem; color: var(--error); }

/* Toasts */
.toasts {
  position: fixed;
  top: 76px;
  right: 24px;
  z-index: 100;
  display: grid;
  gap: 8px;
  justify-items: end;
}
.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 420px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-size: 0.88rem;
  box-shadow: var(--shadow-lg);
  animation: slide-in .2s var(--ease);
  transition: opacity .4s, transform .4s;
}
.toast a { color: #fff; font-weight: 600; white-space: nowrap; text-underline-offset: 3px; }
.toast--error { background: var(--error); }
.toast.is-leaving { opacity: 0; transform: translateY(-6px); }
@keyframes slide-in { from { opacity: 0; transform: translateY(-8px); } }

/* Detail: shortlist panel */
.shortlist-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  margin-bottom: 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}
.shortlist-panel .chips { margin-top: 6px; }
.shortlist-panel a { text-underline-offset: 3px; }
.chip--link { text-decoration: none; transition: border-color .15s; }
.chip--link:hover { border-color: var(--ink); }

/* Collection pages */
.collection-head--curated { align-items: start; }
.collection-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.title-edit .inline-form { margin-top: 4px; }
.status-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.status-pill {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--canvas);
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
}
.status-pill--final { background: var(--ink); border-color: var(--ink); color: #fff; }
.badge--final { background: var(--ink); color: #fff; }

.mosaic { display: grid; gap: 2px; background: var(--line); }
.mosaic img { width: 100%; height: 100%; object-fit: cover; background: #fff; }
.mosaic--1 { grid-template: 1fr / 1fr; }
.mosaic--2 { grid-template: 1fr / 1fr 1fr; }
.mosaic--3 { grid-template: 1fr 1fr / 1fr 1fr; }
.mosaic--3 img:first-child { grid-row: span 2; }
.mosaic--4 { grid-template: 1fr 1fr / 1fr 1fr; }
.mosaic--0 { background: #F1EEE8; }
.mosaic .session-cover-empty { padding: 0 24px; text-align: center; }
.mosaic .badge { z-index: 1; }

/* ================================================
   Responsive
   ================================================ */
@media (max-width: 1080px) {
  .field-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .session-grid--wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .design-grid, .session-grid, .session-grid--wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .collection-head, .detail-layout { grid-template-columns: 1fr; gap: 28px; }
  .viewer { position: static; }
  .composer-footer { flex-direction: column; align-items: stretch; }
  .composer-footer .btn { width: 100%; }
  .swatch-row { grid-template-columns: 1fr; gap: 8px; }
  .swatch-value { text-align: left; }
}

@media (max-width: 900px) {
  .collection-actions { justify-content: flex-start; }
  .page-head { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 600px) {
  .selection-bar { left: 16px; right: 16px; transform: none; bottom: 16px; flex-wrap: wrap; border-radius: var(--radius); padding: 10px 12px; }
  .selection-bar [data-selection-go] { flex: 1; }
  @keyframes rise { from { opacity: 0; transform: translateY(10px); } }
  .shortlist-panel { flex-direction: column; align-items: stretch; }
  .page-head .inline-form, .page-head .inline-form .text-input { width: 100%; }
  .toasts { left: 16px; right: 16px; }

  .topbar-inner, .page, .footer { padding-left: 16px; padding-right: 16px; }
  .wordmark { font-size: 1.3rem; white-space: nowrap; }
  .topnav a { padding: 6px 9px; font-size: 0.82rem; }
  .page { padding-top: 32px; }
  .composer-brief, .composer-section, .composer-footer { padding-left: 18px; padding-right: 18px; }
  .field-grid { grid-template-columns: 1fr 1fr; }
  .design-grid, .session-grid, .session-grid--wide { grid-template-columns: 1fr; }
  .color-cards { grid-template-columns: 1fr; }
  .detail-topbar { flex-direction: column; align-items: flex-start; }
  .footer { flex-direction: column; gap: 4px; }
  .select-compact { min-width: 0; width: 100%; }
  .footer-controls, .footer-controls .field { width: 100%; }
}

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

/* ---- Generation driver ---- */
.progress-note { margin-top: 10px; }
.notice--action { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.card-action--retry { background: rgba(255,255,255,.95); color: var(--ink); box-shadow: var(--shadow-sm); opacity: 1; transform: none; }

/* ---- Access ---- */
.notice--success { background: #EEF6F0; border-color: #CFE5D6; color: var(--ok); }
.nav-form { display: inline; }
.nav-lock {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 5px 13px;
  margin-left: 8px;
  cursor: pointer;
  text-decoration: none;
}
.nav-lock:hover { color: var(--ink); border-color: var(--ink); }
.submit-group { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.submit-group .text-input { width: 220px; height: 48px; }
.login { max-width: 420px; margin: 40px auto; }
.login .meta { margin: 8px 0 24px; }
.login-form { display: grid; gap: 14px; justify-items: start; }
.login-form .field, .login-form .text-input { width: 100%; }
@media (max-width: 600px) {
  .submit-group, .submit-group .field, .submit-group .text-input { width: 100%; }
  .nav-lock { margin-left: 2px; padding: 5px 9px; }
}
