@font-face {
  font-family: "Noto Sans";
  src: url("fonts/noto-sans-latin-ext.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Noto Sans";
  src: url("fonts/noto-sans-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  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;
}
@font-face {
  font-family: "DM Sans";
  src: url("fonts/dm-sans.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/instrument-serif.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/instrument-serif-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #121110;
  --bg-deep: #0e0d0c;
  --panel: #181715;
  --panel-raised: #1d1c19;
  --panel-soft: #211f1b;
  --line: #2c2a25;
  --line-strong: #3a3730;
  --ink: #efeade;
  --ink-soft: #d7d1c5;
  --muted: #9d978b;
  --dim: #726d63;
  --accent: #ff5a36;
  --accent-soft: #ff795d;
  --accent-wash: rgba(255, 90, 54, 0.09);
  --paper: #fffdf8;
  --green: #93ad87;
  --font-ui: "Noto Sans", "DM Sans", "Segoe UI", sans-serif;
  --font-display: "Noto Sans", "DM Sans", "Segoe UI", sans-serif;
  --font-mono: "Noto Sans", "DM Sans", "Segoe UI", sans-serif;
  --shadow-sheet: 0 28px 70px rgba(0, 0, 0, 0.48), 0 3px 10px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 12px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
}

::selection {
  color: #191512;
  background: #f2b49e;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #38342d transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: #34312b;
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 9px;
}

*::-webkit-scrollbar-thumb:hover {
  background: #4a453d;
  background-clip: padding-box;
}

/* ── Boot ─────────────────────────────────────────────────────────────── */

.boot-loader {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background:
    radial-gradient(circle at 50% 40%, #1d1b18 0, transparent 46%),
    var(--bg);
  transition: opacity 0.42s ease, visibility 0.42s ease;
}

.boot-loader.is-gone {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  font-family: var(--font-display);
  font-size: 31px;
  letter-spacing: 0.01em;
}

.boot-logo {
  width: auto;
  height: 44px;
  flex: none;
  display: block;
  border-radius: 4px;
}



.boot-line {
  width: 194px;
  height: 1px;
  overflow: hidden;
  background: var(--line);
}

.boot-line span {
  display: block;
  width: 38%;
  height: 100%;
  background: var(--accent);
  animation: boot-slide 1.1s ease-in-out infinite;
}

.boot-loader p {
  margin: 0;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

@keyframes boot-slide {
  0% { transform: translateX(-110%); }
  55% { transform: translateX(110%); }
  100% { transform: translateX(290%); }
}

/* ── App shell ────────────────────────────────────────────────────────── */

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 600px;
  overflow: hidden;
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  flex: 0 0 66px;
  min-width: 0;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: #151412;
}

.brand {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  width: auto;
  height: 40px;
  flex: none;
  display: block;
  border-radius: 3px;
}

.brand-lockup {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 25px;
  line-height: 0.86;
  letter-spacing: 0.01em;
}

.brand-sub {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 6.5px;
  line-height: 1.2;
  letter-spacing: 0.19em;
  text-transform: uppercase;
  padding-left: 1px;
}

.project-block {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  gap: 3px;
  margin-left: 24px;
  padding-left: 22px;
  border-left: 1px solid var(--line);
}

.project-kicker {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.project-name {
  width: min(100%, 430px);
  margin: 0;
  padding: 1px 0 2px;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: border-color 0.15s ease;
}

.project-name:hover {
  border-bottom-color: var(--line-strong);
}

.project-name:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

.top-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  margin-left: auto;
}

.local-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.local-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(147, 173, 135, 0.08);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 33px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, transform 0.1s ease;
}

.btn svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #181310;
}

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

.btn-primary:disabled {
  border-color: #4a3a32;
  background: #3e2f28;
  color: #8e7b70;
}

.btn-quiet {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink-soft);
}

.btn-quiet:hover:not(:disabled) {
  border-color: #514b42;
  background: #22201c;
  color: var(--ink);
}

.btn-block {
  width: 100%;
  height: 38px;
}

.text-btn {
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s ease;
}

.text-btn:hover {
  color: var(--accent);
}

/* ── Workspace layout ─────────────────────────────────────────────────── */

.workspace {
  display: grid;
  grid-template-columns: 306px minmax(0, 1fr) 334px;
  flex: 1 1 auto;
  min-height: 0;
}

.source-panel,
.settings-panel {
  min-width: 0;
  min-height: 0;
  background: var(--panel);
}

.source-panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}

.settings-panel {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 54px;
  gap: 10px;
  padding: 0 17px;
  border-bottom: 1px solid var(--line);
}

.section-tag {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
}

.section-tag > span {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.08em;
}

.section-tag h2 {
  margin: 0;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
}

.count-pill {
  padding: 4px 6px 3px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* ── Source panel ─────────────────────────────────────────────────────── */

.source-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  padding: 13px 13px 0;
}

.dropzone {
  display: flex;
  align-items: center;
  flex: 0 0 72px;
  gap: 10px;
  padding: 0 11px;
  border: 1px dashed #3c3831;
  border-radius: 5px;
  background: #1b1a17;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover {
  border-color: var(--accent);
  background: #201c18;
}

.dropzone.is-busy {
  cursor: progress;
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-wash);
}

.dropzone-icon {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  border: 1px solid #3a3630;
  border-radius: 50%;
  color: var(--accent);
  transition: border-color 0.15s ease;
}

.dropzone:hover .dropzone-icon {
  border-color: #664337;
}

.dropzone-icon svg {
  width: 19px;
  height: 19px;
}

.dropzone-copy {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  gap: 3px;
}

.dropzone-copy strong {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropzone-copy small {
  overflow: hidden;
  color: var(--dim);
  font-size: 9px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropzone-plus {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  opacity: 0.8;
}

.source-note {
  margin: 9px 2px 13px;
  color: var(--dim);
  font-size: 9px;
  line-height: 1.45;
}

.pages-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  padding: 0 2px 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.drag-hint {
  color: #5f5a51;
  letter-spacing: 0.03em;
  text-transform: none;
}

.page-list {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 4px 15px 0;
}

.page-card {
  position: relative;
  display: grid;
  grid-template-columns: 17px 38px minmax(0, 1fr) auto;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  min-height: 64px;
  padding: 7px 7px 7px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #1c1b18;
  cursor: grab;
  transition: border-color 0.14s ease, background 0.14s ease, opacity 0.14s ease;
}

.page-card:hover {
  border-color: #443f37;
  background: #211f1b;
}

.page-card.is-selected {
  border-color: var(--accent);
  background: #231d19;
}

.page-card.is-selected::after {
  position: absolute;
  inset: -1px auto -1px -1px;
  width: 2px;
  border-radius: 3px 0 0 3px;
  background: var(--accent);
  content: "";
}

.page-card.dragging {
  opacity: 0.32;
}

.page-card.drop-before::before,
.page-card.drop-after::before {
  position: absolute;
  right: 2px;
  left: 2px;
  z-index: 5;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  content: "";
}

.page-card.drop-before::before {
  top: -5px;
}

.page-card.drop-after::before {
  bottom: -5px;
}

.page-index {
  align-self: start;
  padding-top: 2px;
  color: #615c53;
  font-family: var(--font-mono);
  font-size: 8px;
  line-height: 1;
  text-align: left;
}

.page-card.is-selected .page-index {
  color: var(--accent);
}

.page-thumb {
  position: relative;
  width: 38px;
  height: 50px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.28);
  border-radius: 1px;
  background: #f2eee5;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.page-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f2eee5;
}

.thumb-skeleton {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, #e4dfd4 0%, #f0ece2 40%, #e4dfd4 60%);
  background-size: 220% 100%;
  animation: skeleton 1.2s linear infinite;
}

@keyframes skeleton {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}

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

.page-name {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-source {
  overflow: hidden;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 7.5px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-rotation-badge {
  align-self: flex-start;
  margin-top: 1px;
  padding: 1px 3px;
  border: 1px solid #4d463d;
  border-radius: 2px;
  color: #b5a99a;
  font-family: var(--font-mono);
  font-size: 7px;
  line-height: 1.2;
}

.page-tools {
  display: flex;
  gap: 1px;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.page-card:hover .page-tools,
.page-card:focus-within .page-tools,
.page-card.is-selected .page-tools {
  opacity: 1;
}

.page-tool {
  display: grid;
  place-items: center;
  width: 19px;
  height: 21px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: #70695f;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.page-tool:hover {
  background: #332e27;
  color: var(--ink);
}

.page-tool[data-action="delete"]:hover {
  color: #ff856e;
}

.page-tool svg {
  width: 13px;
  height: 13px;
}

.page-list-empty {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  margin: 8px 0 20px;
  padding: 26px 18px;
  border: 1px dashed var(--line);
  border-radius: 4px;
  color: var(--dim);
  text-align: center;
}

.page-list-empty svg {
  width: 32px;
  height: 32px;
  margin-bottom: 11px;
  color: #4b463e;
}

.page-list-empty strong {
  margin-bottom: 5px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
}

.page-list-empty span {
  max-width: 160px;
  font-size: 9.5px;
  line-height: 1.5;
}

/* ── Stage ────────────────────────────────────────────────────────────── */

.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg-deep);
}

.stage-bar {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  flex: 0 0 50px;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: #141311;
}

.side-tabs {
  display: flex;
  justify-self: start;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #1b1a17;
}

.side-tab {
  height: 24px;
  padding: 0 11px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

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

.side-tab.is-active {
  background: #eee8dc;
  color: #191612;
}

.side-tabs[hidden] {
  visibility: hidden;
  display: flex;
}

.side-tab:disabled {
  opacity: 0.35;
}

.sheet-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
}

.pager-label {
  min-width: 146px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.03em;
  text-align: center;
  white-space: nowrap;
}

.pager-label i {
  margin-left: 5px;
  color: var(--accent);
  font-style: normal;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  flex: none;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  transition: background 0.13s ease, color 0.13s ease, border-color 0.13s ease;
}

.icon-btn:hover:not(:disabled) {
  border-color: var(--line);
  background: #22201c;
  color: var(--ink);
}

.icon-btn:disabled {
  opacity: 0.25;
}

.icon-btn svg {
  width: 14px;
  height: 14px;
}

.pager-btn {
  border-color: var(--line);
  background: #1a1916;
}

.zoom-control {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 2px;
}

.zoom-value {
  min-width: 38px;
  height: 25px;
  padding: 0 5px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  cursor: pointer;
}

.zoom-value:hover {
  background: #22201c;
  color: var(--ink);
}

.canvas-area {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 22px 28px;
  background-color: #0f0e0d;
  background-image:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.028) 0, transparent 47%),
    radial-gradient(circle at 1px 1px, rgba(221, 211, 193, 0.075) 1px, transparent 0);
  background-size: auto, 18px 18px;
}

.sheet-shell {
  flex: none;
  margin: auto;
  width: 720px;
  transition: width 0.15s ease;
}

.sheet-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin-bottom: 8px;
  color: #69645b;
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.sheet-topline span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

#sheetCanvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 1px;
  background: var(--paper);
  box-shadow: var(--shadow-sheet);
}

.preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(330px, 88%);
  margin: auto;
  padding-bottom: 30px;
  color: var(--dim);
  text-align: center;
}

.preview-empty[hidden] {
  display: none;
}

.empty-glyph {
  display: block;
  width: 64px;
  height: 64px;
  margin-bottom: 18px;
  color: #6e685e;
}

.empty-glyph svg {
  width: 100%;
  height: 100%;
}

.preview-empty h3 {
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
}

.preview-empty p {
  max-width: 230px;
  margin: 0 0 17px;
  font-size: 10px;
  line-height: 1.55;
}

.render-busy {
  position: absolute;
  bottom: 18px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(25, 24, 21, 0.92);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.04em;
  transform: translateX(-50%);
  backdrop-filter: blur(6px);
}

.render-busy[hidden] {
  display: none;
}

.spinner {
  width: 11px;
  height: 11px;
  border: 1px solid #4a443b;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.stage-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 36px;
  gap: 12px;
  padding: 0 16px;
  border-top: 1px solid var(--line);
  background: #141311;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  color: #847d71;
}

.live-badge i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 90, 54, 0.08);
}

.stage-specs {
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guide-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  padding: 4px 5px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: #5e594f;
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.14s ease, background 0.14s ease;
}

.guide-toggle:hover {
  background: #201e1a;
  color: var(--ink-soft);
}

.guide-toggle.is-on {
  color: #aaa296;
}

.guide-toggle svg {
  width: 13px;
  height: 13px;
}

/* ── Settings panel ───────────────────────────────────────────────────── */

.settings-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 13px 16px 3px;
}

.setting-group {
  padding: 0 0 15px;
  margin-bottom: 15px;
  border-bottom: 1px solid rgba(58, 55, 48, 0.55);
}

.setting-group:last-child {
  margin-bottom: 0;
  border-bottom: 0;
}

.group-label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.group-label i {
  flex: 1 1 auto;
  height: 1px;
  background: rgba(58, 55, 48, 0.55);
}

.select-field {
  display: block;
}

.field-caption {
  display: block;
  margin-bottom: 5px;
  color: var(--dim);
  font-size: 9px;
  line-height: 1.2;
}

.select-wrap {
  position: relative;
  display: block;
}

.select-wrap select {
  width: 100%;
  height: 34px;
  padding: 0 28px 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  appearance: none;
  background: #1e1d1a;
  color: var(--ink-soft);
  font-size: 10.5px;
  line-height: 1;
  cursor: pointer;
}

.select-wrap select:hover {
  border-color: #4b453b;
}

.select-wrap > svg {
  position: absolute;
  top: 50%;
  right: 9px;
  width: 11px;
  height: 11px;
  color: var(--dim);
  pointer-events: none;
  transform: translateY(-50%);
}

.orientation-row {
  margin: 8px 0 7px;
}

.segmented {
  display: flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #141311;
}

.segmented button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 1 1 0;
  height: 25px;
  padding: 0 7px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: #6d675d;
  font-size: 9.5px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.segmented button:hover {
  color: var(--ink-soft);
}

.segmented button.is-active {
  background: #2b2823;
  color: var(--ink);
}

.segmented button svg {
  width: 12px;
  height: 12px;
  flex: none;
}

.segmented.compact button {
  height: 23px;
  font-size: 9px;
}

.dimension-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.dimension-cross {
  padding-bottom: 10px;
  color: #575249;
  font-family: var(--font-mono);
  font-size: 9px;
}

.number-field {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  min-width: 0;
  gap: 4px;
}

.number-field > span:first-child {
  color: var(--dim);
  font-size: 9px;
  line-height: 1.2;
}

.number-wrap {
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 7px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: #1e1d1a;
  transition: border-color 0.14s ease;
}

.number-wrap:focus-within {
  border-color: var(--accent);
}

.number-wrap input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  appearance: textfield;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
}

.number-wrap input::-webkit-outer-spin-button,
.number-wrap input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.number-wrap input:focus {
  outline: none;
}

.number-wrap em {
  margin-left: 3px;
  color: #5f5a51;
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-style: normal;
  white-space: nowrap;
}

.mode-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.mode-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 55px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #1c1b18;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, color 0.14s ease;
}

.mode-card:hover {
  border-color: #464037;
  background: #211f1b;
}

.mode-card.is-active {
  border-color: rgba(255, 90, 54, 0.8);
  background: var(--accent-wash);
  color: var(--ink);
}

.mode-icon {
  display: grid;
  place-items: center;
  flex: 0 0 27px;
  color: #736c61;
}

.mode-card.is-active .mode-icon {
  color: var(--accent);
}

.mode-icon svg {
  width: 27px;
  height: 24px;
}

.mode-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.mode-copy strong {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.1;
}

.mode-copy small {
  overflow: hidden;
  color: var(--dim);
  font-size: 8px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mode-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border: 1px solid #49433a;
  border-radius: 50%;
}

.mode-card.is-active .mode-check {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 2px #2a1b16;
}

.grid-controls {
  margin-top: 9px;
}

.grid-controls[hidden],
.booklet-controls[hidden] {
  display: none;
}

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

.layout-chip {
  height: 27px;
  padding: 0 2px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #1b1a17;
  color: #726c62;
  font-size: 9.5px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.13s ease, background 0.13s ease, color 0.13s ease;
}

.layout-chip span {
  margin-left: 1px;
  font-family: var(--font-mono);
  font-size: 6.5px;
  text-transform: uppercase;
}

.layout-chip:hover {
  border-color: #4b453b;
  color: var(--ink-soft);
}

.layout-chip.is-active {
  border-color: #664035;
  background: var(--accent-wash);
  color: var(--accent-soft);
}

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

.stepper-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  min-width: 0;
}

.stepper-field > span {
  color: var(--dim);
  font-size: 9px;
}

.stepper {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  height: 26px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #1b1a17;
}

.stepper button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #7b7469;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.stepper button:hover {
  background: #2b2822;
  color: var(--ink);
}

.stepper output {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 100%;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.micro-note {
  margin: 7px 0 0;
  color: #5f5a51;
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.02em;
}

.booklet-controls {
  margin-top: 9px;
}

.booklet-note {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #1b1a17;
}

.booklet-diagram {
  flex: 0 0 34px;
  color: #8e8679;
}

.booklet-diagram svg {
  display: block;
  width: 34px;
  height: 30px;
}

.booklet-note p {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
  margin: 0;
}

.booklet-note strong {
  color: var(--ink-soft);
  font-size: 9.5px;
  font-weight: 500;
  line-height: 1.2;
}

.booklet-note p span {
  color: var(--dim);
  font-size: 8.5px;
  line-height: 1.35;
}

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

.fit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.fit-row .field-caption {
  margin: 0;
}

.fit-segment {
  flex: 0 0 112px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 9px 0 8px;
  border: 0;
  border-bottom: 1px solid rgba(58, 55, 48, 0.45);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.switch-row:last-child {
  padding-bottom: 2px;
  border-bottom: 0;
}

.switch-row > span:first-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.switch-row strong {
  color: var(--ink-soft);
  font-size: 9.5px;
  font-weight: 500;
  line-height: 1.2;
}

.switch-row small {
  color: var(--dim);
  font-size: 8.5px;
  line-height: 1.3;
}

.switch {
  position: relative;
  flex: 0 0 28px;
  width: 28px;
  height: 16px;
  border-radius: 10px;
  background: #353129;
  transition: background 0.16s ease;
}

.switch i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #898175;
  transition: transform 0.16s ease, background 0.16s ease;
}

.switch-row[aria-checked="true"] .switch {
  background: var(--accent);
}

.switch-row[aria-checked="true"] .switch i {
  background: #1b1512;
  transform: translateX(12px);
}

.switch-row:hover .switch i {
  background: #b6ad9f;
}

.switch-row[aria-checked="true"]:hover .switch i {
  background: #2c1b15;
}

.switch-row.is-disabled {
  opacity: 0.38;
  pointer-events: none;
}

.output-group {
  padding-bottom: 8px;
}

.output-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #1b1a17;
}

.output-note svg {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: var(--accent);
}

.output-note p {
  display: flex;
  flex-direction: column;
  margin: 0;
  gap: 2px;
}

.output-note strong {
  color: var(--ink-soft);
  font-size: 9.5px;
  font-weight: 500;
}

.output-note span {
  color: var(--dim);
  font-size: 8.5px;
  line-height: 1.35;
}

.output-dock {
  flex: 0 0 auto;
  padding: 11px 16px 12px;
  border-top: 1px solid var(--line);
  background: #161512;
}

.output-summary {
  margin-bottom: 9px;
}

.output-stats {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.02em;
}

.output-stats strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.output-stats i {
  width: 2px;
  height: 2px;
  margin: 0 1px;
  border-radius: 50%;
  background: #4c463d;
}

.output-summary p {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--dim);
  font-size: 8.5px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.privacy-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 7px 0 0;
  color: #5b564d;
  font-size: 7.5px;
  line-height: 1.3;
  text-align: center;
}

.privacy-line svg {
  width: 10px;
  height: 10px;
  flex: none;
}

/* ── Dialogs ──────────────────────────────────────────────────────────── */

.app-dialog {
  width: min(408px, calc(100vw - 34px));
  max-width: none;
  padding: 25px 26px 22px;
  border: 1px solid #3d3932;
  border-radius: 6px;
  background: #1c1b18;
  color: var(--ink);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.6);
}

.app-dialog::backdrop {
  background: rgba(8, 8, 7, 0.7);
  backdrop-filter: blur(3px);
}

.app-dialog form {
  margin: 0;
}

.dialog-kicker {
  display: block;
  margin-bottom: 10px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.app-dialog h2 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 400;
  line-height: 1.04;
}

.app-dialog p {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.55;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 22px;
}

.progress-dialog {
  text-align: center;
}

.progress-dialog .dialog-kicker {
  margin-top: 14px;
}

.progress-dialog h2 {
  margin-bottom: 8px;
}

.progress-dialog p {
  margin-right: auto;
  margin-left: auto;
  max-width: 280px;
}

.progress-glyph {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 38px;
  margin: 0 auto 2px;
}

.progress-glyph span {
  width: 9px;
  border-radius: 1px;
  background: var(--accent);
  animation: glyph-bars 1s ease-in-out infinite;
}

.progress-glyph span:nth-child(1) { height: 15px; animation-delay: -0.2s; }
.progress-glyph span:nth-child(2) { height: 29px; animation-delay: -0.1s; }
.progress-glyph span:nth-child(3) { height: 21px; }

@keyframes glyph-bars {
  0%, 100% { transform: scaleY(0.55); opacity: 0.55; }
  50% { transform: scaleY(1); opacity: 1; }
}

.progress-track {
  width: 100%;
  height: 2px;
  margin-top: 20px;
  overflow: hidden;
  background: #322e28;
}

.progress-track i {
  display: block;
  width: 8%;
  height: 100%;
  background: var(--accent);
  transition: width 0.32s ease;
}

.progress-small {
  margin-top: 9px !important;
  color: var(--dim) !important;
  font-family: var(--font-mono);
  font-size: 7.5px !important;
  letter-spacing: 0.02em;
}

/* ── Overlays ─────────────────────────────────────────────────────────── */

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 11, 10, 0.84);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  backdrop-filter: blur(5px);
}

.app.is-file-drag + .drop-overlay {
  opacity: 1;
  visibility: visible;
}

.drop-overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(420px, 100%);
  min-height: 230px;
  padding: 28px;
  border: 1px dashed var(--accent);
  border-radius: 7px;
  background: rgba(30, 25, 21, 0.86);
  text-align: center;
}

.drop-overlay-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 17px;
  border: 1px solid #6a4437;
  border-radius: 50%;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 25px;
  font-weight: 300;
}

.drop-overlay-card strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 29px;
  font-weight: 400;
}

.drop-overlay-card small {
  margin-top: 5px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(420px, calc(100vw - 30px));
  padding: 10px 14px 10px 12px;
  border: 1px solid #413c34;
  border-radius: 3px;
  background: #f3eee3;
  color: #201c17;
  font-size: 10.5px;
  line-height: 1.35;
  box-shadow: 0 13px 35px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast-mark {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
}

.toast.is-error {
  border-color: #7b3c2d;
  background: #f4ded7;
}

/* ── Responsive ───────────────────────────────────────────────────────── */

@media (max-width: 1240px) {
  .workspace {
    grid-template-columns: 276px minmax(0, 1fr) 312px;
  }

  .project-name {
    max-width: 310px;
  }

  .source-body {
    padding-right: 11px;
    padding-left: 11px;
  }

  .settings-scroll {
    padding-right: 13px;
    padding-left: 13px;
  }

  .output-dock {
    padding-right: 13px;
    padding-left: 13px;
  }

  .page-card {
    grid-template-columns: 15px 34px minmax(0, 1fr) auto;
    gap: 7px;
  }

  .page-thumb {
    width: 34px;
    height: 45px;
  }
}

@media (max-width: 1050px) {
  .app {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "stage"
      "source"
      "settings";
  }

  .stage {
    grid-area: stage;
    height: min(690px, 72vh);
    min-height: 470px;
    border-bottom: 1px solid var(--line);
  }

  .source-panel {
    grid-area: source;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .settings-panel {
    grid-area: settings;
    border-left: 0;
  }

  .source-body {
    padding-bottom: 4px;
  }

  .page-list {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 14px;
  }

  .page-card {
    flex: 0 0 222px;
    grid-template-columns: 15px 38px minmax(0, 1fr) auto;
  }

  .page-thumb {
    width: 38px;
    height: 50px;
  }

  .page-tools {
    opacity: 1;
  }

  .settings-scroll {
    overflow: visible;
  }

  .settings-panel {
    padding-bottom: 0;
  }

  .output-dock {
    position: sticky;
    bottom: 0;
    z-index: 6;
    padding: 12px 20px;
    box-shadow: 0 -15px 35px rgba(14, 13, 12, 0.4);
  }

  .output-summary {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 15px;
  }

  .output-summary p {
    margin: 0;
  }

  .output-dock .btn-block {
    width: min(380px, 100%);
  }

  .privacy-line {
    justify-content: flex-start;
    margin-top: 7px;
  }
}

@media (max-width: 760px) {
  .app {
    min-height: 100dvh;
  }

  .topbar {
    flex-basis: 58px;
    padding: 0 12px;
  }

  .brand-name {
    font-size: 22px;
  }

  .brand-sub {
    display: none;
  }

  .brand-logo {
    height: 34px;
  }

  .project-block {
    gap: 2px;
    margin-left: 12px;
    padding-left: 12px;
  }

  .project-kicker {
    font-size: 6.5px;
  }

  .project-name {
    max-width: 158px;
    font-size: 15px;
  }

  .top-actions {
    gap: 5px;
    margin-left: auto;
  }

  .local-pill {
    display: none;
  }

  .btn {
    height: 31px;
    padding: 0 9px;
    font-size: 9.5px;
  }

  .top-export span {
    display: none;
  }

  .top-export {
    width: 32px;
    padding: 0;
  }

  .sample-btn span,
  #sampleBtn span {
    display: none;
  }

  #sampleBtn {
    width: 32px;
    padding: 0;
  }

  .workspace {
    grid-template-areas:
      "stage"
      "source"
      "settings";
  }

  .stage {
    height: 62vh;
    min-height: 430px;
  }

  .stage-bar {
    grid-template-columns: auto 1fr auto;
    flex-basis: 47px;
    padding: 0 10px;
    gap: 5px;
  }

  .side-tab {
    padding: 0 8px;
  }

  .pager-label {
    min-width: 0;
    overflow: hidden;
    font-size: 7px;
    text-overflow: ellipsis;
  }

  .zoom-control {
    gap: 0;
  }

  .zoom-value {
    min-width: 32px;
    padding: 0 3px;
  }

  .canvas-area {
    padding: 15px;
  }

  .sheet-topline {
    font-size: 6.5px;
    letter-spacing: 0.03em;
  }

  .stage-foot {
    flex-basis: 33px;
    padding: 0 10px;
    font-size: 6.5px;
  }

  .stage-specs {
    display: none;
  }

  .guide-toggle span {
    display: none;
  }

  .panel-heading {
    flex-basis: 48px;
    padding: 0 13px;
  }

  .source-body {
    padding: 11px 11px 0;
  }

  .dropzone {
    flex-basis: 64px;
  }

  .source-note {
    margin-bottom: 11px;
  }

  .page-list {
    padding-bottom: 12px;
  }

  .page-card {
    flex: 0 0 205px;
  }

  .settings-scroll {
    padding: 12px 13px 3px;
  }

  .output-dock {
    padding: 11px 13px;
  }

  .output-summary {
    display: block;
  }

  .output-summary p {
    margin-top: 4px;
  }

  .output-dock .btn-block {
    width: 100%;
  }

  .privacy-line {
    justify-content: center;
  }

  .app-dialog {
    padding: 22px 20px 18px;
  }
}

@media (max-width: 520px) {
  .stage {
    height: 50vh;
    min-height: 380px;
  }
}

@media (max-width: 440px) {
  .brand-lockup {
    display: none;
  }

  .brand-logo {
    height: 31px;
  }

  .project-block {
    margin-left: 8px;
    padding-left: 9px;
  }

  .project-name {
    max-width: 132px;
  }

  .side-tabs,
  .side-tabs[hidden] {
    display: none;
  }

  .stage-bar {
    grid-template-columns: 1fr auto;
  }

  .sheet-pager {
    justify-content: flex-start;
  }

  .quick-row {
    gap: 2px;
  }

  .layout-chip {
    font-size: 9px;
  }

  .output-stats {
    font-size: 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ── Sticker studio additions ────────────────────────────────────────── */

.stage-label {
  display: flex;
  align-items: baseline;
  justify-self: start;
  gap: 8px;
  min-width: 0;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.stage-label b {
  padding: 2px 4px;
  border: 1px solid rgba(255, 90, 54, 0.4);
  border-radius: 2px;
  color: var(--accent);
  font-size: 7px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.design-list {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 7px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 4px 15px 0;
}

.design-card {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 19px;
  align-items: start;
  flex: 0 0 auto;
  gap: 9px;
  padding: 9px 8px 9px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #1c1b18;
  transition: border-color 0.14s ease, background 0.14s ease, opacity 0.14s ease;
}

.design-card:hover {
  border-color: #443f37;
  background: #211f1b;
}

.design-card.is-empty {
  opacity: 0.64;
}

.design-card.is-empty:hover {
  opacity: 0.9;
}

.design-thumb {
  position: relative;
  width: 44px;
  height: 58px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.3);
  border-radius: 2px;
  background-color: #f4efe4;
  background-image:
    linear-gradient(45deg, rgba(30, 26, 20, 0.035) 25%, transparent 25%, transparent 75%, rgba(30, 26, 20, 0.035) 75%),
    linear-gradient(45deg, rgba(30, 26, 20, 0.035) 25%, transparent 25%, transparent 75%, rgba(30, 26, 20, 0.035) 75%);
  background-position: 0 0, 5px 5px;
  background-size: 10px 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
}

.design-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.design-thumb .thumb-skeleton {
  position: absolute;
  inset: 0;
}

.design-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 6px;
  padding-top: 1px;
}

.design-head {
  display: flex;
  align-items: baseline;
  min-width: 0;
  gap: 5px;
  padding-right: 2px;
}

.design-index {
  flex: none;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.02em;
}

.design-name {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.design-source {
  overflow: hidden;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 7px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.mini-field {
  display: flex;
  align-items: center;
  flex: 1 1 0;
  gap: 3px;
  min-width: 0;
}

.mini-field > span {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.03em;
}

.mini-input {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  height: 24px;
  padding: 0 4px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: #171613;
  transition: border-color 0.13s ease;
}

.mini-input:focus-within {
  border-color: var(--accent);
}

.mini-input input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  appearance: textfield;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 8.5px;
  line-height: 1;
}

.mini-input input::-webkit-outer-spin-button,
.mini-input input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.mini-input input:focus {
  outline: none;
}

.mini-input em {
  margin-left: 2px;
  color: #5d574e;
  font-family: var(--font-mono);
  font-size: 6.5px;
  font-style: normal;
}

.dim-cross {
  color: #5e584f;
  font-family: var(--font-mono);
  font-size: 8px;
}

.design-qty-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.qty-caption {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.qty-stepper {
  display: flex;
  align-items: center;
  height: 24px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: #171613;
}

.qty-stepper button {
  display: grid;
  place-items: center;
  width: 19px;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #7e776b;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

.qty-stepper button:hover {
  background: #2c2822;
  color: var(--ink);
}

.qty-stepper input {
  width: 31px;
  height: 100%;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  appearance: textfield;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 8.5px;
  line-height: 1;
  text-align: center;
}

.qty-stepper input::-webkit-outer-spin-button,
.qty-stepper input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.qty-stepper input:focus {
  outline: none;
}

.fill-btn {
  margin-left: auto;
  padding: 3px 0 2px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: #777064;
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.07em;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.13s ease, border-color 0.13s ease;
}

.fill-btn:hover {
  border-bottom-color: rgba(255, 90, 54, 0.55);
  color: var(--accent-soft);
}

.design-delete {
  display: grid;
  place-items: center;
  width: 19px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: #635d54;
  cursor: pointer;
  transition: color 0.13s ease, background 0.13s ease;
}

.design-delete:hover {
  background: #332e27;
  color: #ff856e;
}

.design-delete svg {
  width: 13px;
  height: 13px;
}

.design-list-empty {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  margin: 8px 0 20px;
  padding: 26px 18px;
  border: 1px dashed var(--line);
  border-radius: 4px;
  color: var(--dim);
  text-align: center;
}

.design-list-empty svg {
  width: 32px;
  height: 32px;
  margin-bottom: 11px;
  color: #4b463e;
}

.design-list-empty strong {
  margin-bottom: 5px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
}

.design-list-empty span {
  max-width: 170px;
  font-size: 9.5px;
  line-height: 1.5;
}

.cut-export-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  height: 25px;
  margin-top: 5px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: #6b655b;
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: color 0.14s ease, background 0.14s ease;
}

.cut-export-link:hover:not(:disabled) {
  background: #201e1a;
  color: var(--ink-soft);
}

.cut-export-link:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.cut-export-link svg {
  width: 12px;
  height: 12px;
}

.output-summary.is-warning p {
  color: #ff9b7d;
}

@media (max-width: 1240px) {
  .design-card {
    grid-template-columns: 40px minmax(0, 1fr) 18px;
    gap: 7px;
  }

  .design-thumb {
    width: 40px;
    height: 53px;
  }

  .design-name {
    font-size: 10px;
  }
}

@media (max-width: 1050px) {
  .design-list {
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 14px;
  }

  .design-card {
    flex: 0 0 256px;
    grid-template-columns: 44px minmax(0, 1fr) 19px;
  }

  .design-thumb {
    width: 44px;
    height: 58px;
  }
}

@media (max-width: 760px) {
  .stage-label {
    display: none;
  }

  .stage-bar {
    grid-template-columns: 1fr auto;
  }

  .design-card {
    flex-basis: 244px;
  }

  .cut-export-link {
    height: 23px;
  }
}

@media (max-width: 440px) {
  .stage-bar {
    grid-template-columns: 1fr auto;
  }

  .design-card {
    flex-basis: 236px;
  }
}

@media (max-width: 760px) {
  .output-dock {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 35;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -14px 35px rgba(10, 9, 8, 0.48);
  }

  .settings-panel {
    padding-bottom: 148px;
  }
}

.design-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.design-shape-btn {
  display: grid;
  place-items: center;
  width: 19px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: #6d675c;
  cursor: pointer;
  transition: color 0.13s ease, background 0.13s ease;
}

.design-shape-btn:hover {
  background: #332e27;
  color: var(--accent-soft);
}

.design-shape-btn svg {
  width: 13px;
  height: 13px;
}

@media (max-width: 760px) {
  .output-dock {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px 10px;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .output-summary {
    min-width: 0;
    margin: 0;
  }

  .output-summary p {
    display: none;
  }

  .output-dock .btn-block {
    width: auto;
    height: 36px;
    padding: 0 14px;
    font-size: 10px;
  }

  .cut-export-link {
    grid-column: 1 / -1;
    height: 18px;
    margin: 0;
  }

  .privacy-line {
    display: none;
  }

  .settings-panel {
    padding-bottom: 90px;
  }
}

.design-card.has-warning {
  border-color: rgba(255, 90, 54, 0.62);
}

.design-card.has-warning .design-name::after {
  margin-left: 5px;
  color: var(--accent);
  content: "!";
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 500;
}

/* ── Cut shape / contour tracer ──────────────────────────────────────── */

.cut-dialog {
  width: min(590px, calc(100vw - 34px));
  padding: 24px 24px 20px;
}

.cut-intro {
  max-width: 390px;
}

.cut-intro strong {
  color: var(--ink-soft);
  font-weight: 500;
}

.cut-shape-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 18px 0 16px;
}

.cut-shape-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  min-height: 82px;
  padding: 10px 10px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-raised);
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, color 0.14s ease;
}

.cut-shape-option:hover {
  border-color: var(--line-strong);
}

.cut-shape-option svg {
  width: 24px;
  height: 24px;
  color: var(--dim);
}

.cut-shape-option > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cut-shape-option strong {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
}

.cut-shape-option small {
  color: var(--dim);
  font-size: 8px;
  line-height: 1.25;
}

.cut-shape-option.is-active {
  border-color: var(--accent);
  background: var(--accent-wash);
  color: var(--accent);
}

.cut-shape-option.is-active svg {
  color: var(--accent);
}

.contour-panel {
  padding-top: 2px;
}

.contour-panel[hidden] {
  display: none;
}

.trace-preview {
  position: relative;
  aspect-ratio: 760 / 438;
  overflow: hidden;
  min-height: 190px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background-color: #f5f1e8;
  background-image:
    linear-gradient(45deg, rgba(30, 26, 20, 0.045) 25%, transparent 25%, transparent 75%, rgba(30, 26, 20, 0.045) 75%),
    linear-gradient(45deg, rgba(30, 26, 20, 0.045) 25%, transparent 25%, transparent 75%, rgba(30, 26, 20, 0.045) 75%);
  background-position: 0 0, 8px 8px;
  background-size: 16px 16px;
}

#traceCanvas {
  display: block;
  width: 100%;
  height: auto;
}

.trace-empty {
  position: absolute;
  top: 50%;
  left: 50%;
  padding: 6px 9px;
  border-radius: 2px;
  background: rgba(255, 253, 248, 0.92);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transform: translate(-50%, -50%);
}

.trace-empty[hidden] {
  display: none;
}

.contour-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 11px;
}

.contour-controls .select-wrap select {
  height: 32px;
  font-size: 9.5px;
}

.trace-range {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.trace-range > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  color: var(--dim);
  font-size: 8.5px;
  line-height: 1.2;
}

.trace-range output {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 8px;
}

.trace-range input[type="range"] {
  width: 100%;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.trace-status {
  margin: 10px 0 0;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 7.5px;
  line-height: 1.45;
}

.trace-status.is-error {
  color: var(--accent);
}

.cut-dialog .dialog-actions {
  margin-top: 17px;
}

@media (max-width: 600px) {
  .cut-dialog {
    padding: 20px 17px 16px;
  }

  .cut-shape-options {
    gap: 4px;
  }

  .cut-shape-option {
    min-height: 78px;
    padding: 8px 7px;
  }

  .cut-shape-option strong {
    font-size: 9.5px;
  }

  .contour-controls {
    grid-template-columns: 1fr 1fr;
  }

  .contour-controls .select-field {
    grid-column: 1 / -1;
  }

  .trace-preview {
    min-height: 160px;
  }
}

.trace-offset,
.trace-bleed {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 8px;
}

.trace-bleed {
  margin-top: 6px;
}

.trace-offset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--dim);
  font-size: 8.5px;
  line-height: 1.2;
}

.trace-number {
  display: flex;
  align-items: center;
  flex: 0 0 76px;
  height: 26px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--panel-raised);
  transition: border-color 0.13s ease;
}

.trace-number:focus-within {
  border-color: var(--accent);
}

.trace-number input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  appearance: textfield;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 8.5px;
  line-height: 1;
  text-align: right;
}

.trace-number input::-webkit-outer-spin-button,
.trace-number input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.trace-number input:focus {
  outline: none;
}

.trace-number em {
  margin-left: 3px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 6.5px;
  font-style: normal;
}

.trace-offset small,
.trace-bleed small {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 6.5px;
  line-height: 1;
  letter-spacing: 0.02em;
}

.trace-offset input[type="range"] {
  width: 100%;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.cut-dialog {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 24px);
  overflow: hidden;
}

.cut-dialog-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.cut-dialog-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.trace-toggles {
  display: flex;
  align-items: center;
  gap: 17px;
  margin-top: 9px;
}

.trace-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.02em;
  cursor: pointer;
  user-select: none;
}

.trace-check input {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.trace-points {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
}

.trace-points .trace-number {
  flex: 0 0 84px;
}

.trace-points .trace-number input:disabled {
  opacity: 0.45;
}

.trace-corners {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.02em;
}

.trace-corners select {
  height: 24px;
  padding: 0 4px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--panel-raised);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 7.5px;
  cursor: pointer;
}

.trace-preview.is-zoomed,
.canvas-area.is-zoomed {
  cursor: grab;
}

.trace-preview.is-panning,
.canvas-area.is-panning {
  cursor: grabbing;
}

.trace-advanced {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.trace-advanced summary {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
}

.trace-advanced-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 9px;
}

.trace-color-field,
.trace-despeckle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.02em;
}

.trace-color-field input[type="color"] {
  width: 46px;
  height: 26px;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--panel-raised);
  cursor: pointer;
}

.trace-despeckle .trace-number {
  flex: 0 0 84px;
}

.trace-edit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
}

.trace-reset {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 7px;
  text-decoration: underline;
  cursor: pointer;
}

.trace-reset[hidden] {
  display: none;
}

.trace-preview.is-node-drag {
  cursor: crosshair;
}

.cut-dialog .dialog-actions {
  position: static;
  flex: 0 0 auto;
  z-index: 2;
  padding-top: 10px;
  margin-top: 12px;
  background: transparent;
  border-top: 1px solid var(--line);
}

.trace-pick {
  height: 26px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--panel-raised);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 6.5px;
  cursor: pointer;
}

.trace-pick.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.trace-preview.is-picking {
  cursor: crosshair;
}

.cut-dialog-scroll:focus,
.cut-dialog-scroll:focus-visible {
  outline: none;
}

.canvas-area,
.cut-dialog-scroll,
.trace-preview {
  scrollbar-width: auto;
  scrollbar-color: var(--accent) transparent;
}

.canvas-area::-webkit-scrollbar,
.cut-dialog-scroll::-webkit-scrollbar,
.trace-preview::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.canvas-area::-webkit-scrollbar-thumb,
.cut-dialog-scroll::-webkit-scrollbar-thumb,
.trace-preview::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 6px;
  background: var(--accent);
  background-clip: padding-box;
}

.canvas-area::-webkit-scrollbar-thumb:hover,
.cut-dialog-scroll::-webkit-scrollbar-thumb:hover,
.trace-preview::-webkit-scrollbar-thumb:hover {
  background: var(--accent-soft);
  background-clip: padding-box;
}

.trace-preview.is-zoomed {
  overflow: auto;
}

.cut-export-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.03em;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.cut-export-inline:hover:not(:disabled) {
  color: var(--accent);
}

.cut-export-inline:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.cut-export-inline svg {
  width: 12px;
  height: 12px;
}

.reg-style-field {
  margin-top: 10px;
}

.reg-style-field.is-disabled {
  opacity: 0.42;
  pointer-events: none;
}

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

.design-name {
  padding: 0;
  border: 0;
  background: transparent;
  font-family: inherit;
  text-align: left;
  cursor: text;
}

.design-name:hover {
  color: var(--accent);
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}

.design-name-input {
  width: 100%;
  min-width: 0;
  padding: 1px 4px;
  border: 1px solid var(--accent);
  border-radius: 2px;
  background: var(--panel);
  color: var(--ink);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.2;
}

.shape-adjust {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-raised);
}

.shape-adjust[hidden] {
  display: none;
}

.shape-adjust .trace-offset-head {
  align-items: center;
}

.shape-adjust small {
  grid-column: 1 / -1;
  color: var(--dim);
  font-size: 8px;
  line-height: 1.4;
}

.dot-distances {
  margin-top: 10px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel-raised);
}

.dot-distances[hidden] {
  display: none;
}

.dot-distances .field-caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.dot-distances .field-caption small {
  color: var(--dim);
  font-size: 7.5px;
  letter-spacing: 0.01em;
  text-transform: none;
}

.dot-distance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 12px;
}

.dot-distance-grid label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
}

.dot-distance-grid .trace-number {
  width: 82px;
}

.bleed-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin-top: 9px;
}

.bleed-options label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
}

.bleed-options .trace-number {
  width: 82px;
}

.bleed-options .select-wrap {
  width: 96px;
}

.cut-dialog {
  width: min(1040px, calc(100vw - 34px));
}

.contour-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.9fr);
  align-items: start;
  gap: 22px;
}

.cut-preview-pane,
.cut-settings-pane,
.trace-settings {
  min-width: 0;
}

.cut-settings-pane {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.trace-settings {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cut-dialog.is-shape-only {
  width: min(680px, calc(100vw - 34px));
}

.contour-panel.is-shape-only {
  grid-template-columns: minmax(0, 1fr);
}

.contour-panel.is-shape-only .cut-preview-pane {
  display: none;
}

.cut-preview-pane .trace-status {
  margin-top: 9px;
}

@media (max-width: 900px) {
  .cut-dialog {
    width: min(590px, calc(100vw - 34px));
  }

  .contour-panel {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
}

.trace-settings[hidden],
.cut-preview-pane[hidden] {
  display: none;
}

.cut-dialog.is-shape-only {
  width: min(780px, calc(100vw - 34px));
}

.shape-adjust .trace-offset-head > span:first-child {
  white-space: nowrap;
}

.bleed-options .select-wrap {
  width: 108px;
}

.stage-copyright {
  flex: none;
  color: #847d71;
  font-size: 7px;
  letter-spacing: 0.02em;
  text-transform: none;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .cut-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    padding: 16px 13px 12px;
  }

  .cut-dialog-scroll {
    padding-right: 4px;
  }

  .contour-panel {
    gap: 12px;
  }

  .trace-preview {
    min-height: 0;
  }

  .contour-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .contour-controls .select-field {
    grid-column: auto;
  }

  .trace-toggles {
    flex-wrap: wrap;
    gap: 9px 14px;
  }

  .bleed-options {
    grid-template-columns: minmax(0, 1fr);
  }

  .cut-dialog .dialog-actions .btn {
    flex: 1 1 0;
  }

  .design-card {
    flex-basis: 82vw;
  }

  .stage-copyright {
    font-size: 6px;
  }
}

.design-edit,
.qty-edit {
  display: grid;
  place-items: center;
  flex: none;
  width: 15px;
  height: 15px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
}

.design-edit:hover,
.qty-edit:hover {
  color: var(--accent);
}

.design-edit svg,
.qty-edit svg {
  width: 11px;
  height: 11px;
}

.trace-bleed input[type="range"] {
  width: 100%;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.save-dialog {
  width: min(430px, calc(100vw - 32px));
}

.save-name-field {
  display: block;
  margin-top: 16px;
}

.save-name-field span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.save-name-field input {
  width: 100%;
  height: 38px;
  padding: 0 10px;
}

.save-dialog .dialog-actions {
  margin-top: 18px;
}

.photo-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 11px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 2mm;
  background: #fdfaf6;
}

.photo-editor[hidden] {
  display: none;
}

.photo-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 650;
}

.photo-reset {
  padding: 0;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 8px;
  cursor: pointer;
}

.photo-reset:hover {
  border-bottom-color: var(--accent);
  color: var(--accent);
}

.photo-upscale {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
}

.photo-upscale input {
  margin-top: 2px;
  accent-color: var(--accent);
}

.photo-upscale strong {
  display: block;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 650;
}

.photo-upscale small {
  display: block;
  margin-top: 2px;
  color: var(--dim);
  font-size: 7.5px;
  line-height: 1.35;
}

.photo-resolution {
  margin: 0;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 7px;
  line-height: 1.4;
}

.photo-resolution.is-low {
  color: var(--accent);
}

.photo-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.photo-tool {
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 2mm;
  background: #ffffff;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 8.5px;
  font-weight: 650;
  cursor: pointer;
}

.photo-tool:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.photo-tool.is-active {
  border-color: var(--accent);
  background: var(--accent-wash);
  color: var(--accent);
}

.photo-tool.is-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.photo-tool.is-primary:hover {
  background: var(--accent-soft);
  color: #ffffff;
}

.crop-controls,
.erase-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 2px;
}

.crop-controls[hidden],
.erase-controls[hidden] {
  display: none;
}

.crop-controls p,
.erase-controls p {
  margin: 0;
  color: var(--dim);
  font-size: 7.5px;
  line-height: 1.4;
}

.photo-tool-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.trace-preview.is-cropping,
.trace-preview.is-erasing {
  cursor: crosshair;
}

.photo-upscale-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.photo-upscale-row strong {
  display: block;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 650;
}

.photo-upscale-row small {
  display: block;
  max-width: 190px;
  margin-top: 2px;
  color: var(--dim);
  font-size: 7.5px;
  line-height: 1.35;
}

.photo-upscale-row select {
  width: 76px;
  height: 28px;
  flex: none;
  padding: 0 22px 0 8px;
  font-size: 8px;
}

.photo-upscale-status {
  margin: 0;
  color: var(--accent);
  font-size: 8px;
  line-height: 1.4;
}

.photo-upscale-status[hidden] {
  display: none;
}

.preview-quality {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 2mm;
  background: #ffffff;
  color: var(--muted);
  font-size: 8px;
  cursor: pointer;
}

.preview-quality input {
  accent-color: var(--accent);
}

.photo-tools {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.clone-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 2px;
}

.clone-controls[hidden] {
  display: none;
}

.clone-controls p {
  margin: 0;
  color: var(--dim);
  font-size: 7.5px;
  line-height: 1.4;
}

.trace-preview.is-cloning {
  cursor: crosshair;
}

.trace-parts {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 2mm;
  background: #fdfaf6;
}

.trace-parts[hidden] {
  display: none;
}

.trace-parts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 8.5px;
}

.trace-parts-head strong {
  color: var(--accent);
  font-size: 8px;
  font-weight: 650;
}

.trace-parts p {
  margin: 0;
  color: var(--dim);
  font-size: 7.5px;
  line-height: 1.4;
}

.trace-part-actions {
  display: grid;
  grid-template-columns: 72px 1fr 1fr;
  gap: 6px;
  align-items: center;
}

.trace-part-actions .photo-tool {
  height: 27px;
  font-size: 8px;
}

.trace-preview.is-parts {
  cursor: pointer;
}

.trace-zoom-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 2mm;
  background: rgba(255, 253, 249, 0.94);
  box-shadow: 0 2px 6px rgba(80, 55, 30, 0.08);
}

.trace-zoom-btn {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border: 0;
  border-radius: 1.5mm;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}

.trace-zoom-btn.is-wide {
  min-width: 32px;
  font-size: 8px;
}

.trace-zoom-btn:hover {
  background: var(--accent-wash);
  color: var(--accent);
}

.trace-zoom-btn.is-active {
  background: var(--accent);
  color: #fff;
}

.trace-zoom-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.trace-zoom-label {
  min-width: 34px;
  color: var(--muted);
  font-size: 7.5px;
  font-weight: 650;
  text-align: center;
}

.trace-preview.is-pan-mode {
  cursor: grab;
}

.trace-preview.is-pan-mode.is-panning {
  cursor: grabbing;
}

.trace-part-history {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.trace-part-history .photo-tool {
  height: 26px;
  font-size: 8px;
}

.trace-part-style {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.trace-part-bleed-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: end;
}

.trace-part-corner select {
  width: 100%;
}

.trace-part-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--muted);
  font-size: 7.5px;
}

.trace-part-field select {
  height: 27px;
  border: 1px solid var(--line);
  border-radius: 1.5mm;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  font-size: 8px;
}

.trace-part-style .photo-tool {
  height: 27px;
  font-size: 7.5px;
  white-space: nowrap;
}

.trace-part-field .trace-number {
  flex: 0 0 auto;
  width: 100%;
  height: 26px;
}

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

.app-version {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 9px;
  border: 1px solid #ffffff;
  border-radius: 4px;
  background: #ffffff;
  color: #151412;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.06em;
}

.trace-value-box {
  display: inline-flex;
  align-items: center;
  width: 58px;
  height: 22px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 1.5mm;
  background: #fff;
}

.trace-value-box input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  appearance: textfield;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 8px;
  text-align: right;
}

.trace-value-box input:focus {
  outline: none;
}

.trace-value-box:focus-within {
  border-color: var(--accent);
}

.trace-value-box input::-webkit-outer-spin-button,
.trace-value-box input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.cut-preview-pane {
  position: relative;
}

.number-field.is-disabled {
  opacity: 0.55;
}

.number-field.is-disabled .number-wrap {
  background: var(--bg-deep);
}

.number-wrap.is-disabled,
.number-wrap input:disabled {
  cursor: not-allowed;
}
