:root {
  /* Stationery Drop Watch palette (stationerydropwatch.com assets/style.css lines 13-14) */
  --sdw-paper: #fbf6ec;
  --sdw-paper-2: #f4ecdc;
  --sdw-card: #fffdf8;
  --sdw-ink: #2d2a32;
  --sdw-ink-2: #5b5560;
  --sdw-line: #e6dccb;
  --sdw-accent: #c1553b;
  --sdw-accent-2: #9e3f29;
  --sdw-sage: #5f8a6b;
  --sdw-mustard: #8a6412;
  --sdw-plum: #7a5c8a;
  --sdw-rose: #b34a4a;

  --bg-desk: var(--sdw-paper-2);
  --bg-desk-dot: rgba(45, 42, 50, 0.13);
  --surface: rgba(255, 253, 248, 0.96);
  --surface-solid: var(--sdw-card);
  --surface-muted: var(--sdw-paper);
  --border: var(--sdw-line);
  --border-subtle: #efe7d8;
  --ink: var(--sdw-ink);
  --ink-muted: var(--sdw-ink-2);
  --ink-faint: #8d8692;
  --accent: var(--sdw-accent);
  --accent-hover: var(--sdw-accent-2);
  --accent-soft: #f6e3da;
  --danger: var(--sdw-rose);
  --danger-soft: #f8e6e4;
  --sel-ring: var(--sdw-accent);
  --guide-line: var(--sdw-sage);
  --shadow-sm: 0 2px 8px rgba(45, 42, 50, 0.06);
  --shadow-paper: 0 18px 46px rgba(45, 42, 50, 0.14), 0 3px 10px rgba(45, 42, 50, 0.07);
  --shadow-modal: 0 28px 80px rgba(30, 26, 34, 0.28);
  --radius-sm: 7px;
  --radius-md: 11px;
  --radius-lg: 16px;
  --font-ui: "Liberation Sans", Arial, Helvetica, sans-serif;
  --font-serif: "Newsreader", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--bg-desk);
  -webkit-font-smoothing: antialiased;
}

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

.studio-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* --- Top Studio Bar --- */
.topbar {
  height: 58px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  z-index: 30;
}

.topbar-left,
.topbar-center,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--ink);
  color: #fcfaf6;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 20px;
  letter-spacing: 0.01em;
}

.brand-sub {
  font-size: 10.5px;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}

.topbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 2px;
}

.control-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px 4px 11px;
  height: 34px;
}

.pill-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-muted);
}

.pill-select {
  border: none;
  background: transparent;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  outline: none;
  cursor: pointer;
  padding-right: 4px;
  white-space: nowrap;
  max-width: 140px;
}

.dim-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-muted);
  background: var(--surface-solid);
  border: 1px solid var(--border-subtle);
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Theme Gallery Picker + Popover */
.theme-picker-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  padding: 2px 3px;
  border-radius: 999px;
}

.theme-step-btn {
  width: 26px;
  height: 28px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.14s ease;
}

.theme-step-btn:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.theme-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 10px 0 9px;
  border: none;
  border-radius: 999px;
  background: var(--surface-solid);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(36, 32, 28, 0.08);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.theme-picker-btn:hover {
  background: #ffffff;
  box-shadow: 0 2px 7px rgba(36, 32, 28, 0.12);
}

.theme-picker-meta {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-size: 12.5px;
}

.theme-picker-label {
  font-size: 11px;
  color: var(--ink-muted);
  font-weight: 500;
}

.theme-picker-count {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-muted);
  background: var(--surface-muted);
  border: 1px solid var(--border-subtle);
  padding: 1px 6px;
  border-radius: 999px;
}

.theme-popover {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: min(620px, 92vw);
  max-height: 76vh;
  overflow-y: auto;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 22px 60px rgba(24, 20, 16, 0.24), 0 4px 12px rgba(24, 20, 16, 0.08);
  padding: 14px;
  z-index: 120;
}

.theme-popover.hidden {
  display: none;
}

.theme-popover-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 4px 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.theme-popover-head strong {
  font-size: 13.5px;
  font-weight: 700;
}

.theme-popover-head span {
  font-size: 11px;
  color: var(--ink-muted);
}

.theme-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

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

.theme-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: #ffffff;
  text-align: left;
  cursor: pointer;
  transition: all 0.14s ease;
}

.theme-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.theme-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 2px 10px rgba(193, 85, 59, 0.16);
}

.theme-card-swatches {
  display: flex;
  width: 100%;
  height: 16px;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.theme-card-swatches span {
  flex: 1;
}

.theme-card-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.theme-card-tag {
  font-size: 10.5px;
  color: var(--ink-muted);
  line-height: 1.3;
}

.theme-swatch-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
  display: inline-block;
}

.sticker-pack-select {
  flex: 1;
  min-width: 100px;
  padding: 4px 7px;
  font-size: 11px;
  height: 26px;
}

.icon-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.icon-pill:hover {
  color: var(--ink);
  border-color: #c7bfb2;
}

.icon-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-hover);
  font-weight: 600;
}

.btn-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.tool-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.14s ease;
}

.tool-btn:hover:not(:disabled) {
  background: var(--surface-muted);
  color: var(--ink);
  border-color: var(--border);
}

.tool-btn.active {
  background: var(--accent-soft);
  color: var(--accent-hover);
  border-color: rgba(193, 85, 59, 0.35);
}

.tool-btn:disabled {
  opacity: 0.36;
  cursor: not-allowed;
}

.primary-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 15px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(193, 85, 59, 0.25);
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.primary-cta:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(193, 85, 59, 0.32);
}

.primary-cta:active {
  transform: translateY(0);
}

.primary-cta.large {
  width: 100%;
  height: 44px;
  font-size: 13.5px;
  border-radius: var(--radius-md);
}

/* --- Main 3-Pane Workspace --- */
.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 262px 1fr 276px;
  overflow: hidden;
}

/* Left Rail */
.left-panel,
.right-panel {
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 15;
}

.left-panel {
  border-right: 1px solid var(--border);
}

.right-panel {
  border-left: 1px solid var(--border);
}

.panel-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 6px 0;
  gap: 2px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.panel-tab {
  border: none;
  background: transparent;
  padding: 8px 3px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.panel-tab:hover {
  color: var(--ink);
}

.panel-tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.tab-count {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  font-size: 10.5px;
  padding: 0 6px;
  border-radius: 999px;
  color: var(--ink-muted);
}

.panel-body {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 24px;
}

.panel-body.active {
  display: block;
}

.panel-hint {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--ink-muted);
  margin: 0 0 12px;
}

.palette-section-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted); /* 1.0.9: was --ink-faint, too light for 10.5 px text */
  margin: 14px 2px 7px;
}

.palette-section-title:first-child {
  margin-top: 2px;
}

.palette-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.palette-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 9px 9px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: grab;
  text-align: left;
  transition: all 0.14s ease;
  user-select: none;
}

.palette-item:hover {
  border-color: var(--accent);
  background: #ffffff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.palette-item:active {
  cursor: grabbing;
  transform: translateY(0);
}

.palette-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--accent-hover);
  display: grid;
  place-items: center;
}

.palette-name {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}

/* Stickers & Washi Sheet Tab */
.stickers-tab-body {
  padding-top: 0;
}

.stickers-sticky-top {
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--surface-solid);
  padding: 10px 0 6px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle);
}

.sticker-mode-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}

.sticker-mode-btn {
  border: none;
  background: transparent;
  padding: 5px 4px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 0.14s ease;
  white-space: nowrap;
}

.sticker-mode-btn:hover {
  color: var(--ink);
}

.sticker-mode-btn.active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(36, 32, 28, 0.1);
}

.sticker-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.sticker-search-icon {
  position: absolute;
  left: 9px;
  color: var(--ink-faint);
  pointer-events: none;
}

.sticker-search-wrap .sticker-search {
  padding: 7px 28px 7px 31px;
  font-size: 12px;
  margin: 0;
}

.sticker-search-clear {
  position: absolute;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: var(--surface-muted);
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.sticker-search-clear:hover {
  background: var(--border);
  color: var(--ink);
}

.sticker-search-clear.hidden {
  display: none;
}

.sticker-count-meta {
  font-size: 10.5px;
  color: var(--ink-faint);
  margin: 0 2px 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.cross-mode-link {
  border: none;
  background: none;
  padding: 0;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.cross-mode-link:hover {
  color: var(--accent-hover);
}

.sticker-pack-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.sticker-pack-pill {
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--ink-muted);
  font-size: 10.5px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.sticker-pack-pill:hover {
  color: var(--ink);
  border-color: #b8b0a3;
}

.sticker-pack-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-hover);
}

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

.stickers-sheet-grid.washi-mode {
  grid-template-columns: 1fr;
  gap: 7px;
}

.sticker-sheet-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 9px 6px 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-solid);
  cursor: grab;
  transition: all 0.15s ease;
  user-select: none;
}

.sticker-sheet-item:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.sticker-sheet-item:active {
  cursor: grabbing;
  transform: translateY(0);
}

.sticker-preview-well {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 4px;
  overflow: hidden;
}

.sticker-preview-well canvas {
  width: 56px;
  height: 56px;
  display: block;
}

.sticker-preview-well img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.washi-sheet-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  padding: 8px 9px 7px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-solid);
  cursor: grab;
  text-align: left;
  transition: all 0.15s ease;
  user-select: none;
}

.washi-sheet-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.washi-preview-well {
  width: 100%;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px 5px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.washi-preview-well img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.sticker-sheet-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
  line-height: 1.2;
}

.washi-sheet-item .sticker-sheet-label {
  text-align: left;
  font-size: 11px;
}

.inspector-img-preview {
  width: 100%;
  height: 84px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  padding: 8px;
}

.inspector-img-preview img {
  max-width: 100%;
  max-height: 68px;
  object-fit: contain;
}

/* Templates list */
.templates-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.template-card {
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-solid);
  cursor: pointer;
  transition: all 0.15s ease;
}

.template-card:hover {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.template-card strong {
  display: block;
  font-size: 13px;
  margin-bottom: 3px;
}

.template-card span {
  display: block;
  font-size: 11.5px;
  color: var(--ink-muted);
  line-height: 1.35;
}

/* Pages Deck */
.pages-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.soft-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-solid);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.14s ease;
}

.soft-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.soft-btn.full-width {
  width: 100%;
}

.pages-deck {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.page-thumb-card {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface-solid);
  cursor: pointer;
  transition: all 0.15s ease;
  align-items: center;
}

.page-thumb-card:hover {
  border-color: #b8b0a3;
}

.page-thumb-card.active {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(193, 85, 59, 0.12);
}

.page-thumb-canvas {
  width: 62px;
  height: auto;
  border-radius: 4px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  display: block;
  background: #fff;
}

.page-thumb-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.page-thumb-title {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-thumb-sub {
  font-size: 11px;
  color: var(--ink-muted);
}

.page-thumb-actions {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}

.mini-action {
  border: 1px solid var(--border);
  background: var(--surface-muted);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
}

.mini-action:hover {
  color: var(--ink);
  border-color: #b8b0a3;
}

.mini-action.danger:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: var(--danger-soft);
}

/* --- Center Desk Canvas --- */
.desk-area {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background-color: var(--bg-desk);
  background-image: radial-gradient(var(--bg-desk-dot) 1px, transparent 1px);
  background-size: 20px 20px;
}

.desk-stage {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 40px 80px;
}

.paper-wrapper {
  position: relative;
  flex-shrink: 0;
  border-radius: 2px;
  box-shadow: var(--shadow-paper);
  background: #ffffff;
  transition: box-shadow 0.2s ease;
}

.paper-wrapper.drop-target {
  box-shadow: 0 0 0 3px var(--accent), var(--shadow-paper);
}

.page-canvas {
  display: block;
  border-radius: 2px;
}

.interaction-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
}

.widget-hitbox {
  position: absolute;
  border: 1.5px solid transparent;
  border-radius: 3px;
  cursor: move;
  transition: border-color 0.1s ease, background-color 0.1s ease;
}

.widget-hitbox:hover {
  border-color: rgba(193, 85, 59, 0.5);
  background: rgba(193, 85, 59, 0.04);
}

.widget-hitbox.selected {
  border-color: var(--sel-ring);
  background: rgba(193, 85, 59, 0.045);
  z-index: 6;
}

.resize-handle {
  position: absolute;
  width: 9px;
  height: 9px;
  background: #ffffff;
  border: 1.8px solid var(--sel-ring);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  z-index: 10;
}

.resize-handle[data-dir="nw"] { top: -5px; left: -5px; cursor: nwse-resize; }
.resize-handle[data-dir="ne"] { top: -5px; right: -5px; cursor: nesw-resize; }
.resize-handle[data-dir="sw"] { bottom: -5px; left: -5px; cursor: nesw-resize; }
.resize-handle[data-dir="se"] { bottom: -5px; right: -5px; cursor: nwse-resize; }
.resize-handle[data-dir="n"]  { top: -5px; left: calc(50% - 4.5px); cursor: ns-resize; }
.resize-handle[data-dir="s"]  { bottom: -5px; left: calc(50% - 4.5px); cursor: ns-resize; }
.resize-handle[data-dir="w"]  { left: -5px; top: calc(50% - 4.5px); cursor: ew-resize; }
.resize-handle[data-dir="e"]  { right: -5px; top: calc(50% - 4.5px); cursor: ew-resize; }

/* On-Canvas Rotate Handle for Stickers & Washi Tape */
.rotate-stem {
  position: absolute;
  top: -22px;
  left: calc(50% - 0.75px);
  width: 1.5px;
  height: 17px;
  background: var(--sel-ring);
  pointer-events: none;
  z-index: 9;
}

.rotate-handle {
  position: absolute;
  top: -33px;
  left: calc(50% - 10px);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  border: 1.8px solid var(--sel-ring);
  color: var(--sel-ring);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
  display: grid;
  place-items: center;
  cursor: grab;
  z-index: 12;
  transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.rotate-handle:hover {
  background: var(--sel-ring);
  color: #ffffff;
  transform: scale(1.1);
}

.rotate-handle:active {
  cursor: grabbing;
}

.rotate-readout {
  position: absolute;
  top: -58px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fcfaf6;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 25;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.rot-quick-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-top: -4px;
}

.snap-guides {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 9;
}

.snap-guide-v,
.snap-guide-h {
  position: absolute;
  background: var(--guide-line);
  opacity: 0.85;
}

.snap-guide-v {
  top: 0;
  bottom: 0;
  width: 1px;
}

.snap-guide-h {
  left: 0;
  right: 0;
  height: 1px;
}

/* Floating Quick Action Bar on Selected Widget */
.floating-bar {
  position: absolute;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: var(--ink);
  color: #fcfaf6;
  box-shadow: 0 8px 22px rgba(24, 20, 16, 0.26);
  transform: translateX(-50%);
}

.floating-bar.hidden {
  display: none;
}

.floating-bar button {
  border: none;
  background: transparent;
  color: #f4efe6;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
}

.floating-bar button:hover {
  background: rgba(255, 255, 255, 0.14);
}

.floating-bar button.danger {
  color: #fda4af;
}

.floating-bar button.danger:hover {
  background: rgba(244, 63, 94, 0.22);
}

/* Bottom Desk Dock */
.desk-dock {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(252, 250, 246, 0.92);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(36, 32, 28, 0.12);
  backdrop-filter: blur(10px);
  z-index: 20;
}

.dock-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dock-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
}

.dock-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.dock-btn.text {
  width: auto;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11.5px;
}

.dock-btn:hover {
  background: var(--surface-muted);
}

.dock-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
  padding: 0 4px;
  white-space: nowrap;
}

.dock-label.mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
  min-width: 44px;
  text-align: center;
}

/* --- Right Inspector Panel --- */
.inspector-header {
  padding: 13px 14px 11px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.inspector-header h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.inspector-sub {
  font-size: 11px;
  color: var(--ink-muted);
}

.inspector-body {
  flex: 1;
  overflow-y: auto;
  padding: 13px 14px 28px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

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

.field-row-4 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.01em;
}

.studio-input,
.studio-select,
.studio-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  padding: 7px 9px;
  font-size: 12.5px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.studio-input:focus,
.studio-select:focus,
.studio-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(193, 85, 59, 0.14);
}

.studio-textarea {
  resize: vertical;
  min-height: 76px;
  line-height: 1.45;
}

.studio-range {
  width: 100%;
  accent-color: var(--accent);
}

.swatch-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.swatch-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: transform 0.12s ease;
}

.swatch-btn:hover {
  transform: scale(1.1);
}

.swatch-btn.active {
  border-color: var(--ink);
  transform: scale(1.12);
}

.swatch-reset {
  font-size: 11px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  border-radius: 999px;
  padding: 3px 8px;
  cursor: pointer;
  color: var(--ink-muted);
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.sticker-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 7px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  cursor: pointer;
  font-size: 10px;
  color: var(--ink-muted);
  text-align: center;
}

.sticker-choice:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.sticker-choice.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-weight: 600;
}

.sticker-choice canvas {
  width: 34px;
  height: 34px;
  display: block;
}

.inspector-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 2px 0;
}

.align-btns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.align-btn {
  padding: 6px 4px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  color: var(--ink-muted);
  cursor: pointer;
}

.align-btn:hover {
  border-color: var(--accent);
  color: var(--ink);
  background: #ffffff;
}

.toggles-card {
  background: var(--surface-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 11px;
  gap: 10px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  font-size: 12px;
}

.toggle-row strong {
  display: block;
  font-size: 12px;
}

.toggle-row small {
  display: block;
  font-size: 10.5px;
  color: var(--ink-muted);
  margin-top: 1px;
}

.toggle-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}

.danger-btn {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(181, 66, 66, 0.35);
  background: var(--danger-soft);
  color: #963636; /* 1.0.9: darker than --danger for contrast on the pink */
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.danger-btn:hover {
  background: #f6dada;
}

/* --- Confirm & Export Printable PDF Modal --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(24, 21, 18, 0.56);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 100;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  width: min(1040px, 96vw);
  max-height: 92vh;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 400;
  line-height: 1.1;
}

.modal-subtitle {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--ink-muted);
}

.close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  font-size: 22px;
  line-height: 1;
  color: var(--ink-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.close-btn:hover {
  color: var(--ink);
  background: #e7e1d6;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  min-height: 0;
  overflow: hidden;
}

.preview-pane {
  background: var(--bg-desk);
  background-image: radial-gradient(var(--bg-desk-dot) 1px, transparent 1px);
  background-size: 18px 18px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  overflow-y: auto;
  border-right: 1px solid var(--border-subtle);
}

.preview-toolbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  padding: 4px 11px;
  border-radius: 999px;
}

.sheet-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
}

.preview-canvas-wrap {
  flex: 1;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 280px;
}

.sheet-preview-canvas {
  max-width: 100%;
  max-height: 54vh;
  width: auto !important;
  height: auto !important;
  background: #ffffff;
  border-radius: 2px;
  box-shadow: 0 14px 36px rgba(24, 20, 16, 0.18), 0 2px 6px rgba(24, 20, 16, 0.08);
}

.preview-tip {
  width: 100%;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--ink-muted);
  background: rgba(252, 250, 246, 0.88);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 12px;
}

.export-controls {
  padding: 18px 22px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.seg-btn {
  padding: 9px 10px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: #ffffff;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  transition: all 0.14s ease;
}

.seg-btn small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-muted);
  margin-top: 2px;
}

.seg-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.summary-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-muted);
}

.summary-box strong {
  color: var(--ink);
}

.progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.progress-wrap.hidden {
  display: none;
}

.progress-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: var(--surface-muted);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.18s ease;
}

.progress-label {
  font-size: 11.5px;
  color: var(--ink-muted);
}

.export-actions {
  margin-top: auto;
  padding-top: 4px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fcfaf6;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 10px 28px rgba(24, 20, 16, 0.25);
  z-index: 200;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
}

/* Responsive adjustments for smaller laptop windows */
@media (max-width: 1220px) {
  .brand-sub,
  .dim-badge {
    display: none;
  }
  .workspace {
    grid-template-columns: 230px 1fr 246px;
  }
}

@media (max-width: 1020px) {
  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 8px;
  }
  .topbar-center {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .workspace {
    grid-template-columns: 210px 1fr 226px;
  }
}

@media (max-width: 920px) {
  .modal-grid {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }
  .preview-pane {
    overflow: visible;
    flex-shrink: 0;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .preview-canvas-wrap {
    min-height: 220px;
  }
  .sheet-preview-canvas {
    max-height: 40vh;
  }
  .export-controls {
    overflow: visible;
    flex-shrink: 0;
  }
}

/* Custom planner size inputs (mm) */
.custom-size-inputs { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.custom-size-inputs.hidden, .dim-badge.hidden { display: none; }
.custom-mm-input { width: 62px; padding: 3px 6px; border: 1px solid rgba(0,0,0,0.18); border-radius: 8px; font: inherit; background: #fff; }
/* Print-at-actual-size notes in the export dialog */
.print-actual-note { display: inline-block; margin-top: 6px; color: #8a3b2a; }
.export-actual-size-note { margin: 8px 0 0; font-size: 12px; text-align: center; color: #8a3b2a; }

/* Theme gallery is moved to <body> by app.js and placed against the viewport,
   so the top bar's scroll container (<=1020px) can no longer clip it. */
.theme-popover.theme-popover--floating {
  position: fixed;
  transform: none;
  z-index: 140;
}

/* The toast is text-only; let clicks pass through so it never blocks the theme gallery's bottom row. */
.toast { pointer-events: none; }

/* ---------------------------------------------------------------------------------------------
   The Print Drop by Stationery Drop Watch: branding, Free/Pro gate, mobile layout
   --------------------------------------------------------------------------------------------- */
h1, h2, h3, .brand-name, .modal-header h2, .inspector-header h2 { font-family: var(--font-serif); font-weight: 600; }
.brand-mark { background: var(--sdw-accent); }
.brand-name { font-size: 21px; }
a.brand-sub { color: var(--ink-muted); text-decoration: none; }
a.brand-sub:hover { color: var(--accent); text-decoration: underline; }

/* Free / Pro badges */
.pro-chip {
  position: absolute; top: 5px; right: 5px;
  font: 700 9.5px/1 var(--font-ui); letter-spacing: 0.04em; text-transform: uppercase;
  color: #fff; background: var(--sdw-plum); padding: 3px 5px; border-radius: 5px;
  pointer-events: none;
}
.pro-chip.inline { position: static; display: inline-block; vertical-align: 1px; margin-left: 4px; }
body.is-pro .pro-chip.inline { display: none; }
.sticker-sheet-item, .washi-sheet-item { position: relative; }
.sticker-sheet-item.locked img, .washi-sheet-item.locked img, .sticker-sheet-item.locked canvas { opacity: 0.55; filter: saturate(0.7); }
.theme-card-name { width: 100%; justify-content: space-between; }
.theme-card-badges { display: inline-flex; gap: 4px; align-items: center; }
.theme-badge { font: 700 9px/1 var(--font-ui); letter-spacing: 0.05em; text-transform: uppercase; padding: 3px 5px; border-radius: 5px; }
.theme-badge.dark { background: var(--surface-muted); color: var(--ink-muted); border: 1px solid var(--border); }
.theme-badge.free { background: #e4efe7; color: #3f6a4c; }
.theme-badge.pro { background: #ece4f2; color: var(--sdw-plum); }
.theme-card.locked { background: #fbf8f2; }
.theme-card.locked .theme-card-swatches { opacity: 0.7; }

.pro-status-btn {
  height: 32px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  border: 1px dashed var(--sdw-plum); background: transparent; color: var(--sdw-plum);
  font: 700 12px var(--font-ui); white-space: nowrap;
}
.pro-status-btn:hover { background: #f3edf6; }
.pro-status-btn.on { border-style: solid; background: var(--sdw-plum); color: #fff; }

.pro-blocker-note, .free-footer-note { display: block; margin-top: 8px; font-size: 12px; }
.pro-blocker-note { padding: 8px 10px; border-radius: 8px; background: #f3edf6; color: #4e3a5a; border: 1px solid #e0d3e8; }
.free-footer-note { color: var(--ink-muted); }

/* Pro dialog */
.pro-gate-card { width: min(520px, 94vw); }
.soon-tag { font: 700 10px/1 var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase; vertical-align: 4px; margin-left: 6px; padding: 4px 6px; border-radius: 5px; background: var(--accent-soft); color: var(--accent-hover); }
.pro-gate-reason { margin: 6px 0 0; color: var(--sdw-plum); font-weight: 700; font-size: 13.5px; }
.pro-gate-body { padding: 16px 22px 20px; overflow-y: auto; font-size: 14px; line-height: 1.45; }
.pro-gate-lede { margin: 0 0 10px; }
.pro-gate-list { margin: 0 0 12px; padding-left: 20px; }
.pro-price { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: #fff; }
.pro-price p { margin: 0; }
.pro-price-main { font-size: 14px; color: var(--ink); }
.pro-price-main .soon-tag { vertical-align: 2px; white-space: nowrap; }
.pro-price-amt { font: 700 19px/1.2 var(--font-ui); color: var(--ink); }
.pro-price-founder { margin-top: 6px !important; font-size: 13px; color: var(--sdw-plum); }
.pro-price-note { margin-top: 4px !important; font-size: 12px; color: var(--ink-muted); }
.pro-gate-list li { margin: 3px 0; }
.pro-gate-free { margin: 0 0 14px; color: var(--ink-muted); font-size: 13px; }
.pro-gate-cta { width: 100%; justify-content: center; }
.pro-gate-cta:disabled { opacity: 0.7; cursor: default; }
.pro-gate-foot { margin: 10px 0 0; font-size: 12.5px; color: var(--ink-muted); text-align: center; }
.pro-gate-foot a { color: var(--accent); }
.pro-test-box { display: none; margin-top: 14px; padding: 10px 12px; border-radius: 10px; border: 1px solid #e0d3e8; background: #f6f1f9; flex-direction: column; gap: 6px; font-size: 12.5px; }
body.is-pro .pro-test-box { display: flex; }
body.is-pro .pro-gate-cta, body.is-pro .pro-gate-free { display: none; }

/* Mobile bottom tabs: hidden on desktop */
.mobile-tabs { display: none; }

@media (max-width: 760px) {
  .studio-shell { height: 100vh; height: 100dvh; padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  .topbar { padding: 6px 8px; gap: 6px; row-gap: 6px; }
  .topbar-left { gap: 6px; flex: 1 1 auto; min-width: 0; }
  .topbar-divider, .brand-sub, #snapGridBtn, #saveJsonBtn, #loadJsonBtn, #openExportBtn { display: none; }
  .brand-mark { width: 30px; height: 30px; }
  .brand-name { font-size: 18px; }
  .control-pill { min-width: 0; flex: 1 1 auto; height: 32px; }
  .control-pill .pill-select { min-width: 0; width: 100%; }
  .custom-size-inputs { flex-wrap: nowrap; }
  .custom-mm-input { width: 52px; }
  .topbar-right { gap: 4px; }
  .topbar-right .btn-group .tool-btn { width: 30px; height: 30px; }
  .pro-status-btn { height: 30px; padding: 0 9px; font-size: 11px; }
  .topbar-center { order: 3; width: 100%; justify-content: space-between; overflow: visible; }
  .theme-picker-wrap { flex: 1 1 auto; min-width: 0; }
  .theme-picker-btn { flex: 1 1 auto; min-width: 0; }

  .workspace { display: block; position: relative; flex: 1; min-height: 0; }
  .desk-area { position: absolute; inset: 0; }
  .desk-stage { padding: 12px 10px 70px; }
  .desk-dock { bottom: 10px; padding: 4px 8px; gap: 4px; max-width: calc(100vw - 16px); }
  .left-panel, .right-panel { position: absolute; inset: 0; display: none; border: 0; z-index: 30; }
  body[data-mtab='add'] .left-panel { display: flex; }
  body[data-mtab='edit'] .right-panel { display: flex; }
  .panel-tab { font-size: 13px; padding: 10px 4px; }
  .palette-grid { grid-template-columns: repeat(2, 1fr); }
  .floating-bar { max-width: calc(100vw - 24px); flex-wrap: wrap; }

  .mobile-tabs {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    height: calc(58px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface-solid); border-top: 1px solid var(--border);
    box-shadow: 0 -6px 18px rgba(45, 42, 50, 0.06);
  }
  .mobile-tabs button {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: 0; background: none; color: var(--ink-muted); font: 600 11.5px var(--font-ui); cursor: pointer;
  }
  .mobile-tabs button.active { color: var(--accent); }
  .mobile-tabs button[data-mtab='export'] { color: var(--accent-hover); }
  .toast { bottom: calc(72px + env(safe-area-inset-bottom)); max-width: calc(100vw - 24px); text-align: center; }
  .modal-backdrop { padding: 8px; }
  .modal-card { max-height: calc(100dvh - 16px); width: 100%; }
}
a.brand-sub { white-space: nowrap; }
/* Keep the app name on one line; the header gives way elsewhere instead. */
.brand { flex-shrink: 0; }
.brand-name { white-space: nowrap; }
.pro-status-btn .short { display: none; }
.primary-cta .cta-short { display: none; }
/* Laptop widths: tighten the header so every control stays on one row and on screen. */
@media (max-width: 1500px) and (min-width: 761px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .topbar-left, .topbar-center, .topbar-right { gap: 6px; }
  .theme-picker-count { display: none; }
  .primary-cta .cta-long { display: none; }
  .primary-cta .cta-short { display: inline; }
}
@media (max-width: 1360px) and (min-width: 761px) {
  .dim-badge { display: none; }
  .pro-status-btn .long { display: none; }
  .pro-status-btn .short { display: inline; }
}
@media (max-width: 1180px) and (min-width: 761px) {
  #inkSaverToggle span:not(.pro-chip) { display: none; }
  .theme-picker-label { display: none; }
}
@media (max-width: 1100px) and (min-width: 761px) {
  .topbar { gap: 6px; padding: 0 10px; }
  .topbar-divider { display: none; }
  .brand-name { font-size: 19px; }
}
@media (max-width: 760px) {
  .brand-text { display: none; }
  .pro-status-btn .long { display: none; }
  .pro-status-btn .short { display: inline; }
  .topbar-left { flex: 1 1 0; }
  .topbar-right { flex: 0 0 auto; }
  #inkSaverToggle span:not(.pro-chip) { display: none; }
}

/* Pro templates and Pro elements (step 1, Nov 25) */
.template-card, .palette-item { position: relative; }
.template-card.locked strong, .template-card.locked span:not(.pro-chip) { opacity: 0.62; }
.template-card.locked strong { padding-right: 34px; }
.template-card span.pro-chip { display: inline-block; color: #fff; font-size: 9.5px; line-height: 1; margin: 0; }
.palette-item.locked .palette-icon, .palette-item.locked .palette-name { opacity: 0.55; }
.template-group-title { margin-top: 8px; }

/* ---------------------------------------------------------------------------------------------
   Beta 1.0.0: invite code, version label, feedback
   --------------------------------------------------------------------------------------------- */
.beta-code-form { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.beta-code-row { display: flex; gap: 8px; }
.beta-code-row input { flex: 1; min-width: 0; padding: 9px 10px; border: 1px solid var(--border); border-radius: 9px; font: 600 14px var(--font-ui); letter-spacing: 0.04em; background: #fff; color: var(--ink); }
.beta-code-msg { min-height: 1.2em; margin: 0; font-size: 12.5px; color: var(--ink-muted); }
.beta-code-msg.err { color: #a33a3a; }
.beta-code-msg.ok { color: #2f7a4b; }
body.is-pro .beta-code-form { display: none; }
.beta-corner { position: fixed; left: 10px; bottom: 10px; z-index: 80; display: flex; align-items: center; gap: 6px; padding: 3px 4px 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.86); border: 1px solid var(--border); box-shadow: 0 2px 8px rgba(45, 42, 50, 0.08); font: 600 10.5px var(--font-ui); color: var(--ink-muted); }
.beta-feedback-btn { border: 0; border-radius: 999px; padding: 4px 9px; background: var(--accent-soft); color: var(--accent-hover); font: 700 10.5px var(--font-ui); cursor: pointer; }
.beta-feedback-btn:hover { background: var(--accent); color: #fff; }
.beta-legal-link { color: var(--ink-muted); font: 600 10.5px var(--font-ui); text-decoration: none; padding: 4px 3px; }
.beta-legal-link:last-child { padding-right: 7px; }
.beta-legal-link:hover { color: var(--accent-hover); text-decoration: underline; }
.legal-links { margin: 10px 0 0; font-size: 12px; color: var(--ink-muted); }
.legal-links a { color: var(--accent-hover); }
.help-legal { text-align: center; }
.feedback-card { max-width: 520px; }
.feedback-body { padding: 0 20px 18px; display: flex; flex-direction: column; gap: 10px; }
.feedback-body textarea { width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid var(--border); border-radius: 10px; font: 14px/1.45 var(--font-ui); resize: vertical; background: #fff; color: var(--ink); }
.feedback-who { margin: 0; font-size: 13px; }
.feedback-note { margin: 0; font-size: 11.5px; color: var(--ink-muted); }
.feedback-email-free { padding-top: 0; }
.feedback-mail-btn { align-self: flex-start; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; height: auto; min-height: 40px; padding-top: 9px; padding-bottom: 9px; line-height: 1.2; }
.feedback-note a, .feedback-email-alt a { color: var(--accent-hover); }
.feedback-email-alt { margin-top: 2px; }
#feedbackForm.hidden, .feedback-email-free.hidden { display: none; }
.feedback-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.theme-coming-later { grid-column: 1 / -1; margin: 4px 2px 0; font-size: 12px; color: var(--ink-muted); }
@media (max-width: 760px) {
  .beta-corner { left: 8px; bottom: calc(108px + env(safe-area-inset-bottom)); padding: 2px 3px 2px 7px; font-size: 10px; }
}
@media print { .beta-corner { display: none; } }

/* --- Print & cut sticker sheets (transparent PNG sizes) --- */
.printcut-only { display: none; }
#exportModal.printcut-mode .pdf-only { display: none !important; }
#exportModal.printcut-mode .printcut-only { display: block; }
#exportModal.printcut-mode .sheet-preview-canvas { box-shadow: 0 0 0 1px #cbd5e1; }
.printcut-note { color: #6b4e16; }
.printcut-ok { color: #166534; font-weight: 600; }
.widget-hitbox.printcut-issue { outline: 2px solid #dc2626; outline-offset: 1px; }
.desk-area.printcut-active .desk-stage { padding-top: 76px; }
@media (max-width: 760px) { .desk-area.printcut-active .desk-stage { padding-top: 56px; } }
.printcut-banner {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  z-index: 30; width: max-content; max-width: min(680px, calc(100% - 24px));

  padding: 6px 12px; border-radius: 10px; font-size: 12px; line-height: 1.35;
  background: #fef2f2; color: #7f1d1d; border: 1px solid #fecaca;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08); pointer-events: none;
}
.printcut-banner .pcb-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.printcut-banner.hidden { display: none; }
@media (max-width: 760px) { .printcut-banner { top: 6px; font-size: 11px; } }
.printcut-banner.ok { background: #eff6ff; color: #1e3a8a; border-color: #bfdbfe; }

/* Beta 1.0.1: The Print Drop logo in the header (replaces the terracotta book mark).
   The tile carries its own rounded corners and colours, so no background, radius or shadow here.
   Clear space = 1/4 of the icon height: 34 px icon -> 8.5 px; the .brand gap (9 px) and the 58 px bar cover it. */
.brand-logo { display: block; width: 34px; height: 34px; flex-shrink: 0; }
@media (max-width: 760px) {
  /* 28 px icon -> 7 px clear space: 8 px to the bar's top and left edges, 9 px to the name, 6 + 2 px to the next control. */
  .brand-logo { width: 28px; height: 28px; }
  .brand { margin-right: 2px; }
}

/* ---- Beta 1.0.2: sticker tools bar never wraps ---- */
.floating-bar { white-space: nowrap; flex-wrap: nowrap; width: max-content; }
@media (max-width: 760px) {
  /* Phones: dock the Duplicate / Up / Down / Delete bar above the bottom tabs, where the page dock
     normally sits, instead of floating over the page. The page dock and beta pill step aside while
     something is selected. */
  .floating-bar {
    position: fixed; left: 50% !important; top: auto !important;
    bottom: calc(66px + env(safe-area-inset-bottom));
    max-width: calc(100vw - 16px); flex-wrap: nowrap; gap: 4px; padding: 5px; z-index: 85;
  }
  .floating-bar button { font-size: 13px; padding: 0 14px; min-height: 40px; }
  body.has-selection .desk-dock, body.has-selection .beta-corner { visibility: hidden; }
  body.has-selection .toast { bottom: calc(126px + env(safe-area-inset-bottom)); }
  /* 1.0.3: the docked bar belongs to the Page view; don't let it cover the Add or Edit panels. */
  body:not([data-mtab='page']) .floating-bar { display: none !important; }
}

/* ---- Beta 1.0.2: ? button, help sheet, tour ---- */
.help-btn { font: 700 15px var(--font-ui); line-height: 1; }
@media (max-width: 760px) { .help-btn { width: 30px; height: 30px; } }
.help-card { max-width: 560px; }
.help-body { padding: 0 22px 20px; display: flex; flex-direction: column; gap: 12px; font-size: 14px; line-height: 1.5; color: var(--ink); overflow-y: auto; }
.help-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.help-check { background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; }
.help-check ul { margin: 6px 0 0; padding-left: 18px; }
.help-save { margin: 0; }
.help-actions { display: flex; justify-content: flex-end; }

body.tut-open { overscroll-behavior: none; }
.tut-blocker { position: fixed; inset: 0; z-index: 1200; background: transparent; }
.tut-blocker.tut-dim { background: rgba(43, 33, 24, 0.55); }
.tut-ring {
  position: fixed; z-index: 1201; border-radius: 14px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(43, 33, 24, 0.55); outline: 3px solid #C1553B; outline-offset: 2px;
  transition: left .2s ease, top .2s ease, width .2s ease, height .2s ease;
}
.tut-card {
  position: fixed; z-index: 1202; width: 340px; max-width: calc(100vw - 24px); box-sizing: border-box;
  background: #FBF6EC; color: #2b2118; border-radius: 16px; padding: 18px 20px 14px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.3); font-family: var(--font-ui);
}
.tut-card.tut-center { transform: translate(-50%, -50%); width: 380px; }
.tut-card h3 { font-family: 'Newsreader', Georgia, serif; font-size: 22px; line-height: 1.2; margin: 2px 28px 8px 0; }
.tut-body p { margin: 0 0 10px; font-size: 14.5px; line-height: 1.45; }
.tut-body .tut-note { font-size: 13px; background: rgba(193, 85, 59, 0.08); border-radius: 10px; padding: 8px 10px; }
.tut-count { font-size: 12px; color: #8a7a68; font-weight: 600; letter-spacing: .02em; }
.tut-x { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 22px; line-height: 1; color: #8a7a68; cursor: pointer; padding: 4px 6px; }
.tut-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.tut-skip { margin-right: auto; background: none; border: 0; color: #7a6a58; font-size: 13px; text-decoration: underline; cursor: pointer; padding: 8px 2px; }
.tut-back { background: none; border: 1px solid #d9cbb6; color: #2b2118; border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: 14px; cursor: pointer; }
.tut-row > .tut-back:first-child { margin-right: auto; }
.tut-next { background: #C1553B; color: #fff; border: 0; border-radius: 999px; padding: 9px 18px; font-weight: 700; font-size: 14px; cursor: pointer; }
.tut-card button:focus-visible { outline: 2px solid #2b2118; outline-offset: 2px; }
@media (max-width: 760px) {
  .tut-card { left: 12px; width: calc(100vw - 24px); }
  .tut-card.tut-center { width: calc(100vw - 24px); }
  .tut-card button { min-height: 44px; }
  .tut-body p { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { .tut-ring { transition: none; } }
@media print { .tut-blocker, .tut-ring, .tut-card { display: none; } }

/* Beta 1.0.3: what's new note in the help sheet */
.help-new { border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; }
.help-new p { margin: 4px 0 0; }
.help-new ul { margin: 6px 0 0; padding-left: 18px; }
.help-new li { margin: 3px 0; }
.help-new .help-new-older { margin-top: 8px; color: var(--ink-muted); font-size: 13px; }

/* Beta 1.0.3: collapsible FAQ in the help sheet. The body is the scroller (min-height 0 lets it shrink inside the flex card). */
.help-body { min-height: 0; flex: 1 1 auto; overscroll-behavior: contain; }
.help-lede { margin: 0; color: var(--ink-muted); font-size: 13px; }
.faq-head { margin: 10px 0 2px; font-family: 'Newsreader', Georgia, serif; font-size: 18px; font-weight: 600; color: var(--ink); }
.faq-item { border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.faq-item + .faq-item { margin-top: -4px; }
.faq-item summary { list-style: none; cursor: pointer; padding: 11px 40px 11px 14px; font-weight: 700; font-size: 14px; position: relative; min-height: 22px; border-radius: 12px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 20px; font-weight: 400; color: var(--accent); }
.faq-item[open] summary::after { content: '\2212'; }
.faq-item summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.faq-a { padding: 0 14px 12px; }
.faq-a p { margin: 0 0 8px; }
.faq-a p:last-child { margin-bottom: 0; }
.faq-a .help-check { margin-top: 8px; }
.help-body .help-steps { font-size: 14px; }
@media (max-width: 760px) {
  .faq-item summary { padding: 13px 40px 13px 12px; font-size: 15px; }
  .faq-a { font-size: 15px; }
  .help-body { padding: 0 14px 16px; }
}

/* Beta 1.0.7: personal-use notice under the download button */
.use-notice { margin: 8px 0 0; font: 600 12px/1.35 var(--font-ui); text-align: center; }
.use-notice a { color: var(--ink-muted); text-decoration: underline; text-underline-offset: 2px; }
.use-notice a:hover { color: var(--accent-hover); }

/* Beta 1.0.8: Drop Watch badges (help sheet), same CSS as the SDW footer */
.foot-badge{margin:0;display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:12px}
.foot-badge a{display:inline-block;line-height:0;max-width:100%}
.foot-badge img{width:150px;height:63px;object-fit:contain;object-position:center;display:block;max-width:100%}
.help-badges{margin:14px 0 4px}

/* Beta 1.0.9: "We moved" card on the old workers.dev address, and the /move page on app.theprintdrop.com. */
.move-notice{position:fixed;inset:0;z-index:10000;display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(43,36,30,.45)}
.move-card{max-width:440px;width:100%;background:#fffdf8;border:1px solid #e6dccb;border-radius:16px;padding:22px 22px 16px;box-shadow:0 12px 40px rgba(43,36,30,.25);text-align:center;font-family:'Liberation Sans',Arial,sans-serif;color:#2b241e}
.move-card h1,.move-card h2{font-family:'Newsreader',Georgia,serif;font-weight:600;margin:6px 0 10px;font-size:26px}
.move-card p{margin:0 0 12px;line-height:1.45;font-size:15px}
.move-card .primary-cta{display:inline-flex;justify-content:center;width:100%;max-width:360px;margin:4px auto 12px}
.move-small{font-size:13px !important;color:#6b5f52}
.move-link{background:none;border:0;padding:0;font:inherit;color:#a2492f;text-decoration:underline;cursor:pointer}
body.move-page{min-height:100vh;display:flex;align-items:center;justify-content:center;background:#fbf6ec;padding:16px;box-sizing:border-box}
.move-standalone #moveChoice{display:flex;flex-direction:column;gap:8px;align-items:center}
.move-standalone #moveChoice[hidden]{display:none}
