@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Inter:wght@400;500;600;700&display=swap');

:root,
[data-theme="light"] {
  /* Light Theme — "Warm Clay & Kiln Light / Unglazed Porcelain" */
  --bg-surface: #FAF6F0;
  --bg-card: #FFFFFF;
  --bg-low: #F4EEE6;
  --bg-container: #EDE5DA;
  --bg-high: #E5DBCD;
  --text-main: #211C18;
  --text-muted: #5C5246;
  --text-subtle: #7B7062;
  --outline: #8D8173;
  --outline-variant: #DFD5C7;

  /* Kiln Ember Accent — Primary Studio Actions */
  --ember: #B84320;
  --ember-hover: #9E3617;
  --on-ember: #FFFFFF;
  --ember-container: #FDE5DC;
  --on-ember-container: #3D1003;

  /* Semantic Accents */
  --celadon: #2E6B56;
  --amber-warn: #8A5800;
  --amber-bg: #FCECC9;
  --error: #B82020;

  /* 5-Stage Semantic Ramp (Light) */
  --stage-formed-fg: #3F5338;
  --stage-formed-bg: #E2ECD9;
  --stage-trimmed-fg: #6E4C30;
  --stage-trimmed-bg: #EFE2D3;
  --stage-bisqued-fg: #855A10;
  --stage-bisqued-bg: #F8E8C8;
  --stage-glazed-fg: #2D5378;
  --stage-glazed-bg: #DCE8F5;
  --stage-fired-fg: #1C544B;
  --stage-fired-bg: #CEEBE2;

  --shadow-sm: 0 1px 3px rgba(33, 28, 24, 0.05);
  --shadow-card: 0 4px 16px -2px rgba(33, 28, 24, 0.07), 0 2px 6px -1px rgba(33, 28, 24, 0.04);
  --shadow-card-hover: 0 12px 28px -4px rgba(33, 28, 24, 0.12), 0 4px 10px -2px rgba(33, 28, 24, 0.06);
  --shadow-drawer: -12px 0 40px rgba(23, 19, 16, 0.18);
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 11px;
  --radius-sm: 8px;
  --radius-pill: 999px;
}

[data-theme="dark"] {
  /* Dark Theme — "Reduction Kiln Charcoal" */
  --bg-surface: #15120F;
  --bg-card: #1E1915;
  --bg-low: #221D18;
  --bg-container: #2B241E;
  --bg-high: #362E26;
  --text-main: #F2EBE1;
  --text-muted: #C7BBAE;
  --text-subtle: #9A8E80;
  --outline: #8E8274;
  --outline-variant: #383028;

  --ember: #F08A69;
  --ember-hover: #F59E82;
  --on-ember: #3E1002;
  --ember-container: #63220D;
  --on-ember-container: #FFDBCC;

  --celadon: #7CD0B4;
  --amber-warn: #F0C05A;
  --amber-bg: #3D2E10;
  --error: #FF897D;

  /* 5-Stage Semantic Ramp (Dark) */
  --stage-formed-fg: #B3C9A4;
  --stage-formed-bg: rgba(179, 201, 164, 0.16);
  --stage-trimmed-fg: #D4B092;
  --stage-trimmed-bg: rgba(212, 176, 146, 0.16);
  --stage-bisqued-fg: #E8C27E;
  --stage-bisqued-bg: rgba(232, 194, 126, 0.16);
  --stage-glazed-fg: #A4C4E5;
  --stage-glazed-bg: rgba(164, 196, 229, 0.16);
  --stage-fired-fg: #84D1BE;
  --stage-fired-bg: rgba(132, 209, 190, 0.16);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-card-hover: 0 12px 28px rgba(0, 0, 0, 0.5);
  --shadow-drawer: -12px 0 44px rgba(0, 0, 0, 0.65);
}

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

body {
  background-color: var(--bg-surface);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-feature-settings: "tnum" 1, "cv02" 1;
  line-height: 1.48;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.18s ease, color 0.18s ease;
}

h1, h2, h3, .serif-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.015em;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 0.95rem;
  color: inherit;
}

/* Sticky Frosted Top Bar */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg-surface) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--outline-variant);
}

.top-bar-inner {
  max-width: 1480px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--ember), #8E2E11);
  color: #FFFFFF;
  display: grid;
  place-items: center;
  box-shadow: 0 3px 10px rgba(184, 67, 32, 0.25);
  flex-shrink: 0;
}

.studio-title {
  font-size: 1.55rem;
  line-height: 1.15;
}

.studio-count-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-container);
  border: 1px solid var(--outline-variant);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

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

.eyebrow-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--ember-container);
  color: var(--on-ember-container);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.conn-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--outline-variant);
  box-shadow: var(--shadow-sm);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.conn-badge:hover {
  border-color: var(--outline);
}

.conn-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--outline);
}

.conn-dot[data-status="CONNECTED"] {
  background: var(--celadon);
  box-shadow: 0 0 0 3px rgba(46, 107, 86, 0.22);
}

.conn-dot[data-status="WAITING_FOR_PHONE"],
.conn-dot[data-status="CONNECTING"] {
  background: var(--amber-warn);
  box-shadow: 0 0 0 3px rgba(138, 88, 0, 0.18);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.08s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

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

.btn-ember {
  background: var(--ember);
  color: var(--on-ember);
  box-shadow: 0 2px 6px rgba(184, 67, 32, 0.24);
}

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

.btn-tonal {
  background: var(--bg-low);
  color: var(--text-main);
  border-color: var(--outline-variant);
}

.btn-tonal:hover {
  background: var(--bg-container);
  border-color: var(--outline);
}

.btn-outline {
  background: var(--bg-card);
  border-color: var(--outline);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--bg-low);
}

.btn-danger {
  background: transparent;
  border-color: color-mix(in srgb, var(--error) 45%, transparent);
  color: var(--error);
}

.btn-danger:hover {
  background: color-mix(in srgb, var(--error) 10%, transparent);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
  border-radius: 9px;
}

/* Main Workspace */
.workspace {
  max-width: 1480px;
  margin: 0 auto;
  padding: 22px 28px 72px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Pipeline Stage Bar */
.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 12px;
}

@media (max-width: 1080px) {
  .pipeline-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .pipeline-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.pipeline-card {
  position: relative;
  overflow: hidden;
  background: var(--bg-card);
  border: 1.5px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.pipeline-card:hover {
  transform: translateY(-2px);
  border-color: var(--outline);
  box-shadow: var(--shadow-card);
}

.pipeline-card[data-active="true"] {
  border-color: var(--ember);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ember) 25%, transparent);
  background: color-mix(in srgb, var(--ember-container) 28%, var(--bg-card));
}

.pipeline-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.pipeline-count {
  font-family: 'Fraunces', serif;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.pipeline-subtext {
  font-size: 0.76rem;
  color: var(--text-subtle);
  font-weight: 500;
}

.pipeline-bar-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: var(--bg-low);
}

.pipeline-bar-fill {
  height: 100%;
  background: var(--ember);
  transition: width 0.3s ease;
}

/* Stage Chip (Always Color + Icon + Label) */
.stage-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.stage-chip svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.stage-ALL {
  background: var(--bg-container);
  color: var(--text-main);
}
.stage-FORMED {
  background: var(--stage-formed-bg);
  color: var(--stage-formed-fg);
}
.stage-TRIMMED {
  background: var(--stage-trimmed-bg);
  color: var(--stage-trimmed-fg);
}
.stage-BISQUED {
  background: var(--stage-bisqued-bg);
  color: var(--stage-bisqued-fg);
}
.stage-GLAZED {
  background: var(--stage-glazed-bg);
  color: var(--stage-glazed-fg);
}
.stage-FIRED {
  background: var(--stage-fired-bg);
  color: var(--stage-fired-fg);
}

/* Firing Turnaround Banner */
.turnaround-panel {
  background: linear-gradient(180deg, var(--bg-card), var(--bg-low));
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.turnaround-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.turnaround-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--ember-container);
  display: grid;
  place-items: center;
  font-size: 1.05rem;
}

.turnaround-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.waiting-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.waiting-chips:empty {
  display: none;
}

.waiting-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--outline-variant);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease;
}

.waiting-pill:hover {
  border-color: var(--ember);
  transform: translateY(-1px);
}

.waiting-pill[data-overdue="true"] {
  background: var(--amber-bg);
  color: var(--amber-warn);
  border-color: var(--amber-warn);
  font-weight: 600;
}

/* Search, Filter & Density Toolbar Card */
.toolbar-card {
  background: var(--bg-card);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1 1 280px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 13px;
  color: var(--text-subtle);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--outline-variant);
  background: var(--bg-surface);
  font-size: 0.93rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--ember);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ember) 18%, transparent);
}

.filter-select {
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--outline-variant);
  background: var(--bg-surface);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
}

.filter-select:focus {
  outline: none;
  border-color: var(--ember);
}

.toolbar-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--outline-variant);
  flex-wrap: wrap;
}

.results-summary {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
}

.density-toggle {
  display: inline-flex;
  background: var(--bg-low);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--outline-variant);
}

.density-btn {
  padding: 5px 12px;
  border-radius: 7px;
  border: none;
  background: transparent;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.density-btn.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

/* Piece Cards Grid */
.pieces-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 18px;
}

.pieces-grid[data-density="compact"] {
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 12px;
}

.pieces-grid[data-density="list"] {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.piece-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 340px;
  background: var(--bg-card);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.16s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.16s ease, border-color 0.16s ease;
}

.piece-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--outline);
}

.piece-card[data-selected="true"] {
  border: 2px solid var(--ember);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ember) 22%, transparent);
}

/* Table / List density layout */
.pieces-grid[data-density="list"] .piece-card {
  contain-intrinsic-size: auto 76px;
  flex-direction: row;
  align-items: center;
  padding: 8px 14px;
  gap: 16px;
}

.pieces-grid[data-density="list"] .piece-thumb-wrap {
  width: 68px;
  height: 56px;
  aspect-ratio: auto;
  border-radius: 9px;
  flex-shrink: 0;
}

.pieces-grid[data-density="list"] .piece-card-body {
  padding: 0;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.pieces-grid[data-density="list"] .piece-card-footer {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.piece-thumb-wrap {
  aspect-ratio: 4 / 3;
  background: var(--bg-low);
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-bottom: 1px solid var(--outline-variant);
}

@keyframes ceramicShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.piece-thumb-wrap[data-loading="true"] {
  background: linear-gradient(90deg, var(--bg-low) 25%, var(--bg-container) 50%, var(--bg-low) 75%);
  background-size: 200% 100%;
  animation: ceramicShimmer 1.8s infinite linear;
}

.piece-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.35s ease;
}

.piece-thumb-wrap img.is-loaded {
  opacity: 1;
}

.piece-card:hover .piece-thumb-wrap img.is-loaded {
  transform: scale(1.03);
}

.piece-thumb-placeholder {
  color: var(--text-subtle);
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px;
  text-align: center;
}

.piece-thumb-placeholder svg {
  width: 28px;
  height: 28px;
  opacity: 0.55;
}

.photo-count-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(25, 20, 16, 0.72);
  backdrop-filter: blur(6px);
  color: #FAF6F0;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 600;
}

.piece-card-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1;
}

.piece-card-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.28;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.piece-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-low);
  border: 1px solid var(--outline-variant);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-pill-glaze {
  background: color-mix(in srgb, var(--stage-glazed-bg) 55%, var(--bg-low));
  color: var(--stage-glazed-fg);
  border-color: color-mix(in srgb, var(--stage-glazed-fg) 22%, transparent);
}

.piece-card-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--outline-variant);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.quick-advance-btn {
  padding: 4px 9px;
  border-radius: 7px;
  border: 1px solid var(--outline-variant);
  background: var(--bg-low);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.quick-advance-btn:hover {
  background: var(--ember);
  border-color: var(--ember);
  color: var(--on-ember);
}

/* Detail Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(25, 20, 16, 0.42);
  backdrop-filter: blur(3px);
  z-index: 50;
  display: flex;
  justify-content: flex-end;
}

.drawer-backdrop[hidden] {
  display: none;
}

.detail-drawer {
  width: min(720px, 100vw);
  height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--outline-variant);
  box-shadow: var(--shadow-drawer);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.drawer-header {
  padding: 18px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--outline-variant);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drawer-body {
  padding: 20px 24px 56px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.section-card {
  background: var(--bg-card);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-title {
  font-size: 0.96rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Hero Photo Viewer in Drawer */
.drawer-hero-photo {
  aspect-ratio: 16 / 10;
  background: var(--bg-low);
  border-radius: var(--radius-md);
  border: 1px solid var(--outline-variant);
  overflow: hidden;
  position: relative;
  display: grid;
  place-items: center;
}

.drawer-hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #14110E;
}

.drawer-hero-actions {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
}

/* Stage Stepper in Detail Drawer */
.stepper-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.stepper-btn {
  padding: 10px 6px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--outline-variant);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.stepper-btn:hover {
  border-color: var(--outline);
}

.stepper-btn svg {
  width: 18px;
  height: 18px;
}

.stepper-btn[data-current="true"] {
  border-color: var(--ember);
  background: var(--ember-container);
  color: var(--on-ember-container);
}

/* Photo Gallery inside Detail */
.photo-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
}

.photo-tile {
  aspect-ratio: 1;
  background: var(--bg-low);
  border-radius: var(--radius-md);
  border: 2px solid var(--outline-variant);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.photo-tile:hover {
  transform: translateY(-2px);
  border-color: var(--ember);
}

.photo-tile[data-active-hero="true"] {
  border-color: var(--ember);
}

.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-tile-label {
  position: absolute;
  bottom: 5px;
  left: 5px;
  right: 5px;
  background: rgba(23, 19, 16, 0.76);
  color: #FAF6F0;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dropzone {
  border: 1.5px dashed var(--outline);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
  font-size: 0.86rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--ember);
  background: var(--ember-container);
  color: var(--on-ember-container);
}

/* Forms & Grids */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.field-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.field-input {
  padding: 8px 11px;
  border-radius: 9px;
  border: 1px solid var(--outline-variant);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.9rem;
}

.field-input:focus {
  outline: none;
  border-color: var(--ember);
}

/* Timeline List */
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--outline-variant);
}

/* Dialogs */
dialog.modal {
  margin: auto;
  width: min(560px, 94vw);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  color: var(--text-main);
  padding: 24px;
  box-shadow: 0 24px 60px rgba(23, 19, 16, 0.32);
}

dialog.modal::backdrop {
  background: rgba(23, 19, 16, 0.52);
  backdrop-filter: blur(3px);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.canvas-wrap {
  background: #171310;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: grid;
  place-items: center;
  max-height: 400px;
  margin: 12px 0;
}

.canvas-wrap canvas {
  max-width: 100%;
  max-height: 380px;
}

.code-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.84rem;
  background: var(--bg-surface);
  padding: 11px 12px;
  border-radius: var(--radius-md);
  word-break: break-all;
  border: 1px solid var(--outline-variant);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-main);
  color: var(--bg-surface);
  padding: 11px 20px;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 100;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
}

[hidden] {
  display: none !important;
}

/* Pre-Link QR Gate Card */
.link-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 0%, var(--bg-low), var(--bg-surface) 70%);
}

.link-card {
  width: min(860px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--outline-variant);
  border-radius: 24px;
  padding: 32px;
  box-shadow: var(--shadow-card-hover);
}

.link-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--outline-variant);
}

.link-grid {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 32px;
  align-items: start;
}

@media (max-width: 720px) {
  .link-grid {
    grid-template-columns: 1fr;
  }
}

.qr-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  background: var(--bg-low);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.qr-frame {
  background: #FFFFFF;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid #E5DBCD;
  box-shadow: 0 4px 14px rgba(33, 28, 24, 0.08);
  display: grid;
  place-items: center;
}

.qr-frame svg {
  display: block;
}

.link-steps {
  margin: 0 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.94rem;
}

.manual-link-box {
  background: var(--bg-low);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-md);
  padding: 16px;
}
