@font-face {
  font-family: "Caveat";
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url("assets/fonts/Caveat-Latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --bg: #202020;
  --bg-text: #e9edf2;
  --panel: #f8fafc;
  --panel-soft: #eef2f7;
  --line: #cfd7e3;
  --line-strong: #aeb8c8;
  --text: #171b22;
  --muted: #5f6b80;
  --accent: #1455ff;
  --accent-dark: #0f3fc0;
  --shadow: 0 18px 60px rgba(24, 34, 51, 0.14);
  --option-label-width: 136px;
  --option-value-width: 58px;
  --option-row-gap: 10px;
  --control-height: 44px;
  --options-pane-width: 316px;
  --page-pane-min-width: 636px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--bg-text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

:where(button, input, select, textarea, a):focus-visible {
  outline: 2px solid rgba(20, 85, 255, 0.75);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.delayed-tooltip {
  position: fixed;
  z-index: 10000;
  max-width: min(300px, calc(100vw - 24px));
  padding: 7px 9px;
  border: 1px solid rgba(232, 237, 242, 0.16);
  border-radius: 7px;
  background: #1c2027;
  color: #edf1f5;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
  pointer-events: none;
}

.delayed-tooltip[hidden] {
  display: none;
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}

.primary-button,
.secondary-button,
.icon-button,
.reset-button,
.text-button {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 700;
}

.primary-button {
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 22px rgba(20, 85, 255, 0.22);
}

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

.secondary-button,
.icon-button.secondary,
.reset-button {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

.secondary-button {
  width: 100%;
  margin-top: 8px;
}

.secondary-button:disabled,
.primary-button:disabled,
.icon-button:disabled,
.reset-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  box-shadow: none;
}

.icon-button {
  width: 42px;
  padding: 0;
}

.reset-button {
  min-width: 68px;
  padding: 0 12px;
}

.text-button {
  min-height: 30px;
  padding: 0 10px;
  color: var(--accent);
  background: transparent;
  white-space: nowrap;
}

.mobile-action-bar,
.config-action-bar {
  display: none;
}

.mobile-action-button,
.floating-action-button {
  min-height: 46px;
  border: 1px solid rgba(232, 237, 242, 0.18);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.mobile-back-button,
.floating-back-button {
  background: #f8fafc;
  color: var(--text);
}

.mobile-export-button,
.floating-export-button {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px rgba(20, 85, 255, 0.28);
}

.mobile-export-button:hover,
.floating-export-button:hover {
  background: var(--accent-dark);
}

.mobile-action-button:disabled,
.floating-action-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  box-shadow: none;
}

body.modal-open .mobile-action-bar,
body.modal-open .config-action-bar {
  display: none;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(var(--page-pane-min-width), 1fr) var(--options-pane-width);
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  flex: 1;
  padding: 12px;
  overflow-x: auto;
  overflow-y: hidden;
}

.app-footer {
  flex: 0 0 auto;
  padding: 0 24px 14px;
  color: var(--bg-text);
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}

.image-panel,
.options-pane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 34px rgba(24, 34, 51, 0.1);
  color: var(--text);
  min-height: 0;
}

.image-panel {
  display: flex;
  flex-direction: column;
  min-width: var(--page-pane-min-width);
  overflow: hidden;
}

.file-input {
  display: none;
}

.list-header {
  display: flex;
  align-items: center;
  min-height: 68px;
  padding: 0 22px;
  background: #fbfcfe;
  border-bottom: 1px solid #e1e6ee;
}

.list-title-icon {
  display: none;
}

.list-title {
  min-width: max-content;
  color: var(--text);
  font-family: "Caveat", "Segoe Print", cursive;
  font-size: 52px;
  font-weight: 700;
  line-height: 0.8;
  white-space: nowrap;
}

.list-right {
  grid-area: right;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.list-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.list-header .text-button {
  min-height: 34px;
  color: #174edc;
  font-size: 13px;
  font-weight: 800;
  border-radius: 7px;
}

.list-header .text-button:hover {
  background: #edf3ff;
}

.list-count {
  flex: 0 0 auto;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid #d8e0eb;
  border-radius: 999px;
  background: #fff;
  color: #5f6b80;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.file-notice {
  margin: 10px 12px 0;
  padding: 9px 11px;
  border: 1px solid #d8e0eb;
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.file-notice strong {
  color: #303642;
  font-weight: 850;
}

.file-notice[hidden] {
  display: none;
}

.image-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  background: #eef3f8;
  outline: 2px solid transparent;
  outline-offset: -10px;
  transition:
    background 160ms ease,
    outline-color 160ms ease;
}

.image-list.dragging-files {
  background: #eef3ff;
  outline-color: rgba(20, 85, 255, 0.35);
}

.empty-state {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  border: 1.5px dashed #aeb9ca;
  border-radius: 8px;
  background: repeating-linear-gradient(
    -45deg,
    #fbfcfe,
    #fbfcfe 12px,
    #eef2f7 12px,
    #eef2f7 24px
  );
}

.add-more-state {
  flex: 1 0 128px;
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px 4px;
}

.empty-action {
  width: min(100%, 620px);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 8px;
  padding: 16px 18px;
  background: transparent;
  color: var(--muted);
  text-align: center;
}

.empty-action:hover,
.empty-action:focus-visible {
  color: var(--accent);
  background: rgba(20, 85, 255, 0.06);
}

.empty-action:focus-visible {
  outline: 2px solid rgba(20, 85, 255, 0.35);
  outline-offset: 3px;
}

.empty-action svg {
  width: 36px;
  height: 36px;
  color: var(--accent);
}

.empty-main {
  color: #5f6b80;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
}

.empty-note {
  max-width: 560px;
  color: #6d7788;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.35;
}

.empty-action:hover .empty-main,
.empty-action:focus-visible .empty-main {
  color: var(--accent);
}

.image-row {
  display: grid;
  grid-template-columns: 48px 86px minmax(0, 1fr) 32px;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  text-align: left;
  color: inherit;
  position: relative;
  box-shadow: 0 1px 2px rgba(24, 34, 51, 0.05);
}

.image-row.dragging {
  opacity: 0.55;
}

.image-row.drop-before::before,
.image-row.drop-after::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.image-row.drop-before::before {
  top: -9px;
}

.image-row.drop-after::after {
  bottom: -9px;
}

.image-row.selected {
  border-color: var(--accent);
  box-shadow:
    inset 3px 0 0 var(--accent),
    0 0 0 2px rgba(20, 85, 255, 0.1);
}

.generated-row {
  background: #f7f9ff;
  border-color: #cfdbff;
}

.generated-badge {
  width: 34px;
  height: 26px;
  border: 1px solid #bfd0ff;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: #eef3ff;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
}

.row-rail {
  min-width: 0;
  min-height: 116px;
  display: grid;
  grid-template-rows: auto 1fr;
  justify-items: center;
  align-self: stretch;
  align-content: stretch;
  gap: 6px;
}

.page-position {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.generated-row .row-title {
  color: #173ea5;
}

.generated-row .row-meta {
  display: block;
  align-self: center;
}

.generated-row .row-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.preview-wrap {
  height: 116px;
  border: 0;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  border-radius: 6px;
  overflow: visible;
  cursor: zoom-in;
}

.preview-wrap canvas {
  max-width: 78px;
  max-height: 100px;
  border: 1px solid rgba(53, 64, 82, 0.32);
  box-shadow: 0 8px 18px rgba(29, 39, 57, 0.28);
  background: #fff;
}

.row-meta {
  min-width: 0;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.row-title {
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-metadata {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin: 0;
}

.metadata-field:not(.wide) {
  padding-right: 210px;
}

.metadata-field {
  display: grid;
  gap: 3px;
}

.metadata-field span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.metadata-field input,
.metadata-field textarea {
  width: 100%;
  min-height: 30px;
  border: 1px solid #cfd7e3;
  border-radius: 7px;
  padding: 5px 8px;
  color: var(--text);
  background: #fff;
  font-size: 13px;
}

.metadata-field textarea {
  min-height: 42px;
  max-height: 72px;
  resize: vertical;
  line-height: 1.3;
  font-size: 12px;
}

.row-facts {
  position: absolute;
  top: 0;
  right: 0;
  width: 190px;
  display: grid;
  gap: 4px;
  justify-items: end;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
  text-align: right;
}

.row-facts span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-facts span:first-child {
  color: #303642;
  font-weight: 800;
}

.row-reorder-hint {
  color: #7a8495;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0;
}

.mobile-reorder-hint {
  display: none;
}

.row-controls {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: max-content max-content max-content max-content max-content;
  align-items: center;
  justify-content: space-between;
  gap: 6px clamp(6px, 0.9vw, 14px);
  margin-top: 0;
  padding-top: 8px;
  padding-bottom: 2px;
  border-top: 1px solid #dde4ed;
  overflow: visible;
}

.row-check,
.rotation-control,
.row-select,
.row-margin {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #303642;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.row-select span,
.row-margin span {
  color: var(--muted);
}

.row-select select {
  width: 104px;
  min-height: 26px;
  border: 1px solid #cfd7e3;
  border-radius: 7px;
  padding: 4px 26px 4px 8px;
  background: #fff;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
}

.row-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

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

.row-margin input[type="number"] {
  width: 64px;
  min-width: 64px;
  min-height: 26px;
  border: 1px solid #cfd7e3;
  border-radius: 7px;
  padding: 4px 4px 4px 7px;
  color: var(--text);
  background: #fff;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.row-margin input[type="number"]:disabled {
  color: var(--muted);
  background: #e9eef5;
}

.row-unit {
  min-width: 16px;
}

.rotation-control {
  padding-left: 2px;
}

.rotation-control span {
  color: var(--muted);
  min-width: 38px;
}

.rotation-control button {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  display: grid;
  place-items: center;
}

.rotation-control svg {
  width: 16px;
  height: 16px;
}

.generated-badge {
  align-self: center;
}

.remove-button {
  width: 32px;
  height: 32px;
  border: 1px solid #cfd7e3;
  border-radius: 7px;
  color: #d92d20;
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
}

.preview-dialog {
  width: min(92vw, 980px);
  max-height: 92vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(17, 24, 39, 0.28);
}

.preview-dialog::backdrop {
  background: rgba(15, 23, 42, 0.54);
}

.preview-dialog-header {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px 0 20px;
  border-bottom: 1px solid var(--line);
}

.preview-dialog-header strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.preview-stage {
  max-height: calc(92vh - 58px);
  overflow: auto;
  padding: 22px;
  display: grid;
  place-items: center;
  background: #dfe5ee;
}

.preview-stage canvas {
  max-width: 100%;
  height: auto;
  box-shadow: 0 12px 36px rgba(24, 34, 51, 0.28);
  background: #fff;
}

.options-pane {
  padding: 18px 18px 122px;
  overflow-y: auto;
}

.options-brand {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.options-logo {
  width: 100%;
  height: auto;
  display: block;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.venmo-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d9ead8;
  border-radius: 8px;
  background: #f8fff6;
  color: #1f3a24;
  font-family: "Caveat", "Segoe Print", cursive;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.config-action-bar {
  position: fixed;
  right: 12px;
  bottom: 58px;
  z-index: 5000;
  width: var(--options-pane-width);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(232, 237, 242, 0.16);
  border-radius: 10px;
  background: rgba(32, 32, 32, 0.9);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(12px);
}

.venmo-button:hover {
  border-color: #c7e3c5;
  color: #132817;
  background: #f2fbef;
}

.hank-dialog {
  --hank-gap: 10px;
  --hank-link-height: 28px;
  --hank-photo-size: min(480px, calc(92vh - 74px));
  --hank-side-pad: 18px;
  width: min(94vw, calc(var(--hank-photo-size) + (var(--hank-side-pad) * 2) + 360px));
  height: calc(var(--hank-photo-size) + var(--hank-link-height) + var(--hank-gap) + (var(--hank-side-pad) * 2));
  max-height: 92vh;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: calc(var(--hank-photo-size) + (var(--hank-side-pad) * 2)) minmax(0, 1fr);
  background: #f8fafc;
  color: var(--text);
  box-shadow: 0 24px 80px rgba(17, 24, 39, 0.32);
}

.hank-dialog::backdrop {
  background: rgba(15, 23, 42, 0.54);
}

.hank-dialog:not([open]) {
  display: none;
}

.hank-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 36px;
  height: 36px;
  background: rgba(248, 250, 252, 0.88);
  backdrop-filter: blur(8px);
}

.hank-media {
  display: grid;
  grid-template-rows: var(--hank-photo-size) var(--hank-link-height);
  gap: var(--hank-gap);
  align-content: start;
  justify-items: center;
  padding: var(--hank-side-pad);
  border-right: 1px solid var(--line);
  background: #fff;
}

.hank-photo {
  width: var(--hank-photo-size);
  height: var(--hank-photo-size);
  display: block;
  object-fit: contain;
  object-position: center center;
  border: 1px solid #dce3ee;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(24, 34, 51, 0.12);
}

.hank-instagram {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: var(--hank-link-height);
  color: #4f5b6e;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1;
  text-decoration: underline;
  text-decoration-color: rgba(79, 91, 110, 0.32);
  text-underline-offset: 3px;
}

.hank-instagram:hover {
  color: #171b22;
  text-decoration-color: currentColor;
}

.hank-instagram img {
  width: 18px;
  height: 18px;
  display: block;
  border-radius: 5px;
  flex: none;
}

.hank-dialog-body {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 24px;
  align-content: start;
  min-height: 0;
  padding: 18px 22px;
  overflow: hidden;
}

.hank-copy {
  min-width: 0;
}

.hank-copy h2 {
  margin: 0 0 7px;
  color: #171b22;
  font-size: clamp(20px, 2.5vw, 24px);
  line-height: 1.05;
  padding: 0 40px;
  text-align: center;
}

.hank-copy p {
  margin: 0;
  color: #4f5b6e;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.32;
}

#hankDialogDescription {
  padding-right: 40px;
}

.hank-copy p + p {
  margin-top: 7px;
}

.hank-qr-card {
  display: grid;
  gap: 8px;
  justify-items: center;
  justify-self: center;
  align-self: end;
  width: min(100%, 224px);
  margin-bottom: 14px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  text-decoration: none;
}

.hank-qr-card:hover span,
.hank-qr-card:focus-visible span {
  color: #171b22;
}

.hank-qr-card img {
  width: 100%;
  max-width: 224px;
  height: auto;
  display: block;
}

.hank-qr-card span {
  color: #5f6b80;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pane-header {
  margin-bottom: 18px;
}

.pane-header h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.field {
  display: grid;
  gap: 7px;
  margin: 0;
  border: 0;
  padding: 0;
}

.option-group {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid #d4dce7;
  border-radius: 8px;
  background: #f1f4f8;
}

.label-options-disabled {
  opacity: 0.46;
}

.label-options-disabled,
.label-options-disabled * {
  cursor: not-allowed;
}

.compact-field {
  margin-bottom: 8px;
}

.field-grid {
  display: grid;
  gap: 10px;
}

.field-grid.two {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
}

.field-grid.two > .field {
  grid-template-rows: minmax(18px, auto) 44px;
  align-content: start;
}

.field-grid.two > .field > span,
.field-grid.two > .field > legend {
  min-height: 18px;
  display: flex;
  align-items: start;
}

.field-grid.two > .field > .input-row,
.field-grid.two > .field > input,
.field-grid.two > .field > select {
  min-height: 44px;
  align-self: start;
}

.two-column-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field > span,
.field legend,
.option-group > legend {
  color: #303642;
  font-size: 13px;
  font-weight: 800;
}

.field legend,
.option-group > legend {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field input[type="text"],
.field input[type="number"],
.field input[type="email"],
.field input[type="tel"],
.field select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cfd7e3;
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--text);
  background: #fff;
  font-size: 13px;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.labelled-row {
  display: grid;
  grid-template-columns: var(--option-label-width) minmax(0, 1fr) var(--option-value-width);
  gap: var(--option-row-gap);
  align-items: center;
}

.labelled-row.color-row {
  grid-template-columns: 1fr;
  gap: 7px;
  align-items: stretch;
}

.labelled-row.range-row {
  grid-template-columns: minmax(0, 1fr) var(--option-value-width);
  grid-template-areas:
    "label value"
    "control control";
  gap: 7px var(--option-row-gap);
}

.labelled-row.range-row > span {
  grid-area: label;
}

.labelled-row.range-row input[type="range"] {
  grid-area: control;
  width: 100%;
}

.labelled-row.range-row output {
  grid-area: value;
}

.input-row input[type="range"] {
  min-width: 0;
  flex: 1;
  accent-color: var(--accent);
}

.color-control {
  min-width: 0;
  width: 100%;
  display: grid;
  grid-template-columns: var(--control-height) minmax(126px, 1fr);
}

.input-row input[type="color"] {
  flex: 0 0 var(--control-height);
  width: var(--control-height);
  height: var(--control-height);
  padding: 3px;
  border: 1px solid #cfd7e3;
  border-radius: 7px;
  background: #fff;
}

.color-control input[type="text"] {
  width: 100%;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.labelled-row input[type="text"],
.placement-row input[type="number"] {
  width: 100%;
  min-height: var(--control-height);
  border: 1px solid #cfd7e3;
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--text);
  background: #fff;
  font-size: 13px;
}

.input-row output,
.input-row > span {
  min-width: var(--option-value-width);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.labelled-row > span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.labelled-row output {
  min-width: 0;
  text-align: right;
  white-space: nowrap;
}

.corner-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.corner-grid button {
  height: 38px;
  border: 1px solid #cfd7e3;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.corner-grid button.active {
  border-color: var(--accent);
  background: #eef3ff;
  color: var(--accent);
}

.corner-grid [data-corner="top-left"] {
  grid-area: 1 / 1;
}

.corner-grid [data-corner="top-center"] {
  grid-area: 1 / 2;
}

.corner-grid [data-corner="top-right"] {
  grid-area: 1 / 3;
}

.corner-grid [data-corner="center"] {
  grid-area: 2 / 2;
}

.corner-grid [data-corner="bottom-left"] {
  grid-area: 3 / 1;
}

.corner-grid [data-corner="bottom-center"] {
  grid-area: 3 / 2;
}

.corner-grid [data-corner="bottom-right"] {
  grid-area: 3 / 3;
}

.label-placement-group {
  overflow: hidden;
}

.placement-stack {
  display: grid;
  gap: 12px;
}

.placement-row {
  min-width: 0;
  display: grid;
  grid-template-columns: var(--option-label-width) minmax(0, 1fr);
  gap: var(--option-row-gap);
  align-items: center;
  margin: 0;
  border: 0;
  padding: 0;
}

.placement-row > span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
}

.corner-field {
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: stretch;
}

.corner-field > span {
  padding-top: 0;
}

.corner-field .corner-grid {
  min-width: 0;
}

.offset-field .input-row,
.size-field .input-row {
  min-width: 0;
  gap: var(--option-row-gap);
}

.offset-field .input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
}

.offset-field #offsetInput {
  min-width: 0;
}

.offset-field #offsetUnit {
  min-width: 24px;
}

.size-field .input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--option-value-width);
}

.size-field #sizeInput {
  width: 100%;
}

.size-field #sizeOutput {
  min-width: 0;
  text-align: right;
  white-space: nowrap;
}

.size-field.range-field {
  grid-template-columns: minmax(0, 1fr) var(--option-value-width);
  grid-template-areas:
    "label value"
    "control control";
  row-gap: 7px;
}

.size-field.range-field > span {
  grid-area: label;
}

.size-field.range-field .input-row {
  display: contents;
}

.size-field.range-field #sizeInput {
  grid-area: control;
  width: 100%;
}

.size-field.range-field #sizeOutput {
  grid-area: value;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #303642;
  font-size: 13px;
  font-weight: 700;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.option-group[data-label-dependent] > .toggle-row {
  min-height: var(--control-height);
  justify-self: start;
  padding-left: 0;
}

.option-group > .field:last-child,
.option-group > .toggle-row:last-child,
.option-group > .input-row:last-child {
  margin-bottom: 0;
}

@media (max-width: 1040px) {
  .list-header {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title count"
      "actions actions";
    row-gap: 6px;
    min-height: 82px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .list-right {
    display: contents;
  }

  .list-actions {
    grid-area: actions;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .list-count {
    grid-area: count;
    justify-self: end;
  }
}

@media (max-width: 860px) {
  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
  }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    overflow: visible;
    padding: 14px;
  }

  .list-header {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 52px;
    justify-items: center;
    min-height: 66px;
    padding: 8px 14px;
  }

  .list-title-icon {
    width: 48px;
    height: 48px;
    display: block;
    object-fit: contain;
  }

  .list-title {
    min-width: 0;
    font-size: 44px;
    line-height: 0.86;
    justify-self: center;
    text-align: center;
  }

  .image-panel {
    min-width: 0;
    overflow: visible;
  }

  .image-list {
    overflow-y: visible;
  }

  .desktop-reorder-hint {
    display: none;
  }

  .mobile-reorder-hint {
    display: inline;
  }

  .image-row .remove-button {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
  }

  .row-controls {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    justify-content: stretch;
    gap: 10px 8px;
    padding-top: 10px;
    padding-bottom: 4px;
    overflow: visible;
  }

  .row-controls > :nth-child(1) {
    grid-column: 1 / span 3;
  }

  .row-controls > :nth-child(2) {
    grid-column: 4 / span 3;
  }

  .row-controls > :nth-child(3) {
    grid-column: 1 / span 2;
  }

  .row-controls > :nth-child(4) {
    grid-column: 3 / span 2;
  }

  .row-controls > :nth-child(5) {
    grid-column: 5 / span 2;
  }

  .row-select {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 4px;
    font-size: 12px;
  }

  .row-select select {
    width: 100%;
    min-width: 0;
    min-height: 32px;
    font-size: 12px;
  }

  .row-margin {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "check label label"
      "amount amount unit";
    align-items: center;
    gap: 4px 5px;
    font-size: 12px;
  }

  .row-margin input[type="checkbox"] {
    grid-area: check;
  }

  .row-margin span:not(.row-unit) {
    grid-area: label;
  }

  .row-margin input[type="number"] {
    grid-area: amount;
    width: 100%;
    min-width: 0;
    min-height: 32px;
    font-size: 12px;
  }

  .row-margin .row-unit {
    grid-area: unit;
  }

  .row-check,
  .rotation-control {
    justify-content: center;
    min-height: 32px;
    font-size: 12px;
  }

  .rotation-control {
    gap: 8px;
    padding-left: 0;
  }

  .rotation-control button {
    width: 32px;
    height: 32px;
  }

  .app-footer {
    padding: 0 16px 14px;
  }

  .options-brand .options-logo {
    display: none;
  }

  .options-pane {
    padding: 18px;
  }

  .options-actions,
  .config-action-bar {
    display: none;
  }

  .mobile-action-bar {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 5000;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
    border: 1px solid rgba(232, 237, 242, 0.16);
    border-radius: 10px;
    background: rgba(32, 32, 32, 0.9);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(12px);
  }

  .field-grid.two,
  .two-column-fields,
  .row-metadata {
    grid-template-columns: 1fr;
  }

  .hank-dialog {
    grid-template-columns: 1fr;
    width: min(calc(100vw - 28px), 430px);
    height: auto;
    max-height: calc(100dvh - 96px);
    overflow-y: auto;
    border-radius: 10px;
  }

  .hank-dialog-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 14px;
    padding: 16px 18px 18px;
    overflow: visible;
  }

  .hank-qr-card {
    width: min(100%, 210px);
    align-self: start;
    margin-bottom: 0;
  }
}

@media (max-width: 560px) {
  .primary-button {
    flex: 1;
  }

  .image-row {
    grid-template-columns: 50px 1fr 38px;
  }

  .preview-wrap,
  .row-meta {
    grid-column: 1 / -1;
  }

  .preview-wrap {
    height: 220px;
  }

  .preview-wrap canvas {
    max-width: 160px;
    max-height: 206px;
  }

  .hank-dialog {
    grid-template-columns: 1fr;
    max-height: calc(100dvh - 86px);
  }

  .hank-media {
    grid-template-rows: auto auto;
    gap: 8px;
    padding: 16px 16px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .hank-photo {
    width: min(100%, 230px);
    height: auto;
    aspect-ratio: 1;
  }

  .hank-instagram {
    font-size: 11px;
  }

  .hank-close {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
  }

  .hank-copy h2 {
    padding: 0 42px;
    font-size: 21px;
  }

  .hank-copy p {
    font-size: 12px;
    line-height: 1.35;
  }

  #hankDialogDescription {
    padding-right: 0;
  }

  .hank-qr-card {
    justify-self: center;
    width: min(100%, 190px);
  }

  .hank-qr-card img {
    max-width: 190px;
  }

  .hank-qr-card span {
    font-size: 11px;
  }
}
