:root {
  color-scheme: light;
  --bg: #edf1ea;
  --surface: #fffdf7;
  --surface-soft: #f3f1e8;
  --soft: #f3f1e8;
  --text: #29342f;
  --ink: #29342f;
  --muted: #6e7972;
  --line: #d6dbd2;
  --accent: #52786c;
  --accent-strong: #365c52;
  --accent-soft: #e4eee7;
  --mist: #d8e8e6;
  --sage: #a9bda9;
  --peach: #f2d6c4;
  --warn: #9a6228;
  --danger: #a94f46;
  --shadow: 0 18px 48px rgba(52, 70, 61, 0.11);
  --shadow-soft: 0 8px 24px rgba(52, 70, 61, 0.08);
  --focus: 0 0 0 3px rgba(82, 120, 108, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

html {
  min-height: 100%;
  overflow-y: scroll;
  scrollbar-color: #789388 #e3e9e2;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
}

html::-webkit-scrollbar {
  width: 16px;
}

html::-webkit-scrollbar-track {
  background: #e3e9e2;
}

html::-webkit-scrollbar-thumb {
  border: 3px solid #e3e9e2;
  border-radius: 999px;
  background: #789388;
}

html::-webkit-scrollbar-thumb:hover {
  background: var(--accent-strong);
}

body {
  min-height: 100dvh;
  margin: 0;
  overflow-y: visible;
  background:
    radial-gradient(circle at 8% 0%, rgba(242, 214, 196, 0.5), transparent 30rem),
    radial-gradient(circle at 92% 12%, rgba(216, 232, 230, 0.72), transparent 34rem),
    var(--bg);
  color: var(--ink);
  font: 15px/1.5 "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
}

.page-scrollbar {
  display: none !important;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  width: 22px;
  padding: 5px 4px;
  border-left: 1px solid rgba(33, 31, 29, 0.16);
  background: rgba(246, 242, 237, 0.96);
  box-shadow: -2px 0 10px rgba(45, 35, 25, 0.12);
  cursor: pointer;
  touch-action: none;
  user-select: none;
}

.page-scrollbar-thumb {
  position: absolute;
  left: 4px;
  right: 4px;
  top: 5px;
  min-height: 56px;
  border-radius: 999px;
  background: #625a52;
  box-shadow: 0 1px 6px rgba(45, 35, 25, 0.34);
}

.page-scrollbar:hover .page-scrollbar-thumb,
.page-scrollbar.dragging .page-scrollbar-thumb {
  background: var(--accent);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 12px 20px;
  background: rgba(255, 250, 245, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.1;
}

h2 {
  font-size: 20px;
}

.page-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.environment-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #7c3aed;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.auth-environment-badge {
  justify-self: start;
}

html[data-environment="qa"] .topbar {
  box-shadow: inset 0 3px #7c3aed;
}

.topbar p,
.section-heading p,
.summary-list {
  color: var(--muted);
}

.top-actions,
.slide-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.account-usage {
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 12px;
}

.account-usage-main {
  min-width: 112px;
}

.account-usage strong,
.account-usage span {
  display: block;
  white-space: nowrap;
}

.account-usage-bar {
  width: 58px;
  height: 6px;
  flex: 0 0 58px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.account-usage-bar span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 0.2s ease;
}

.period-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.period-control select {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font: inherit;
}

.period-custom-range {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-left: 2px;
}

.period-date {
  width: 112px;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font: inherit;
  font-size: 12px;
}

.profile-menu-wrap {
  position: relative;
}

.profile-button {
  min-width: 78px;
}

.profile-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 90;
  display: grid;
  gap: 8px;
  width: min(280px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 12px;
  box-shadow: var(--shadow);
}

.profile-menu-label,
.profile-menu span {
  color: var(--muted);
  font-size: 12px;
}

.profile-menu strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-only-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-weight: 650;
  cursor: pointer;
  user-select: none;
}

.selected-only-toggle:hover {
  background: #eee6dd;
}

.selected-only-toggle.active {
  border-color: var(--accent);
  background: #e8f2ef;
}

.selected-only-toggle input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.selected-only-toggle span {
  white-space: nowrap;
}

.review-filter-button {
  font: inherit;
}

.selected-filter-control,
.generate-scope-control,
.review-filter-control {
  position: relative;
  display: inline-flex;
  z-index: 20;
}

.selected-filter-control.open,
.generate-scope-control.open,
.review-filter-control.open {
  z-index: 6000;
}

.selected-level-menu,
.generate-scope-menu,
.review-filter-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  z-index: 6100;
  display: grid;
  gap: 6px;
  min-width: 156px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.selected-filter-control:hover .selected-level-menu,
.selected-filter-control:focus-within .selected-level-menu,
.selected-filter-control.open .selected-level-menu,
.generate-scope-control:hover .generate-scope-menu,
.generate-scope-control:focus-within .generate-scope-menu,
.generate-scope-control.open .generate-scope-menu,
.review-filter-control:hover .review-filter-menu,
.review-filter-control:focus-within .review-filter-menu,
.review-filter-control.open .review-filter-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.selected-level-menu::before,
.generate-scope-menu::before,
.review-filter-menu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -12px;
  height: 12px;
}

.level-menu-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.generate-cancel-button {
  min-width: 190px;
  min-height: 34px;
  padding: 0 12px;
  border-bottom: 1px solid rgba(176, 46, 36, 0.18);
  font-size: 13px;
  line-height: 1.15;
  white-space: normal;
}

.generate-cancel-button:disabled {
  border-color: var(--line);
  background: #eee6dd;
  color: var(--muted);
  cursor: default;
}

.level-menu-option:hover {
  background: #f2ece5;
}

.level-menu-option input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
}

.add-variant-control {
  position: relative;
  display: inline-flex;
  z-index: 1;
}

.add-variant-control::before {
  content: "";
  position: absolute;
  left: -10px;
  right: -10px;
  bottom: 100%;
  display: none;
  height: 16px;
}

.add-variant-control.open-below::before {
  top: 100%;
  bottom: auto;
}

.add-variant {
  min-width: 42px;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
}

.add-variant-menu {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  z-index: 1000;
  display: grid;
  grid-template-columns: repeat(5, 32px);
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.add-variant-control.open-below .add-variant-menu {
  top: calc(100% + 6px);
  bottom: auto;
  transform: translate(-50%, -4px);
}

.add-variant-control.open::before,
.add-variant-control:hover::before,
.add-variant-control:focus-within::before {
  display: block;
}

.add-variant-control.open .add-variant-menu,
.add-variant-control:hover .add-variant-menu,
.add-variant-control:focus-within .add-variant-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.add-variant-control.open-below.open .add-variant-menu,
.add-variant-control.open-below:hover .add-variant-menu,
.add-variant-control.open-below:focus-within .add-variant-menu {
  transform: translate(-50%, 0);
}

.add-variant-count {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.add-variant-count:hover,
.add-variant-count.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: white;
  text-decoration: none;
  font-weight: 650;
  cursor: pointer;
}

.button:hover {
  background: var(--accent-strong);
}

.button:disabled {
  cursor: default;
  opacity: 0.62;
}

.button.secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.button.secondary:hover {
  background: #eee6dd;
}

.button.choice {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.button.choice:hover {
  background: #eee6dd;
}

.button.choice.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.button.choice.level-1,
.button.level-1 {
  background: #1f6f64;
  color: #fff;
  border-color: #1f6f64;
}

.button.choice.level-2,
.button.level-2 {
  background: #a56719;
  color: #fff;
  border-color: #a56719;
}

.button.choice.level-3,
.button.level-3 {
  background: #8f2f45;
  color: #fff;
  border-color: #8f2f45;
}

.choice-level-control {
  position: relative;
  min-width: 0;
}

.choice-level-control .choose {
  width: 100%;
}

.choice-level-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  z-index: 80;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  width: max(100%, 138px);
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf4;
  box-shadow: 0 12px 30px rgba(33, 31, 29, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.choice-level-menu::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -12px;
  height: 12px;
}

.choice-level-control.open .choice-level-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.lightbox-choice-control {
  min-width: 112px;
  z-index: 90;
}

.lightbox-choice-control[hidden] {
  display: none;
}

.lightbox-choice-control.open {
  z-index: 7200;
}

.lightbox-choice-control .choice-level-menu {
  bottom: calc(100% - 1px);
  z-index: 7300;
  width: max(100%, 150px);
  transform: translateY(6px);
}

.lightbox-choice-control .choice-level-menu::after {
  bottom: -18px;
  height: 18px;
}

.choice-level-option {
  min-height: 30px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f6efe7;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.choice-level-option:hover,
.choice-level-option.active {
  border-color: var(--accent);
  background: #e8f2ef;
}

.choice-level-option.level-1.active,
.choice-level-option.level-1:hover {
  border-color: #1f6f64;
  background: #1f6f64;
  color: #fff;
}

.choice-level-option.level-2.active,
.choice-level-option.level-2:hover {
  border-color: #a56719;
  background: #a56719;
  color: #fff;
}

.choice-level-option.level-3.active,
.choice-level-option.level-3:hover {
  border-color: #8f2f45;
  background: #8f2f45;
  color: #fff;
}

.button.danger {
  background: #b3342b;
  color: white;
  border-color: #b3342b;
}

.button.danger:hover {
  background: #8f261f;
}

.hidden {
  display: none !important;
}

.product-home {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 420px));
  gap: 22px;
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 24px;
}

.product-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.product-cover {
  aspect-ratio: 3 / 4;
  background: #e4ddd5;
}

.product-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.empty-cover {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  font-weight: 750;
}

.product-body {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.product-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.product-title-editable {
  min-width: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  text-align: left;
  cursor: text;
  overflow-wrap: anywhere;
}

.product-title-edit {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.product-title-wrap:hover .product-title-edit,
.product-title-edit:focus {
  opacity: 1;
}

.product-title-edit:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.product-title-edit-input {
  width: min(460px, 76vw);
  min-height: 34px;
  padding: 4px 8px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-weight: inherit;
}

.product-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.product-actions .delete-product {
  margin-left: auto;
}

.product-title-input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
  font: inherit;
}

.create-product-card {
  display: grid;
  align-content: center;
  min-height: 260px;
  border-style: dashed;
  box-shadow: none;
}

.product-body p:empty {
  display: none;
}

.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: start;
  gap: 24px;
  width: 100%;
  max-width: 1720px;
  margin: 0 auto;
  padding: 24px;
  overflow: visible;
}

.layout.hidden {
  display: none !important;
}

.sidebar {
  position: sticky;
  top: 92px;
  z-index: 120;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.sidebar-title {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.common-photos {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.common-prompt-panel {
  display: grid;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.common-prompt-panel .button {
  width: 100%;
  min-height: 38px;
}

.common-prompt-modal-panel textarea {
  min-height: min(58vh, 520px);
  resize: vertical;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 13px;
  line-height: 1.45;
}

.common-photos .button {
  width: 100%;
  min-height: 34px;
}

.common-photo-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.common-empty {
  grid-column: 1 / -1;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.common-photo {
  position: relative;
  min-width: 0;
}

.common-photo-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  overflow: hidden;
  cursor: zoom-in;
}

.common-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.common-photo span {
  position: absolute;
  left: 4px;
  bottom: 4px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.delete-common-photo {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: #8f261f;
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
}

.common-photo:hover .delete-common-photo,
.delete-common-photo:focus {
  opacity: 1;
}

.slide-nav {
  display: grid;
  gap: 6px;
}

.slide-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  border-radius: 6px;
}

.slide-nav-item.nav-slide-dragging {
  opacity: 0.55;
}

.slide-nav a {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
}

.slide-nav a span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slide-nav a:hover,
.slide-nav-item:hover .slide-nav-link {
  background: #eee6dd;
}

.nav-slide-drag-handle {
  flex: 0 0 auto;
  width: 28px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f2ebe4;
  color: var(--muted);
  cursor: grab;
  touch-action: none;
}

.nav-slide-drag-handle:hover,
.nav-slide-drag-handle:focus {
  border-color: var(--accent);
  color: var(--accent);
  background: #e8f2ef;
  outline: none;
}

.nav-slide-drag-handle:active {
  cursor: grabbing;
}

.slide-nav-item.nav-drop-before::before,
.slide-nav-item.nav-drop-after::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
  z-index: 2;
}

.slide-nav-item.nav-drop-before::before {
  top: -4px;
}

.slide-nav-item.nav-drop-after::after {
  bottom: -4px;
}

.dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: #bbb1a7;
}

.dot.selected {
  background: var(--accent);
}

.content,
.slides {
  display: grid;
  gap: 22px;
  min-width: 0;
}

.slide-section,
.summary {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.slide-section {
  position: relative;
  z-index: 1;
  overflow: visible;
}

.slide-section.slide-dragging {
  opacity: 0.72;
}

.slide-section.slide-drop-before::before,
.slide-section.slide-drop-after::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  z-index: 3;
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(31, 111, 100, 0.14);
}

.slide-section.slide-drop-before::before {
  top: -12px;
}

.slide-section.slide-drop-after::after {
  bottom: -12px;
}

.slide-section.variant-menu-open {
  z-index: 80;
}

.slide-section.level-menu-open {
  z-index: 1600;
}

.summary {
  overflow: hidden;
}

.section-heading {
  position: relative;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 16px;
}

.slide-heading-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.slide-heading-copy {
  min-width: 0;
}

.slide-drag-handle {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f2ebe4;
  color: var(--muted);
  cursor: grab;
  touch-action: none;
}

.drag-dots {
  width: 14px;
  height: 18px;
  background-image: radial-gradient(circle, currentColor 1.7px, transparent 1.9px);
  background-position: 0 0;
  background-size: 7px 6px;
  pointer-events: none;
}

.slide-drag-handle:hover,
.slide-drag-handle:focus {
  border-color: var(--accent);
  color: var(--accent);
  background: #e8f2ef;
  outline: none;
}

.slide-drag-handle:active {
  cursor: grabbing;
}

.slide-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.slide-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.slide-title-editable {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  text-align: left;
  cursor: text;
  overflow-wrap: anywhere;
}

.slide-title-edit {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.slide-title-wrap:hover .slide-title-edit,
.slide-title-edit:focus {
  opacity: 1;
}

.slide-title-edit:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.slide-title-input {
  width: min(360px, 70vw);
  min-height: 34px;
  padding: 4px 8px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  font: inherit;
  font-weight: inherit;
}

.image-grid {
  display: flex;
  gap: 14px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  -ms-overflow-style: none;
  scrollbar-width: none;
  padding-bottom: 8px;
}

.image-grid::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.image-grid-scrollbar {
  display: block;
  position: relative;
  height: 24px;
  margin-top: 10px;
  border: 1px solid rgba(33, 31, 29, 0.18);
  border-radius: 999px;
  background: #e8ded4;
  box-shadow: inset 0 1px 3px rgba(45, 35, 25, 0.12);
  cursor: pointer;
  touch-action: none;
  user-select: none;
}

.image-grid-scrollbar-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  height: 14px;
  min-width: 72px;
  border-radius: 999px;
  background: #625a52;
  box-shadow: 0 1px 5px rgba(45, 35, 25, 0.28);
}

.image-grid-scrollbar:hover .image-grid-scrollbar-thumb,
.image-grid-scrollbar.dragging .image-grid-scrollbar-thumb {
  background: var(--accent);
}

.image-tile {
  position: relative;
  flex: 0 0 min(244px, calc((100% - 56px) / 5));
  min-width: 190px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #efe8df;
  overflow: hidden;
  scroll-snap-align: start;
}

.image-tile.selected {
  border-color: var(--accent);
}

.image-tile.selection-level-1 {
  border-color: #1f6f64;
}

.image-tile.selection-level-2 {
  border-color: #a56719;
}

.image-tile.selection-level-3 {
  border-color: #8f2f45;
}

.image-tile.original {
  opacity: 0.92;
}

.image-tile.source-placeholder {
  border-style: dashed;
}

.tile-delete-image {
  position: absolute;
  z-index: 2;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: #8f261f;
  font-size: 22px;
  font-weight: 850;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.image-tile:hover .tile-delete-image,
.tile-delete-image:focus {
  opacity: 1;
}

.tile-delete-image:hover {
  transform: scale(1.04);
}

.tile-drag-handle {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 8px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--muted);
  font-size: 18px;
  font-weight: 850;
  line-height: 1;
  cursor: grab;
  opacity: 0;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.image-tile:hover .tile-drag-handle {
  opacity: 1;
}

.image-tile.dragging {
  opacity: 0.55;
}

.image-tile.drag-over {
  outline: 3px solid rgba(31, 111, 100, 0.32);
  outline-offset: -3px;
}

.image-frame {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  aspect-ratio: 3 / 4;
  background: #e4ddd5;
  overflow: hidden;
}

.dimension-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 2;
  padding: 4px 7px;
  border-radius: 999px;
  background: #b42318;
  color: #fff;
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
}

.dimension-badge.edited {
  background: var(--accent);
}

.cache-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.20);
}

.cache-badge.cache-hit {
  background: #2e7d32;
  color: #fff;
}

.cache-badge.cache-miss {
  background: #757575;
  color: #fff;
}

.cache-badge.cache-unsupported {
  background: #e65100;
  color: #fff;
}

.cache-badge.cache-unreported {
  background: #1565c0;
  color: #fff;
}

button.image-frame {
  cursor: zoom-in;
}

.image-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tile-footer {
  display: grid;
  gap: 7px;
  padding: 9px;
}

.tile-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
}

.variant-name-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.variant-name-editable {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: text;
}

.variant-name-edit {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.variant-name-wrap:hover .variant-name-edit,
.variant-name-edit:focus {
  opacity: 1;
}

.variant-name-edit:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.variant-name-input {
  width: 100%;
  min-width: 0;
  height: 28px;
  padding: 3px 6px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}

.placeholder-tile {
  display: grid;
  place-items: center;
  min-height: 100%;
  padding: 22px;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.tile-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.tile-actions .button {
  min-width: 0;
  min-height: 30px;
  padding: 0 7px;
  font-size: 12px;
  line-height: 1.1;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}

.variant-download-control {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.variant-download-menu {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.variant-download-control.open .variant-download-menu {
  display: grid;
}

.download-format-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 28px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.download-format-option:hover,
.download-format-option:focus-visible,
.download-format-option.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  outline: none;
}

.generation-actions {
  grid-template-columns: 1fr;
}

.generation-status {
  grid-column: 1 / -1;
  padding: 6px 8px;
  border: 1px solid rgba(48, 104, 178, 0.22);
  border-radius: 6px;
  background: rgba(48, 104, 178, 0.08);
  color: #23548e;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.generation-error {
  grid-column: 1 / -1;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid rgba(176, 46, 36, 0.24);
  border-radius: 6px;
  background: rgba(176, 46, 36, 0.08);
  color: #8f261f;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  text-align: left;
  max-height: 56px;
  overflow: hidden;
  cursor: pointer;
}

.generation-error:hover,
.generation-error:focus-visible {
  border-color: rgba(176, 46, 36, 0.48);
  background: rgba(176, 46, 36, 0.13);
  outline: none;
}

.generation-error-message {
  display: block;
  max-height: 30px;
  overflow: hidden;
}

.generation-error-action {
  display: block;
  margin-top: 3px;
  color: #6f5345;
  font-size: 10px;
  font-weight: 850;
}

.generation-attempts {
  grid-column: 1 / -1;
  padding: 6px 8px;
  border: 1px solid rgba(106, 86, 51, 0.22);
  border-radius: 6px;
  background: rgba(245, 238, 224, 0.66);
  color: #55442d;
  font-size: 11px;
  line-height: 1.25;
}

.generation-attempts summary {
  cursor: pointer;
  font-weight: 800;
  list-style-position: inside;
}

.generation-attempt-list {
  display: grid;
  gap: 4px;
  max-height: 108px;
  margin-top: 6px;
  overflow: auto;
}

.generation-attempt-row {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px;
  align-items: start;
  border-radius: 4px;
  padding: 2px 3px;
  cursor: pointer;
}

.generation-attempt-row:hover,
.generation-attempt-row:focus-visible {
  background: rgba(255, 255, 255, 0.72);
  outline: 1px solid rgba(31, 111, 100, 0.22);
}

.generation-attempt-label {
  font-weight: 800;
  white-space: nowrap;
}

.generation-attempt-detail {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generation-attempt-row.failed .generation-attempt-label,
.generation-attempt-row.retrying .generation-attempt-label {
  color: #8f261f;
}

.generation-attempt-row.success .generation-attempt-label {
  color: #21725f;
}

.cancel-generation {
  grid-column: 1 / -1;
}

textarea {
  width: 100%;
  min-height: 56px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
  font: inherit;
}

.summary-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.add-slide-panel {
  display: grid;
  place-items: center;
  min-height: 96px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 245, 0.68);
}

.summary-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 160;
  box-sizing: border-box;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 12px;
  height: 100dvh;
  max-height: 100dvh;
  padding: 18px;
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgba(21, 18, 15, 0.86);
}

.lightbox-topbar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.lightbox-stage {
  position: relative;
  z-index: 1;
  width: min(1400px, calc(100vw - 150px));
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  display: grid;
  place-items: center;
  gap: 18px;
  justify-self: center;
  overflow: hidden;
}

.lightbox-stage.compare-mode {
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1fr);
  align-items: stretch;
  width: min(1420px, calc(100vw - 150px));
}

.lightbox-stage.compare-mode .lightbox-canvas {
  align-self: center;
  justify-self: center;
  width: min(100%, calc((100dvh - 170px) * var(--canvas-ratio-number, 0.75)));
}

.lightbox-canvas {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, calc((100dvh - 170px) * var(--canvas-ratio-number, 0.75)));
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: var(--canvas-ratio, 3 / 4);
  overflow: hidden;
  border-radius: 8px;
  background: #111;
}

.lightbox-canvas.dimension-mismatch {
  background:
    repeating-linear-gradient(
      45deg,
      rgba(180, 35, 24, 0.28) 0,
      rgba(180, 35, 24, 0.28) 12px,
      rgba(255, 255, 255, 0.1) 12px,
      rgba(255, 255, 255, 0.1) 24px
    ),
    #111;
}

.lightbox-main-image,
.source-image-wrap img {
  display: block;
  align-self: center;
  justify-self: center;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: transparent;
}

.lightbox-main-image {
  width: 100%;
  height: 100%;
}

.lightbox-diagnostic {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  padding: 8px 10px;
  border-radius: 7px;
  background: rgba(180, 35, 24, 0.94);
  color: #fff;
  font-size: 13px;
  font-weight: 850;
  text-align: center;
}

.source-image-wrap img {
  width: 100%;
  height: 100%;
}

.lightbox-close,
.lightbox-source-toggle {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  cursor: pointer;
}

.lightbox-source-toggle.active {
  background: var(--accent);
  border-color: var(--accent);
}

.lightbox-source-toggle:disabled {
  opacity: 0.48;
  cursor: default;
}

.lightbox-peek-original {
  width: 38px;
  min-width: 38px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.lightbox-peek-original svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.lightbox-peek-original.active {
  background: var(--accent);
  border-color: var(--accent);
}

.lightbox-sources-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.source-panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: white;
  font-weight: 800;
}

.source-panel-heading span {
  color: rgba(255, 255, 255, 0.76);
}

.source-image-wrap {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #111;
}

.source-image-wrap img {
  width: 100%;
  height: 100%;
}

.source-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 36px;
  height: 52px;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.32);
  color: white;
  font-size: 32px;
  cursor: pointer;
}

.source-nav.prev {
  left: 8px;
}

.source-nav.next {
  right: 8px;
}

.source-nav:disabled {
  display: none;
}

.source-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.source-thumb {
  position: relative;
  flex: 0 0 58px;
  width: 58px;
  height: 58px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
}

.source-thumb.active {
  border-color: var(--accent);
}

.source-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.source-thumb span {
  position: absolute;
  left: 4px;
  bottom: 4px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 11px;
  font-weight: 850;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  width: 48px;
  height: 72px;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.13);
  color: white;
  font-size: 46px;
  line-height: 1;
  cursor: pointer;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.24);
}

.lightbox-nav.prev {
  left: 24px;
}

.lightbox-nav.next {
  right: 24px;
}

.lightbox-caption {
  position: relative;
  z-index: 2;
  justify-self: center;
  color: white;
  font-weight: 750;
  pointer-events: none;
}

.lightbox-actions {
  position: relative;
  z-index: 7000;
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lightbox-actions .button {
  min-width: 112px;
}

.lightbox-actions .button.secondary {
  color: white;
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.12);
}

.lightbox-actions .button.secondary:hover {
  background: rgba(255, 255, 255, 0.24);
}

.lightbox-actions .button.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.variant-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(21, 18, 15, 0.78);
}

.variant-editor-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  width: min(1480px, calc(100vw - 36px));
  height: min(920px, calc(100dvh - 36px));
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 16px;
}

.variant-editor-header,
.variant-editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.variant-editor-header p {
  color: var(--muted);
  font-weight: 700;
}

.variant-editor-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 16px;
  min-height: 0;
}

.variant-editor-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    repeating-linear-gradient(
      45deg,
      rgba(180, 35, 24, 0.18) 0,
      rgba(180, 35, 24, 0.18) 12px,
      rgba(255, 255, 255, 0.65) 12px,
      rgba(255, 255, 255, 0.65) 24px
    ),
    #2b2926;
}

.variant-editor-stage canvas {
  display: block;
  width: var(--editor-stage-width, 100%);
  height: var(--editor-stage-height, 100%);
  max-width: 100%;
  max-height: 100%;
  cursor: move;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  touch-action: none;
}

.variant-editor-box {
  position: absolute;
  z-index: 2;
  border: 2px solid #22c7b8;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.08);
  cursor: move;
  touch-action: none;
}

.variant-editor-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #22c7b8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  padding: 0;
}

.variant-editor-handle.n { top: -9px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.variant-editor-handle.e { right: -9px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.variant-editor-handle.s { bottom: -9px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.variant-editor-handle.w { left: -9px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.variant-editor-handle.nw { left: -9px; top: -9px; cursor: nwse-resize; }
.variant-editor-handle.ne { right: -9px; top: -9px; cursor: nesw-resize; }
.variant-editor-handle.se { right: -9px; bottom: -9px; cursor: nwse-resize; }
.variant-editor-handle.sw { left: -9px; bottom: -9px; cursor: nesw-resize; }

.variant-editor-controls {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
}

.variant-editor-control-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.variant-editor-status {
  min-height: 44px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 700;
}

.variant-editor-actions {
  justify-content: flex-end;
}

.prompt-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(21, 18, 15, 0.58);
}

.prompt-panel {
  width: min(920px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
  box-shadow: var(--shadow);
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 10%, rgba(245, 169, 95, 0.28), transparent 32%),
    radial-gradient(circle at 80% 20%, rgba(84, 112, 255, 0.16), transparent 30%),
    var(--bg);
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 0;
  font-size: 30px;
}

.auth-card p {
  margin: 0;
  color: var(--muted);
}

.auth-card form {
  display: grid;
  gap: 14px;
}

.auth-card label {
  display: grid;
  gap: 6px;
  font-weight: 800;
}

.auth-card input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
}

.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.password-toggle {
  align-self: stretch;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.password-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.auth-error {
  min-height: 20px;
  color: #b42318 !important;
  font-weight: 800;
}

.auth-switch a {
  color: var(--accent);
  font-weight: 900;
}

.storage-panel {
  width: min(1220px, calc(100vw - 28px));
  max-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
}

.storage-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.storage-select-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 800;
}

.storage-product-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.storage-product-card {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.storage-product-preview {
  width: 56px;
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #ddd5cc;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.storage-product-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.storage-product-card strong,
.storage-product-card span {
  display: block;
}

.storage-variant-grid {
  min-height: 260px;
  max-height: min(62vh, 620px);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 12px;
  overflow: auto;
  padding: 2px 4px 4px 2px;
}

.storage-variant-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(44, 33, 24, 0.08);
}

.storage-variant-select {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255, 250, 245, 0.94);
  font-size: 11px;
  font-weight: 800;
}

.storage-variant-preview {
  width: 100%;
  aspect-ratio: 3 / 4;
  display: block;
  border: 0;
  background: var(--surface-soft);
  padding: 0;
  cursor: zoom-in;
}

.storage-variant-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.storage-variant-meta {
  display: grid;
  gap: 3px;
  padding: 9px 10px 10px;
  font-size: 12px;
}

.storage-variant-meta strong,
.storage-variant-meta span,
.storage-variant-meta a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.storage-empty {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 16px;
  color: var(--muted);
  background: var(--surface-soft);
}

.storage-table-wrap {
  max-height: min(58vh, 560px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.storage-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

.storage-table th,
.storage-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.storage-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-soft);
}

.admin-page {
  padding: 18px 24px 32px;
}

.admin-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.admin-users-table input[type="number"] {
  width: 96px;
}

.muted-text {
  color: var(--muted);
  font-size: 12px;
}

.settings-panel {
  width: min(520px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
  box-shadow: var(--shadow);
}

.settings-panel.storage-panel {
  width: min(1220px, calc(100vw - 28px));
  max-height: calc(100vh - 24px);
}

.generation-error-panel {
  width: min(980px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
  box-shadow: var(--shadow);
}

.generation-error-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.generation-error-panel textarea {
  min-height: min(58vh, 560px);
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: var(--ink);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre;
}

.generation-attempt-popover {
  position: fixed;
  z-index: 160;
  display: grid;
  gap: 8px;
  width: min(520px, calc(100vw - 24px));
  max-height: min(360px, calc(100vh - 24px));
  border: 1px solid rgba(106, 86, 51, 0.28);
  border-radius: 8px;
  background: #fffdf8;
  padding: 10px;
  box-shadow: 0 18px 42px rgba(36, 28, 20, 0.22);
}

.generation-attempt-popover-title {
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.generation-attempt-popover textarea {
  min-height: 160px;
  max-height: 290px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: #fff;
  color: var(--ink);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 11px;
  line-height: 1.45;
  resize: both;
  white-space: pre;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.api-documentation-section {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.api-documentation-heading,
.api-token-actions,
.api-token-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.api-documentation-heading {
  justify-content: space-between;
}

.api-documentation-heading h3,
.api-documentation-heading p,
.api-token-warning {
  margin: 0;
}

.api-documentation-heading p,
.api-token-warning,
#apiTokenStatus {
  color: var(--muted);
  font-size: 13px;
}

.api-token-field {
  display: grid;
  gap: 7px;
}

.api-token-row input {
  min-width: 0;
  flex: 1;
  font-family: Consolas, "Courier New", monospace;
}

.api-token-actions {
  flex-wrap: wrap;
}

.api-token-actions #apiTokenStatus {
  margin-right: auto;
}

.settings-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 750;
}

.settings-field input,
.settings-field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.settings-field input:focus,
.settings-field select:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(31, 111, 100, 0.16);
}

.prompt-panel textarea {
  min-height: 360px;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 13px;
}

.prompt-mode-switch {
  display: inline-flex;
  gap: 4px;
  margin: 8px 0 12px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.prompt-mode-button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.prompt-mode-button.active {
  background: var(--accent);
  color: #fff;
}

.prompt-pane {
  display: block;
}

.prompt-shared-settings {
  margin-top: 12px;
}

.variant-prompt-pane {
  display: grid;
  grid-template-columns: minmax(170px, 220px) minmax(0, 1fr);
  gap: 14px;
  margin-top: 4px;
}

.variant-prompt-sidebar {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.variant-prompt-list-tools {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.variant-prompt-list-tools .button {
  width: 100%;
  min-height: 34px;
  padding-inline: 10px;
}

.variant-prompt-list {
  display: grid;
  align-content: start;
  gap: 8px;
  max-height: 560px;
  overflow: auto;
  padding-right: 4px;
}

.variant-prompt-item {
  display: grid;
  gap: 3px;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.variant-prompt-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.variant-prompt-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(31, 111, 100, 0.14);
}

.variant-prompt-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  text-align: center;
}

.variant-prompt-editor {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.variant-prompt-heading,
.variant-prompt-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.variant-prompt-heading {
  justify-content: space-between;
}

#variantPromptMeta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

#variantPromptText {
  min-height: 430px;
  width: 100%;
}

@media (max-width: 720px) {
  .variant-prompt-pane {
    grid-template-columns: 1fr;
  }

  .variant-prompt-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 170px;
  }

  .variant-prompt-list-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.canvas-settings {
  display: grid;
  gap: 10px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.canvas-settings-heading,
.canvas-size-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.canvas-settings-heading {
  justify-content: space-between;
  color: var(--ink);
}

#canvasSettingsSummary {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.canvas-ratio-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.canvas-ratio-button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.canvas-ratio-button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.canvas-size-field {
  display: grid;
  gap: 5px;
  min-width: 120px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.canvas-size-field:first-child {
  min-width: 180px;
}

.canvas-size-field input,
.canvas-size-field select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.prompt-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

.prompt-attachments {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.attachment-counter {
  flex: 0 0 150px;
  display: grid;
  place-items: center;
  min-height: 140px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  padding: 12px;
  font-weight: 700;
}

.prompt-attachment {
  position: relative;
  flex: 0 0 160px;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  color: var(--ink);
  text-align: left;
  cursor: grab;
}

button.prompt-attachment {
  font: inherit;
}

.prompt-attachment img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  background: #e4ddd5;
}

.prompt-attachment:hover {
  border-color: var(--accent);
}

.prompt-attachment.dragging {
  opacity: 0.55;
}

.prompt-attachment.drag-over {
  outline: 3px solid rgba(31, 111, 100, 0.28);
}

.source-attachment {
  cursor: zoom-in;
}

.source-attachment.disabled-source {
  border-style: dashed;
  opacity: 0.72;
}

.source-attachment .attachment-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.source-toggle {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.attachment-index {
  font-weight: 750;
  font-size: 13px;
}

.delete-attachment {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #8f261f;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
}

.prompt-attachment:hover .delete-attachment,
.delete-attachment:focus {
  opacity: 1;
}

.prompt-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.api-preview {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.api-preview summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  font-size: 17px;
  font-weight: 800;
}

.api-preview summary::after {
  content: "⌄";
  font-size: 18px;
}

.api-preview[open] summary::after {
  transform: rotate(180deg);
}

.api-preview-images {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.api-preview-image {
  flex: 0 0 150px;
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  color: var(--ink);
  text-align: left;
  cursor: zoom-in;
}

.api-preview-image span {
  color: var(--muted);
  font-size: 12px;
}

#apiPreviewText {
  min-height: 320px;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
}

@media (max-width: 720px) {
  .lightbox {
    padding: 12px;
  }

  .lightbox-stage {
    width: 100%;
  }

  .lightbox-nav {
    top: auto;
    bottom: 76px;
    width: 44px;
    height: 52px;
    font-size: 36px;
  }
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .slide-nav {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  }

  .image-grid {
    display: flex;
  }

  .image-tile {
    flex-basis: min(280px, calc((100% - 14px) / 2));
  }

  .lightbox-stage.compare-mode {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(220px, 0.85fr) minmax(260px, 1fr);
    width: min(720px, calc(100vw - 32px));
  }

  .variant-editor-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(320px, 1fr) auto;
  }

  .variant-editor-controls {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar,
  .section-heading {
    flex-direction: column;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .api-documentation-heading,
  .api-token-row {
    align-items: stretch;
    flex-direction: column;
  }

  .layout {
    padding: 14px;
  }

  .image-grid {
    display: flex;
  }

  .image-tile {
    flex-basis: min(280px, 88%);
  }
}

/* Pastel lo-fi theme */
button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select,
textarea,
[tabindex] {
  outline: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  box-shadow: var(--focus);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.topbar {
  gap: 22px;
  padding: 14px 24px;
  border-bottom-color: rgba(102, 124, 113, 0.2);
  background: rgba(255, 253, 247, 0.88);
  box-shadow: 0 8px 30px rgba(62, 80, 70, 0.06);
  backdrop-filter: blur(18px) saturate(1.1);
}

html[data-environment="qa"] .topbar {
  box-shadow: inset 0 3px #7c3aed, 0 8px 30px rgba(62, 80, 70, 0.06);
}

h1,
h2 {
  color: #26332e;
  letter-spacing: -0.025em;
}

h1 {
  font-size: clamp(23px, 2vw, 28px);
}

h2 {
  font-size: 21px;
}

.environment-badge {
  min-height: 22px;
  padding: 2px 9px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 4px 12px rgba(70, 46, 130, 0.18);
}

.account-usage,
.profile-menu,
.selected-level-menu,
.generate-scope-menu,
.review-filter-menu,
.add-variant-menu,
.choice-level-menu {
  border-color: rgba(107, 128, 117, 0.22);
  background: rgba(255, 253, 247, 0.96);
  box-shadow: var(--shadow-soft);
}

.account-usage {
  padding: 7px 9px;
  border-radius: 14px;
}

.account-usage-bar {
  background: #e4e9e3;
}

.profile-menu {
  border-radius: 18px;
  padding: 14px;
}

.period-control select,
.period-date,
.product-title-input,
.product-title-edit-input,
.slide-title-input,
.settings-field input,
.settings-field select,
.canvas-size-field input,
.canvas-size-field select,
.admin-users-table input,
textarea {
  border-color: rgba(107, 128, 117, 0.28);
  border-radius: 10px;
  background: rgba(255, 255, 252, 0.92);
  color: var(--ink);
}

.button {
  min-height: 40px;
  border-radius: 10px;
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 5px 14px rgba(59, 92, 81, 0.13);
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.button:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  box-shadow: 0 8px 18px rgba(47, 78, 68, 0.18);
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button.secondary,
.button.choice {
  border-color: rgba(107, 128, 117, 0.3);
  background: rgba(255, 253, 247, 0.66);
  box-shadow: none;
}

.button.secondary:hover,
.button.choice:hover,
.selected-only-toggle:hover {
  border-color: rgba(82, 120, 108, 0.46);
  background: var(--accent-soft);
}

.button.danger {
  border-color: var(--danger);
  background: var(--danger);
}

.button.danger:hover {
  border-color: #8f4039;
  background: #8f4039;
}

.selected-only-toggle,
.storage-select-all {
  min-height: 40px;
  border-radius: 10px;
  border-color: rgba(107, 128, 117, 0.28);
  background: rgba(255, 253, 247, 0.7);
}

.selected-only-toggle.active {
  background: var(--accent-soft);
}

.product-home {
  grid-template-columns: repeat(auto-fit, minmax(300px, 420px));
  justify-content: center;
  gap: 24px;
  max-width: 1160px;
  padding: 34px 28px 48px;
}

.product-card {
  position: relative;
  border-color: rgba(107, 128, 117, 0.24);
  border-radius: 20px;
  background: rgba(255, 253, 247, 0.94);
  box-shadow: var(--shadow-soft);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.product-card:hover {
  border-color: rgba(82, 120, 108, 0.42);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.product-cover,
.image-frame,
.storage-product-preview,
.storage-variant-preview {
  background:
    linear-gradient(145deg, rgba(216, 232, 230, 0.66), rgba(243, 225, 211, 0.58)),
    #edf0eb;
}

.empty-cover {
  background:
    radial-gradient(circle at 76% 22%, rgba(234, 168, 135, 0.46) 0 8%, transparent 8.5%),
    linear-gradient(160deg, transparent 54%, rgba(118, 151, 139, 0.23) 54.5% 67%, transparent 67.5%),
    linear-gradient(188deg, transparent 64%, rgba(82, 120, 108, 0.18) 64.5%);
}

.product-body {
  gap: 12px;
  padding: 19px;
}

.product-body p {
  color: var(--muted);
}

.product-actions {
  gap: 9px;
  padding-top: 3px;
}

.create-product-card {
  min-height: 280px;
  border-style: solid;
  background: rgba(255, 253, 247, 0.9);
}

.create-product-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("/lofi-lake.svg") center 58% / cover no-repeat;
  opacity: 0.12;
  pointer-events: none;
}

.create-product-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255, 253, 247, 0.98) 0 48%, rgba(255, 253, 247, 0.48));
  pointer-events: none;
}

.create-product-card .product-body {
  position: relative;
  z-index: 1;
  max-width: 390px;
}

.layout {
  gap: 26px;
  padding: 28px;
}

.sidebar {
  top: 96px;
  padding: 16px;
  border-color: rgba(107, 128, 117, 0.24);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.97), rgba(245, 244, 235, 0.96));
  box-shadow: var(--shadow-soft);
}

.sidebar::after {
  content: "";
  display: block;
  height: 68px;
  margin: 18px -8px -8px;
  border-radius: 12px;
  background:
    linear-gradient(170deg, transparent 43%, rgba(169, 189, 169, 0.45) 44% 59%, transparent 60%),
    linear-gradient(187deg, transparent 50%, rgba(82, 120, 108, 0.23) 51%),
    radial-gradient(circle at 72% 31%, rgba(234, 168, 135, 0.62) 0 10%, transparent 10.5%);
  opacity: 0.72;
  pointer-events: none;
}

.sidebar-title {
  color: #65736b;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.11em;
}

.slide-nav-link,
.nav-slide-drag-handle,
.slide-drag-handle {
  border-radius: 9px;
}

.slide-nav-link:hover,
.slide-nav-link.active,
.nav-slide-drag-handle:hover,
.nav-slide-drag-handle:focus,
.slide-drag-handle:hover,
.slide-drag-handle:focus {
  background: var(--accent-soft);
}

.content,
.slides {
  gap: 24px;
}

.slide-section,
.summary {
  border-color: rgba(107, 128, 117, 0.22);
  border-radius: 20px;
  padding: 20px;
  background: rgba(255, 253, 247, 0.95);
  box-shadow: var(--shadow-soft);
}

.section-heading {
  margin-bottom: 18px;
}

.slide-drag-handle,
.nav-slide-drag-handle,
.product-title-edit,
.slide-title-edit {
  border-color: rgba(107, 128, 117, 0.24);
  background: var(--surface-soft);
}

.image-grid {
  gap: 16px;
  padding: 2px 2px 10px;
}

.image-grid-scrollbar {
  height: 22px;
  border-color: rgba(107, 128, 117, 0.2);
  background: #e2e8e1;
  box-shadow: inset 0 1px 3px rgba(52, 70, 61, 0.08);
}

.image-grid-scrollbar-thumb,
.page-scrollbar-thumb {
  background: #718b81;
  box-shadow: 0 2px 7px rgba(52, 70, 61, 0.22);
}

.image-tile {
  border-radius: 15px;
  background: #f0f1ec;
  box-shadow: 0 5px 16px rgba(52, 70, 61, 0.07);
}

.tile-footer {
  background: rgba(255, 253, 247, 0.96);
}

.tile-delete-image,
.tile-drag-handle,
.delete-attachment {
  background: rgba(255, 253, 247, 0.94);
  box-shadow: 0 5px 14px rgba(41, 52, 47, 0.14);
}

.generation-status {
  border-color: rgba(90, 130, 145, 0.24);
  background: rgba(216, 232, 230, 0.58);
  color: #365e68;
}

.generation-error {
  border-color: rgba(169, 79, 70, 0.24);
  background: rgba(242, 214, 196, 0.48);
  color: #8b413a;
}

.generation-attempts {
  border-color: rgba(154, 98, 40, 0.2);
  background: rgba(244, 234, 210, 0.58);
}

.summary-item,
.add-slide-panel,
.canvas-settings,
.storage-product-card,
.storage-empty {
  border-color: rgba(107, 128, 117, 0.22);
  border-radius: 12px;
  background: var(--surface-soft);
}

.prompt-modal {
  background: rgba(35, 48, 43, 0.48);
  backdrop-filter: blur(8px);
}

.prompt-panel,
.settings-panel,
.generation-error-panel,
.variant-editor-panel {
  border-color: rgba(107, 128, 117, 0.24);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 26px 70px rgba(31, 48, 41, 0.22);
}

.lightbox {
  background: rgba(26, 34, 31, 0.9);
}

.storage-product-card,
.storage-variant-card,
.admin-card {
  box-shadow: var(--shadow-soft);
}

.storage-variant-card {
  border-color: rgba(107, 128, 117, 0.22);
  border-radius: 16px;
}

.storage-table-wrap {
  border-color: rgba(107, 128, 117, 0.24);
  border-radius: 14px;
}

.storage-table th {
  background: #e8eee7;
}

.storage-table tbody tr:nth-child(even) {
  background: rgba(243, 241, 232, 0.66);
}

.storage-table tbody tr:hover {
  background: var(--accent-soft);
}

.admin-page {
  max-width: 1500px;
  margin: 0 auto;
  padding: 28px;
}

.admin-card {
  border-color: rgba(107, 128, 117, 0.24);
  border-radius: 20px;
  background: rgba(255, 253, 247, 0.95);
}

.auth-page {
  min-height: 100dvh;
  padding: clamp(16px, 4vw, 48px);
  background:
    radial-gradient(circle at 14% 16%, rgba(242, 214, 196, 0.8), transparent 34rem),
    radial-gradient(circle at 86% 8%, rgba(203, 227, 222, 0.95), transparent 36rem),
    #eef1ea;
}

.auth-shell {
  display: grid;
  grid-template-areas: "form scene";
  grid-template-columns: minmax(380px, 0.82fr) minmax(520px, 1.35fr);
  width: min(1180px, 100%);
  min-height: min(720px, calc(100dvh - clamp(32px, 8vw, 96px)));
  overflow: hidden;
  border: 1px solid rgba(107, 128, 117, 0.22);
  border-radius: 30px;
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(54, 79, 68, 0.17);
}

.auth-card {
  grid-area: form;
  align-content: center;
  width: auto;
  padding: clamp(34px, 5vw, 62px);
  border: 0;
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #31433b;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.auth-brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px 10px 10px 4px;
  background: var(--accent);
  color: #fffdf7;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  box-shadow: 0 7px 16px rgba(54, 92, 80, 0.18);
}

.auth-copy {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.auth-eyebrow {
  color: #8b6351;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.auth-card h1 {
  font-size: clamp(34px, 4vw, 44px);
  font-weight: 720;
  letter-spacing: -0.045em;
}

.auth-card p {
  max-width: 35ch;
  color: var(--muted);
}

.auth-card form {
  gap: 16px;
  margin-top: 4px;
}

.auth-card label {
  gap: 7px;
  color: #3a4942;
  font-size: 13px;
  font-weight: 750;
}

.auth-card input {
  min-height: 48px;
  border-color: rgba(91, 115, 104, 0.3);
  border-radius: 12px;
  background: #fffefa;
  color: var(--ink);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.auth-card input::placeholder {
  color: #9aa39d;
}

.auth-card input:hover {
  border-color: rgba(82, 120, 108, 0.56);
}

.auth-card input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: var(--focus);
}

.password-field {
  gap: 9px;
}

.password-toggle {
  min-height: 48px;
  border-color: rgba(91, 115, 104, 0.28);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--ink);
}

.auth-error {
  min-height: 22px;
  color: var(--danger) !important;
  font-size: 13px;
}

.auth-submit {
  min-height: 48px;
  width: 100%;
}

.auth-switch {
  font-size: 14px;
}

.auth-switch a {
  color: var(--accent-strong);
}

.auth-scene {
  grid-area: scene;
  position: relative;
  min-width: 0;
  min-height: 100%;
  overflow: hidden;
  background: var(--mist);
}

.auth-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 253, 247, 0.16), transparent 22%),
    linear-gradient(0deg, rgba(37, 61, 52, 0.22), transparent 38%);
  pointer-events: none;
}

.auth-scene img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 58% center;
}

.auth-scene-note {
  position: absolute;
  z-index: 1;
  left: clamp(24px, 4vw, 52px);
  right: clamp(24px, 4vw, 52px);
  bottom: clamp(24px, 4vw, 48px);
  display: grid;
  gap: 8px;
  max-width: 380px;
  color: #f9f7ed;
  text-shadow: 0 2px 18px rgba(29, 48, 41, 0.28);
}

.auth-scene-note span {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-scene-note strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 500;
  line-height: 1.16;
}

@media (max-width: 1120px) {
  .topbar {
    align-items: flex-start;
  }

  .top-actions {
    justify-content: flex-end;
  }
}

@media (max-width: 840px) {
  .auth-page {
    align-items: start;
    padding: 16px;
  }

  .auth-shell {
    grid-template-areas:
      "scene"
      "form";
    grid-template-columns: 1fr;
    grid-template-rows: minmax(190px, 30vh) auto;
    min-height: 0;
    border-radius: 24px;
  }

  .auth-card {
    padding: 34px clamp(24px, 7vw, 52px) 42px;
  }

  .auth-scene img {
    object-position: center 47%;
  }

  .auth-scene-note {
    bottom: 24px;
  }

  .auth-scene-note strong {
    max-width: 460px;
    font-size: 24px;
  }
}

@media (max-width: 760px) {
  .topbar {
    gap: 12px;
    padding: 13px 14px;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 2px 1px 8px;
    scrollbar-width: thin;
  }

  .top-actions > * {
    flex: 0 0 auto;
  }

  .product-home,
  .admin-page {
    padding: 20px 14px 34px;
  }

  .product-home {
    grid-template-columns: minmax(0, 1fr);
  }

  .slide-section,
  .summary {
    border-radius: 16px;
    padding: 16px;
  }
}

@media (max-width: 560px) {
  .auth-page {
    padding: 10px;
  }

  .auth-shell {
    grid-template-rows: 172px auto;
    border-radius: 20px;
  }

  .auth-card {
    gap: 14px;
    padding: 26px 20px 32px;
  }

  .auth-card h1 {
    font-size: 34px;
  }

  .auth-scene-note {
    display: none;
  }

  .password-field {
    grid-template-columns: 1fr;
  }

  .password-toggle {
    min-height: 42px;
  }

  .layout {
    padding: 14px 10px;
  }
}

@media (hover: none) {
  .tile-delete-image,
  .tile-drag-handle,
  .delete-attachment,
  .product-title-edit,
  .slide-title-edit {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
