:root {
  --paper: #f7f7f2;
  --surface: #fffefa;
  --ink: #2c3932;
  --muted: #777d73;
  --line: #e3e5da;
  --green: #274d41;
  --green-light: #e8eee5;
  --clay: #b56140;
  --radius: 14px;
  font-family:
    -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  color: inherit;
}
button:disabled {
  cursor: default;
  opacity: 0.48;
}
button,
a {
  touch-action: manipulation;
}
button {
  border: 0;
  background: none;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #bb8249;
  outline-offset: 3px;
}
a {
  color: var(--green);
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2 {
  font-family: "Songti SC", "STSong", "SimSun", Georgia, serif;
  font-weight: 600;
  letter-spacing: 0.025em;
}
h1 {
  font-size: 34px;
  line-height: 1.3;
}
h2 {
  font-size: 25px;
}
h3 {
  font-size: 16px;
  font-weight: 600;
}
p {
  line-height: 1.75;
}
.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  vertical-align: middle;
}
.sidebar {
  width: 224px;
  position: fixed;
  inset: 0 auto 0 0;
  background: #f0f2ea;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 38px 22px 20px;
  z-index: 10;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
  font-family: "Songti SC", serif;
  font-weight: bold;
  font-size: 29px;
  letter-spacing: 4px;
}
.brand small {
  display: block;
  font-family: Arial, sans-serif;
  font-weight: 400;
  font-size: 9px;
  letter-spacing: 1.65px;
  margin-top: 4px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 48px;
  border: 1px solid var(--green);
  border-radius: 50% 50% 46% 46%;
  transform: rotate(-12deg);
}
.brand-mark .icon {
  width: 31px;
  height: 31px;
}
.workspace-label {
  font-size: 12px;
  color: #777e6b;
  margin: 48px 10px 15px;
  letter-spacing: 0.05em;
}
.workspace-label span {
  display: block;
  font-size: 9px;
  letter-spacing: 1.7px;
  margin-top: 6px;
}
.sidebar nav {
  display: grid;
  gap: 9px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 13px 14px;
  font-size: 15px;
  text-align: left;
  border-radius: 8px;
  color: #646f63;
}
.nav-item:hover {
  background: #e6eadd;
}
.nav-item.active {
  background: var(--green);
  color: #fff;
}
.nav-count {
  margin-left: auto;
  font-size: 12px;
  opacity: 0.8;
}
.side-note {
  margin-top: auto;
  padding: 40px 12px;
  color: #76836a;
}
.side-note p {
  font-family: "Songti SC", serif;
  font-size: 22px;
  line-height: 1.65;
  margin-top: 12px;
}
.mini-label {
  font-size: 12px;
  letter-spacing: 0.035em;
  color: var(--muted);
}
.thread-line {
  width: 60px;
  height: 13px;
  margin-top: 20px;
  border-top: 1px solid #8c9b7d;
  border-radius: 50%;
  transform: rotate(-9deg);
}
.sidebar-bottom {
  border-top: 1px solid #dce0d2;
  padding-top: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.sidebar-bottom small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
}
.sidebar-bottom .icon-button {
  margin-left: auto;
  width: 24px;
}
.avatar {
  background: #e2dac7;
  border-radius: 50%;
  width: 33px;
  height: 33px;
  display: grid;
  place-items: center;
  font: italic 16px Georgia;
}
.workspace {
  margin-left: 224px;
  min-height: 100vh;
}
.topbar {
  height: 74px;
  border-bottom: 1px solid var(--line);
  padding: 0 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fbfcf8;
}
.breadcrumb {
  display: flex;
  gap: 14px;
  font-size: 13px;
  color: var(--muted);
}
.breadcrumb strong {
  font-weight: 500;
  color: var(--ink);
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 22px;
}
.local-indicator {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.local-indicator .icon {
  width: 14px;
  height: 14px;
}
main {
  padding: 36px 42px 44px;
  max-width: 1680px;
  margin: auto;
  min-height: calc(100vh - 135px);
}
footer {
  display: flex;
  justify-content: space-between;
  color: #8d9486;
  font-size: 11px;
  padding: 0 42px 22px;
  letter-spacing: 0.04em;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
}
.eyebrow {
  font-family: Arial, sans-serif;
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: 600;
  color: #7e876f;
  margin-bottom: 10px;
}
.page-heading p {
  font-size: 14px;
  color: var(--muted);
  margin-top: 12px;
}
.heading-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 17px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 14px;
  line-height: 1.35;
  transition:
    background 0.18s,
    transform 0.18s;
}
.button:hover {
  transform: translateY(-1px);
}
.button.primary {
  background: var(--green);
  color: #fff;
}
.button.primary:hover {
  background: #376351;
}
.button.secondary {
  border-color: #d6ddcf;
  background: #fbfcf6;
}
.button.secondary:hover {
  background: #eaf0e5;
}
.button.small {
  padding: 8px 12px;
  font-size: 12px;
}
.button.full {
  width: 100%;
  margin-top: 14px;
}
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  color: #7b8575;
}
.icon-button:hover {
  background: var(--green-light);
  color: var(--green);
}
.text-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--green);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0;
}
.text-link .icon {
  width: 17px;
}
.text-button {
  padding: 0;
  text-align: left;
}
.collection-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  gap: 16px;
  margin-bottom: 24px;
}
.tabs {
  display: flex;
  gap: 22px;
}
.tabs button {
  font-size: 14px;
  padding: 12px 0 16px;
  position: relative;
  color: #8b9186;
  white-space: nowrap;
}
.tabs button.selected {
  color: var(--green);
  font-weight: 600;
}
.tabs button.selected:after {
  content: "";
  height: 2px;
  background: var(--green);
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
}
.tabs button span {
  margin-left: 7px;
  font-size: 12px;
  font-weight: 400;
  color: #949c8b;
}
.search {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #939a8b;
  border: 1px solid #e0e4d9;
  border-radius: 7px;
  padding: 7px 10px;
  background: #fbfcf9;
  margin-bottom: 8px;
}
.search .icon {
  width: 16px;
}
.search input {
  font-size: 13px;
  width: 156px;
  background: none;
  border: none;
  outline: none;
  padding: 2px;
}
.empty-collection {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 252px;
  padding: 30px 38px;
  background: #eef0e6;
  border: 1px solid #e0e5d6;
  border-radius: 12px;
}
.empty-collection h2 {
  font-size: 28px;
}
.empty-collection p {
  color: #78816f;
  font-size: 14px;
  margin: 12px 0 22px;
}
.empty-swatch {
  width: 230px;
  position: relative;
  margin: 0 36px 0 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.empty-swatch svg {
  width: 168px;
  height: 168px;
  transform: rotate(-10deg);
  filter: drop-shadow(6px 10px 7px #64754b20);
}
.empty-swatch span {
  margin-top: 16px;
  color: #879277;
  font-size: 12px;
  letter-spacing: 0.1em;
}
.section {
  margin-top: 36px;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.section-heading .eyebrow {
  margin-bottom: 7px;
}
.muted {
  color: var(--muted);
  font-size: 13px;
}
.template-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}
.template-card {
  padding: 0;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
.template-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px #31422b0c;
}
.template-art,
.project-art {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 184px;
  background: var(--art-bg);
  overflow: hidden;
}
.template-art > svg {
  width: 70%;
  height: 78%;
  filter: drop-shadow(3px 6px 3px #4a472311);
}
.template-art.flat > svg {
  transform: rotate(-9deg);
}
.template-art.granny > svg {
  transform: rotate(8deg);
}
.template-art.scarf > svg {
  height: 290px;
  width: 120px;
  transform: rotate(30deg);
  flex-shrink: 0;
}
.art-label {
  position: absolute;
  left: 13px;
  top: 13px;
  background: #fff9;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  color: #58664e;
}
.template-copy {
  padding: 19px 17px 20px;
  position: relative;
}
.template-copy h3 {
  font-family: "Songti SC", serif;
  font-size: 19px;
  margin: 7px 0;
}
.template-copy p {
  font-size: 12px;
  color: var(--muted);
}
.round-arrow {
  position: absolute;
  right: 13px;
  bottom: 17px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
}
.round-arrow .icon {
  width: 14px;
  height: 14px;
}
.bottom-note {
  margin-top: 28px;
  border: 1px dashed #d9dfce;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 17px 20px;
  font-size: 13px;
  color: #7b8670;
}
.bottom-note > .text-link {
  margin-left: auto;
  font-size: 12px;
}
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.project-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}
.project-art {
  height: 210px;
}
.project-art > svg {
  width: 75%;
  height: 88%;
}
.project-art.scarf > svg {
  height: 420px;
  width: 150px;
  transform: rotate(35deg);
}
.status-pill {
  font-size: 11px;
  line-height: 1.4;
  padding: 5px 9px;
  border-radius: 5px;
  display: inline-flex;
  background: #f8f8f0;
  color: #7d806a;
  white-space: nowrap;
}
.status-pill.active {
  color: #406d54;
  background: #e6eee5;
}
.status-pill.completed {
  color: #9a6c39;
  background: #f3e9d8;
}
.project-art .status-pill {
  position: absolute;
  top: 13px;
  left: 13px;
  background: #fff9;
}
.project-copy {
  padding: 16px 20px 20px;
}
.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.project-name {
  font-size: 18px;
  font-family: "Songti SC", serif;
  font-weight: 600;
}
.project-copy p {
  font-size: 12px;
  color: var(--muted);
  margin: 2px 0 17px;
}
.palette-dots {
  display: flex;
  padding-left: 2px;
}
.palette-dots i {
  width: 16px;
  height: 16px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  margin-left: -2px;
  box-shadow: 0 0 0 1px #00000008;
}
.small-text {
  font-size: 12px;
  color: var(--muted);
}
.progress-track {
  background: #e9eee2;
  height: 4px;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 12px;
}
.progress-track i {
  display: block;
  background: #6e8b61;
  height: 100%;
  border-radius: 8px;
  transition: width 0.2s;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}
.tags span {
  color: #929778;
  background: #f3f4ed;
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 11px;
}
.editor-heading {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 28px;
}
.editor-heading h1 {
  font-size: 28px;
}
.editor-heading .eyebrow {
  margin-bottom: 4px;
}
.editor-heading-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}
.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 22px;
}
.editor-main {
  min-width: 0;
}
.canvas-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: 0;
  padding: 5px 22px 0;
  border-radius: 10px 10px 0 0;
}
.canvas-area {
  height: 435px;
  border: 1px solid var(--line);
  border-top: 0;
  background-color: #eeeee5;
  background-image: radial-gradient(#bac1ad6b 0.65px, transparent 0.65px);
  background-size: 14px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 30px;
}
.canvas-area > svg {
  height: 100%;
  width: 100%;
  max-width: 440px;
  filter: drop-shadow(4px 7px 4px #405a2620);
}
.canvas-area.scarf > svg {
  max-width: 100%;
  height: 100%;
}
.canvas-area canvas {
  max-width: none;
  image-rendering: pixelated;
  touch-action: none;
  cursor: crosshair;
  flex-shrink: 0;
}
.canvas-caption {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-size: 11px;
  color: #8e947f;
  padding: 13px 17px;
  background: #f1f3e9;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 10px 10px;
}
.canvas-caption > span:last-child {
  flex-shrink: 0;
}
.pattern-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-top: 24px;
  padding: 23px;
}
.pattern-panel h2 {
  font-size: 22px;
}
.setup-note {
  background: #f2f4eb;
  padding: 13px 15px;
  font-size: 13px;
  line-height: 1.8;
  border-radius: 6px;
  color: #6b765f;
  margin: 15px 0;
}
.pattern-row {
  display: flex;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid #edf0e7;
  padding: 15px 0;
  font-size: 13px;
}
.pattern-row.done {
  opacity: 0.55;
}
.row-check {
  border: 1px solid #d7dfcc;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  font-size: 11px;
  color: #a0aa93;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.row-check:hover,
.done .row-check {
  background: #e3ecdc;
  color: #537446;
}
.row-check .icon {
  width: 16px;
}
.row-number {
  white-space: nowrap;
  color: #79836f;
  font-size: 11px;
  min-width: 43px;
}
.row-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid #0001;
}
.row-description {
  line-height: 1.8;
  flex: 1;
  min-width: 0;
}
.row-description small {
  display: block;
  color: #9b9f91;
  font-size: 11px;
}
.row-total {
  font-size: 11px;
  color: #7f8873;
  white-space: nowrap;
  text-align: right;
}
.row-total small {
  display: block;
  font-size: 10px;
  margin-top: 4px;
}
.editor-aside {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}
.panel h3 {
  font-size: 14px;
  margin-bottom: 14px;
}
.panel-heading h3 {
  margin: 0;
}
.project-colors {
  display: grid;
  gap: 8px;
}
.color-choice {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  text-align: left;
  font-size: 13px;
}
.color-choice.selected {
  border-color: #b7c9a9;
  background: #f2f5ed;
}
.color-choice small {
  display: block;
  font-size: 10px;
  color: #9b9f92;
  margin-top: 4px;
}
.swatch {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 11px;
  border: 1px solid #0000000b;
  flex-shrink: 0;
}
.color-edit {
  margin-left: auto;
  display: grid;
  place-items: center;
  padding: 5px;
  color: #8b967e;
}
.color-edit .icon {
  width: 14px;
  height: 14px;
}
.hint {
  font-size: 12px;
  line-height: 1.7;
  color: #909882;
  margin-top: 11px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: #7b856e;
  margin-bottom: 14px;
}
.field input,
.field select,
.field textarea {
  font-size: 14px;
  color: var(--ink);
  border: 1px solid #dce2d4;
  border-radius: 6px;
  background: #fafbf6;
  padding: 9px 10px;
  width: 100%;
  min-width: 0;
}
.field textarea {
  resize: vertical;
  min-height: 100px;
}
.field-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.counter {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.counter strong {
  font-family: Georgia, serif;
  font-size: 32px;
  font-weight: 400;
}
.counter small {
  font-family: inherit;
  font-size: 13px;
  color: #859076;
  margin-left: 5px;
}
.stitch-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.stitch-chips button {
  font-size: 12px;
  background: #f1f4e9;
  padding: 6px 10px;
  border: 1px solid #e0e6d5;
  border-radius: 5px;
  color: #687a56;
}
.stitch-chips button:hover {
  background: #e5edda;
}
.reference-image {
  width: 100%;
  border-radius: 6px;
}
.size-result {
  font-size: 14px;
  color: var(--green);
  margin-top: 14px;
}
.notice {
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 24px;
  background: #f3efdc;
  line-height: 1.7;
}
.notice.error {
  background: #f7e3dc;
  color: #9a442c;
}
.notice button {
  text-decoration: underline;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px;
  background: var(--surface);
  color: var(--ink);
  width: 480px;
  max-width: calc(100vw - 40px);
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 30px 100px #1c291b38;
}
dialog::backdrop {
  background: #23352261;
  backdrop-filter: blur(3px);
}
dialog h2 {
  font-size: 28px;
  margin: 6px 32px 10px 0;
}
dialog .muted {
  line-height: 1.8;
}
.modal-close {
  position: absolute;
  right: 17px;
  top: 17px;
}
.wide {
  width: 980px;
}
.modal-templates {
  margin-top: 24px;
  gap: 14px;
}
.modal-templates .template-art {
  height: 160px;
}
.modal-templates .template-copy {
  padding: 14px;
}
.modal-templates .template-copy h3 {
  font-size: 17px;
}
.sheet {
  margin: 0 0 0 auto;
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 14px 0 0 14px;
  width: 470px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
}
.modal-form {
  margin-top: 24px;
}
#toast {
  position: fixed;
  bottom: 26px;
  left: calc(50% + 112px);
  transform: translate(-50%, 20px);
  max-width: 550px;
  padding: 13px 22px;
  border-radius: 8px;
  background: #274d41;
  color: white;
  z-index: 1000;
  box-shadow: 0 5px 20px #243a2433;
  font-size: 14px;
  line-height: 1.6;
  opacity: 0;
  transition:
    opacity 0.2s,
    transform 0.2s;
  pointer-events: none;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
@media (min-width: 1500px) {
  .template-art {
    height: 215px;
  }
  .empty-collection {
    min-height: 275px;
  }
  .empty-swatch {
    width: 290px;
  }
  .empty-swatch svg {
    width: 195px;
    height: 195px;
  }
}
@media (max-width: 1150px) {
  .sidebar {
    width: 190px;
    padding-left: 15px;
    padding-right: 15px;
  }
  .workspace {
    margin-left: 190px;
  }
  main {
    padding: 28px;
  }
  .topbar {
    padding: 0 28px;
  }
  .heading-actions {
    gap: 7px;
  }
  .page-heading {
    align-items: flex-start;
  }
  .page-heading p {
    max-width: 350px;
  }
  .button {
    padding: 11px 13px;
  }
  .editor-layout {
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 16px;
  }
  .template-grid {
    gap: 12px;
  }
  .template-copy {
    padding: 15px 13px;
  }
  .template-copy h3 {
    font-size: 17px;
  }
  .round-arrow {
    display: none;
  }
  .editor-aside .panel {
    padding: 16px;
  }
  .tabs {
    gap: 18px;
  }
}
@media (max-width: 900px) {
  .sidebar {
    width: 75px;
    align-items: center;
    padding: 26px 9px;
  }
  .brand > span:last-child,
  .workspace-label,
  .side-note,
  .sidebar-bottom,
  .nav-item .nav-count {
    display: none;
  }
  .brand-mark {
    width: 38px;
    height: 44px;
  }
  .sidebar nav {
    margin-top: 40px;
  }
  .nav-item {
    font-size: 0;
    padding: 14px;
    gap: 0;
  }
  .nav-item .icon {
    width: 23px;
    height: 23px;
  }
  .workspace {
    margin-left: 75px;
  }
  .template-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .page-heading {
    flex-wrap: wrap;
  }
  .editor-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .editor-aside {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #toast {
    left: calc(50% + 37px);
  }
  .empty-swatch {
    margin-right: 0;
  }
  .editor-heading-actions {
    gap: 5px;
  }
  .local-indicator {
    display: none;
  }
}
@media (max-width: 600px) {
  .sidebar {
    width: 56px;
    padding: 20px 4px;
  }
  .brand-mark {
    width: 31px;
    height: 36px;
  }
  .brand-mark .icon {
    width: 22px;
  }
  .nav-item {
    padding: 12px 8px;
  }
  .workspace {
    margin-left: 56px;
  }
  main {
    padding: 22px 16px;
  }
  .topbar {
    padding: 0 16px;
    height: 60px;
  }
  .top-actions .button {
    font-size: 0;
    padding: 7px;
    gap: 0;
  }
  .breadcrumb {
    font-size: 12px;
  }
  .page-heading {
    margin-bottom: 20px;
  }
  h1 {
    font-size: 28px;
  }
  .heading-actions {
    width: 100%;
  }
  .heading-actions .button {
    flex: 1;
    font-size: 12px;
  }
  .collection-toolbar {
    flex-wrap: wrap;
    gap: 0;
  }
  .tabs {
    gap: 14px;
  }
  .tabs button {
    font-size: 12px;
  }
  .search {
    width: 100%;
    margin: 5px 0 12px;
  }
  .search input {
    width: 100%;
  }
  .empty-collection {
    padding: 25px 20px;
    min-height: 0;
  }
  .empty-collection h2 {
    font-size: 24px;
  }
  .empty-swatch {
    display: none;
  }
  .empty-collection p {
    font-size: 13px;
  }
  .template-grid,
  .project-grid {
    gap: 10px;
  }
  .template-art {
    height: 135px;
  }
  .template-copy h3 {
    font-size: 17px;
  }
  .template-copy {
    padding: 12px 10px;
  }
  .template-copy p {
    font-size: 10px;
  }
  .section-heading {
    align-items: flex-end;
  }
  .section-heading .muted {
    font-size: 10px;
  }
  .section-heading h2 {
    font-size: 22px;
  }
  .project-art {
    height: 155px;
  }
  .project-copy {
    padding: 12px;
  }
  .project-name {
    font-size: 16px;
  }
  .bottom-note {
    align-items: flex-start;
    font-size: 12px;
    padding: 14px;
    flex-wrap: wrap;
  }
  .bottom-note > .text-link {
    margin-left: 0;
  }
  .editor-heading {
    gap: 8px;
    flex-wrap: wrap;
  }
  .editor-heading h1 {
    font-size: 24px;
  }
  .editor-heading-actions {
    margin-left: 42px;
  }
  .editor-aside {
    grid-template-columns: 1fr;
  }
  .canvas-toolbar {
    padding: 0 14px;
  }
  .canvas-toolbar > .small-text {
    font-size: 10px;
  }
  .canvas-area {
    height: 340px;
    padding: 18px;
  }
  .pattern-panel {
    padding: 15px;
  }
  .pattern-row {
    gap: 6px;
  }
  .row-number {
    display: none;
  }
  .row-description {
    font-size: 12px;
  }
  .row-total {
    font-size: 10px;
  }
  .canvas-caption {
    font-size: 10px;
  }
  .modal-templates .template-art {
    height: 125px;
  }
  .modal-templates .template-copy h3 {
    font-size: 16px;
  }
  dialog {
    padding: 24px 20px;
  }
  .project-copy .card-row .icon-button {
    width: 22px;
  }
  footer {
    padding: 0 16px 20px;
    font-size: 9px;
    gap: 12px;
  }
  #toast {
    left: calc(50% + 28px);
    width: calc(100vw - 100px);
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
.progress-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 25px 30px;
  background: var(--surface);
  margin-bottom: 30px;
}
.progress-overview > div {
  border-right: 1px solid var(--line);
  padding-left: 10px;
}
.progress-overview > div:last-child {
  border: 0;
}
.progress-overview span {
  font-size: 13px;
  color: var(--muted);
}
.progress-overview strong {
  display: block;
  font: 34px Georgia;
  margin-top: 12px;
}
.progress-overview small {
  font: 12px sans-serif;
  color: #89937b;
  margin-left: 12px;
}
.kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.kanban-column {
  background: #eef1e8;
  border: 1px solid #e4e8dc;
  border-radius: 10px;
  padding: 18px;
  min-width: 0;
}
.lane-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.lane-heading h2 {
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
}
.lane-heading > span {
  font-size: 12px;
  color: #8b967c;
}
.lane-empty {
  padding: 50px 12px;
  font-size: 13px;
  text-align: center;
  color: #929b85;
  border: 1px dashed #d6dfcb;
  border-radius: 8px;
  line-height: 1.8;
}
.progress-card {
  background: var(--surface);
  border: 1px solid #dde3d3;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
.progress-card:last-child {
  margin-bottom: 0;
}
.progress-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 135px;
  width: 100%;
  overflow: hidden;
  background: #f4f3e9;
  border-radius: 5px;
  margin-bottom: 15px;
}
.progress-thumb > svg {
  height: 125px;
  width: 150px;
}
.progress-thumb.scarf > svg {
  height: 300px;
  transform: rotate(35deg);
}
.progress-card .project-name {
  font-size: 17px;
}
.progress-card .small-text {
  margin: 8px 0;
}
.palette-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 26px 32px;
  border-radius: 12px;
  background: #edeedc;
  margin: 0 0 30px;
}
.palette-summary h2 {
  font-size: 27px;
}
.palette-summary p {
  font-size: 13px;
  color: #8a8b6b;
  margin-top: 12px;
}
.palette-ribbon {
  display: flex;
  height: 96px;
  padding-right: 10px;
  flex-shrink: 0;
}
.palette-ribbon i {
  width: 30px;
  height: 96px;
  border-radius: 18px;
  margin-left: -4px;
  border: 1px solid #fff5;
  transform: rotate(17deg);
  box-shadow: 2px 2px 5px #29392110;
}
.color-library {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
}
.library-card {
  padding: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  transition: transform 0.15s;
}
.library-card:hover {
  transform: translateY(-2px);
}
.library-card > span {
  width: 68px;
  align-self: stretch;
  min-height: 80px;
  border-right: 1px solid #00000008;
  flex-shrink: 0;
}
.library-card > div {
  padding: 12px;
  min-width: 0;
}
.library-card strong {
  font-weight: 500;
  font-size: 14px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.library-card small {
  display: block;
  font-size: 10px;
  color: #939982;
  margin-top: 7px;
}
.merchant-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.merchant-color {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
}
.merchant-color:hover {
  border-color: #a8bc9a;
}
.merchant-color > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.merchant-color strong {
  font-size: 12px;
  font-weight: 500;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.merchant-color small {
  font-size: 10px;
  color: #939c85;
  display: block;
  margin-top: 4px;
}
.merchant-color > .icon {
  width: 14px;
  color: #95a284;
}
.merchant-swatch {
  display: grid;
  place-items: center;
  height: 32px;
  width: 32px;
  border-radius: 50%;
  flex-shrink: 0;
}
.merchant-swatch.unknown {
  background: repeating-linear-gradient(
    45deg,
    #eeeee4,
    #eeeee4 3px,
    #f6f7f0 3px,
    #f6f7f0 6px
  );
  color: #a3ad94;
  font-size: 12px;
}
.stitch-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.stitch-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 26px;
  text-align: left;
  position: relative;
  transition:
    border-color 0.2s,
    transform 0.2s;
}
.stitch-card:hover {
  border-color: #a8b99b;
  transform: translateY(-3px);
}
.stitch-symbol {
  color: #648357;
  width: 66px;
  height: 66px;
  background: #eef2e5;
  border-radius: 16px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
}
.stitch-symbol svg {
  width: 49px;
  height: 49px;
}
.stitch-card h3 {
  font:
    600 21px "Songti SC",
    serif;
  margin: 9px 0;
}
.stitch-code {
  font-size: 12px;
  color: #a1a58d;
}
.stitch-card p {
  font-size: 14px;
  color: #7c8671;
  line-height: 1.8;
  margin-top: 16px;
}
.stitch-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  font-size: 12px;
  color: #687e59;
}
.favorite-mark {
  position: absolute;
  right: 20px;
  top: 23px;
  color: #af965c;
}
.favorite-mark .icon {
  width: 17px;
  height: 17px;
}
.detail-symbol {
  color: #5e7a50;
  background: #eef2e3;
  width: 105px;
  height: 105px;
  border-radius: 20px;
  padding: 14px;
  margin: 28px 0 22px;
}
.detail-symbol svg {
  width: 100%;
}
.detail-code {
  font-size: 13px;
  color: #92a17f;
  margin-top: 16px;
}
.detail-code > span {
  margin-left: 20px;
  border-left: 1px solid #d7dfca;
  padding-left: 20px;
}
.detail-summary {
  font-size: 15px;
  margin: 24px 0 28px;
  color: #6e7e60;
}
.steps {
  padding: 0;
  list-style: none;
  counter-reset: steps;
  margin: 20px 0 30px;
}
.steps li {
  counter-increment: steps;
  position: relative;
  padding-left: 40px;
  font-size: 15px;
  line-height: 1.9;
  margin: 16px 0;
}
.steps li:before {
  content: counter(steps, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 4px;
  color: #9ba88c;
  font: 15px Georgia;
}
.stitch-math {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #94a282;
  margin-bottom: 24px;
}
.stitch-math strong {
  color: #678252;
  font-size: 14px;
  font-weight: 500;
}
.tip-box {
  background: #f2f2e5;
  border-radius: 8px;
  padding: 20px;
}
.tip-box h3 {
  font-size: 14px;
}
.tip-box ul {
  padding-left: 18px;
  margin: 14px 0 0;
}
.tip-box li {
  font-size: 13px;
  line-height: 1.9;
  color: #7f866f;
  margin-top: 8px;
}
.detail-code + .detail-summary {
  margin-top: 18px;
}
.picker-library {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
  max-height: 150px;
  overflow: auto;
}
.picker-library button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #dee4d6;
}
.picker-library button:hover {
  box-shadow: 0 0 0 2px var(--green);
}
input[type="color"] {
  height: 40px;
  padding: 4px;
}
.check-label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13px;
  line-height: 1.6;
  color: #78866a;
}
.check-label input {
  accent-color: var(--green);
  margin-top: 4px;
}
.drop-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 30px 20px;
  background: #eff3e8;
  border: 1px dashed #b6c7a4;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 22px;
}
.drop-zone > .icon {
  width: 30px;
  height: 30px;
  color: #789763;
}
.drop-zone strong {
  font-size: 15px;
  font-weight: 500;
}
.drop-zone span {
  font-size: 11px;
  color: #93a17f;
}
.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.drop-zone:focus-within {
  outline: 3px solid #b78a59;
  outline-offset: 3px;
}
#image-info {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 12px;
  color: #899979;
  line-height: 1.8;
  margin-bottom: 20px;
  word-break: break-word;
}
#image-info:empty {
  display: none;
}
#image-info img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 6px;
  background: #eee;
}
.form-error {
  font-size: 13px;
  color: #b35537;
  line-height: 1.7;
  margin-top: 12px;
}
.export-options {
  margin: 26px 0;
}
.export-options .button {
  justify-content: flex-start;
}
.canvas-area.grid-mode {
  display: block;
  text-align: center;
  padding: 20px;
}
.empty-inline {
  grid-column: 1/-1;
  text-align: center;
  padding: 70px;
  color: #8f9b80;
}
.field[hidden],
[hidden] {
  display: none !important;
}
.pattern-notes {
  font-size: 12px;
  color: #8c957e;
  line-height: 1.8;
  padding: 0 2px;
  margin-top: 14px;
}
.canvas-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}
.legend-line {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 11px;
  color: #849477;
  margin-top: 16px;
}
.legend-line span {
  border-radius: 4px;
  padding: 4px 7px;
  background: #eef3e6;
}
.button.danger {
  border-color: #e5c8bb;
  color: #a35940;
  background: #fff9f4;
}
#print-area {
  display: none;
}
@media (max-width: 1150px) {
  .color-library,
  .merchant-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .kanban {
    gap: 14px;
  }
  .kanban-column {
    padding: 13px;
  }
  .stitch-grid {
    gap: 14px;
  }
  .stitch-card {
    padding: 20px;
  }
  .palette-ribbon i {
    width: 23px;
  }
}
@media (max-width: 800px) {
  .kanban {
    grid-template-columns: 1fr;
  }
  .progress-thumb {
    height: 170px;
  }
  .progress-thumb > svg {
    height: 155px;
  }
  .stitch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .color-library,
  .merchant-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .palette-summary {
    padding: 24px;
  }
  .palette-ribbon {
    display: none;
  }
  .progress-overview {
    padding: 20px;
    gap: 10px;
  }
  .progress-overview small {
    display: block;
    margin: 5px 0 0;
  }
  .stitch-card p {
    font-size: 13px;
  }
  .stitch-card h3 {
    font-size: 19px;
  }
}
@media (max-width: 500px) {
  .stitch-grid {
    grid-template-columns: 1fr;
  }
  .color-library {
    gap: 10px;
  }
  .library-card {
    display: block;
  }
  .library-card > span {
    display: block;
    width: 100%;
    height: 60px;
    min-height: 60px;
  }
  .merchant-grid {
    grid-template-columns: 1fr;
  }
  .progress-overview {
    padding: 15px;
  }
  .progress-overview strong {
    font-size: 29px;
  }
  .palette-summary h2 {
    font-size: 24px;
  }
  .sheet {
    width: calc(100vw - 15px);
  }
  .merchant-section .section-heading {
    flex-wrap: wrap;
    gap: 15px;
  }
}
@media print {
  body {
    background: white;
    color: black;
  }
  #app,
  #modal,
  #toast {
    display: none !important;
  }
  #print-area {
    display: block;
    padding: 20px;
  }
  #print-area h1 {
    font-size: 26px;
    margin-bottom: 12px;
  }
  #print-area p {
    font-size: 12px;
  }
  #print-area pre {
    font-family: inherit;
    white-space: pre-wrap;
    font-size: 12px;
    line-height: 1.8;
  }
  #print-area .print-chart {
    max-width: 620px;
    max-height: 800px;
    margin: 20px 0;
    overflow: hidden;
  }
  #print-area svg {
    max-width: 100%;
    max-height: 780px;
  }
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
.row-dot {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  font-size: 9px;
}
.canvas-area.grid-mode {
  overflow: auto;
}
.side-note p {
  font-size: 20px;
  letter-spacing: 0;
}
.stitch-symbol svg {
  overflow: visible;
}
.merchant-color {
  display: block;
  overflow: hidden;
  padding: 0;
}
.merchant-color > img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  background: white;
}
.merchant-card-copy {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
}
.merchant-card-copy > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.merchant-card-copy > .icon {
  width: 15px;
  color: #95a284;
}
.merchant-card-copy .merchant-swatch {
  width: 24px;
  height: 24px;
}
.merchant-detail {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 18px 0;
}
.merchant-detail img {
  width: 170px;
  border-radius: 8px;
}
.merchant-detail p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.9;
}
.merchant-picker {
  display: flex;
  align-items: end;
  gap: 10px;
  margin: 22px 0;
}
.merchant-picker .field {
  flex: 1;
  min-width: 0;
  margin: 0;
}
.merchant-picker .button {
  white-space: nowrap;
}
.merchant-picker select {
  width: 100%;
}
@media (max-width: 500px) {
  .merchant-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .merchant-card-copy {
    padding: 10px;
    gap: 5px;
  }
  .merchant-card-copy .merchant-swatch {
    width: 15px;
    height: 15px;
  }
  .merchant-card-copy > .icon {
    display: none;
  }
  .merchant-color strong {
    font-size: 11px;
  }
  .merchant-detail {
    display: block;
  }
  .merchant-detail img {
    width: 200px;
    max-width: 100%;
  }
  .merchant-picker {
    flex-wrap: wrap;
  }
}
@media print {
  #print-area .print-chart {
    max-height: none;
    overflow: visible;
  }
  #print-area svg {
    display: block;
    width: 100%;
    height: auto;
    max-height: none;
  }
  #print-area .print-chart {
    break-after: page;
  }
  #print-area pre {
    overflow: visible;
  }
}

@media print {
  #print-area .print-chart svg {
    height: 680px;
    width: 100%;
    max-height: 680px;
  }
  #print-area .print-chart {
    break-inside: avoid;
  }
}
/* v0.2: one surface for yarn appearance and the pattern it belongs to. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.scheme-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: #edf1e5;
  border: 1px solid #dfe5d5;
  border-radius: 10px;
  padding: 14px 18px;
  margin: 20px 0;
}
.scheme-identity {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}
.scheme-symbol {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #dde5ce;
  color: #6c8258;
  flex-shrink: 0;
}
.scheme-identity strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
}
.scheme-identity small {
  display: block;
  font-size: 11px;
  color: #8b967e;
  margin-top: 5px;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scheme-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.scheme-actions select {
  max-width: 210px;
  font: 12px inherit;
  background: #f8faf3;
  border: 1px solid #d8e1ce;
  border-radius: 6px;
  padding: 8px;
  color: #6c7d5c;
}
.scheme-actions .button {
  white-space: nowrap;
}
.workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}
.appearance-panel,
.linked-chart-panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.workbench-toolbar {
  height: 77px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 18px;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}
.workbench-toolbar .eyebrow {
  font-size: 8px;
  letter-spacing: 1.7px;
  margin-bottom: 5px;
}
.workbench-toolbar h2 {
  font-size: 20px;
}
.view-switch {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius: 6px;
  background: #eff2e7;
  flex-shrink: 0;
}
.view-switch button {
  padding: 7px 10px;
  border-radius: 4px;
  font-size: 11px;
  color: #89967c;
  white-space: nowrap;
}
.view-switch button.selected {
  background: var(--surface);
  color: #41614b;
  box-shadow: 0 1px 3px #34483316;
}
.yarn-stage {
  height: 455px;
  position: relative;
  overflow: hidden;
  background: #eeeee6;
  touch-action: none;
}
.yarn-stage canvas,
.comparison-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  cursor: grab;
}
.yarn-stage canvas:active,
.comparison-stage canvas:active {
  cursor: grabbing;
}
.structure-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  background: #eef0e6;
}
.structure-stage > svg {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 480px;
  filter: drop-shadow(3px 7px 6px #414a2520);
}
.structure-stage [data-preview-unit] {
  cursor: pointer;
}
.preview-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #8b997e;
  font-size: 12px;
}
.loading-thread {
  width: 20px;
  height: 20px;
  border: 2px solid #c2cfb7;
  border-top-color: #537457;
  border-radius: 50%;
  animation: thread-turn 1.2s linear infinite;
}
@keyframes thread-turn {
  to {
    transform: rotate(360deg);
  }
}
.preview-controls {
  height: 47px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 15px;
  background: #f6f7ef;
  border-top: 1px solid #e2e7d9;
  gap: 8px;
}
.preview-controls > div {
  display: flex;
  gap: 6px;
}
.preview-controls button {
  font-size: 11px;
  color: #6b805c;
  border: 1px solid #dce3d2;
  border-radius: 5px;
  padding: 5px 8px;
  background: #fbfcf7;
}
.preview-controls button:hover {
  background: #e7eddf;
}
.preview-controls > span {
  font-size: 11px;
  color: #8c997f;
}
.preview-caption {
  min-height: 45px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 10px 15px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  color: #8d967f;
}
.preview-caption > span:last-child {
  flex-shrink: 0;
}
.unit-navigation {
  height: 55px;
  background: #f5f5ec;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 13px;
  border-bottom: 1px solid #e5e7db;
}
.unit-navigation strong {
  font-size: 12px;
  font-weight: 500;
  color: #8d652f;
}
.unit-navigation div {
  display: flex;
  gap: 14px;
  align-items: center;
}
.unit-navigation span {
  font-size: 10px;
  color: #969d88;
}
.unit-navigation .icon-button {
  font-size: 25px;
}
.linked-grid-surface {
  height: 405px;
  overflow: auto;
  background: #f7f8f1;
  text-align: center;
  padding: 15px 8px;
  scrollbar-width: thin;
  scrollbar-color: #b9c6a7 transparent;
}
.linked-grid-surface canvas {
  display: inline-block;
  max-width: none;
  touch-action: none;
  vertical-align: top;
}
.grid-mode-toolbar {
  height: 43px;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  padding: 4px 14px;
  background: #fbfcf7;
  border-bottom: 1px solid #e7e9de;
}
.grid-mode-toolbar .view-switch {
  padding: 2px;
}
.grid-mode-toolbar .view-switch button {
  padding: 4px 8px;
  font-size: 10px;
}
.grid-mode-toolbar > span {
  font-size: 10px;
  color: #88967b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.linked-instructions {
  height: 448px;
  overflow: auto;
  padding: 0 17px;
  scrollbar-width: thin;
  scrollbar-color: #b9c6a7 transparent;
}
.linked-instructions .pattern-row {
  padding: 14px 8px;
  margin: 0 -7px;
  gap: 8px;
  border-radius: 5px;
}
.linked-instructions .row-description {
  text-align: left;
  color: inherit;
  font-size: 12px;
}
.linked-instructions .row-number {
  font-size: 10px;
  min-width: 39px;
}
.linked-instructions .row-total {
  font-size: 10px;
}
.linked-instructions .row-description small {
  font-size: 10px;
}
.pattern-row.is-selected {
  background: #f1e8d5;
  box-shadow: inset 3px 0 #b98c4c;
}
.pattern-row.done.is-selected {
  opacity: 1;
}
.foundation-details {
  font-size: 11px;
  color: #8c987b;
  border-bottom: 1px solid #e9ecdf;
  padding: 13px 3px;
  line-height: 1.8;
}
.foundation-details summary {
  cursor: pointer;
  color: #788c64;
}
.foundation-details p {
  margin-top: 8px;
}
.chart-footer {
  height: 45px;
  padding: 10px 15px;
  font-size: 10px;
  color: #829373;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.chart-footer > span {
  color: #9aa18c;
}
.workspace-settings-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 32px 0 15px;
}
.workspace-settings-heading h2 {
  font-size: 24px;
}
.workspace-settings-heading span {
  font-size: 11px;
  color: #8d987f;
}
.editor-aside.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.settings-grid .panel {
  height: 100%;
}
.legend-line span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.legend-line i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid #0001;
}
.comparison-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin: 20px 0;
}
.comparison-tools .field {
  margin: 0;
  min-width: 220px;
}
.comparison-status {
  font-size: 12px;
  color: #638258;
  padding: 9px 13px;
  background: #edf3e5;
  border-radius: 6px;
}
.comparison-status.changed {
  background: #f7edda;
  color: #a47b3e;
}
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.comparison-card {
  background: #f7f8f1;
  border: 1px solid #e2e7d9;
  border-radius: 9px;
  overflow: hidden;
}
.comparison-card h3 {
  font-size: 17px;
  padding: 18px 17px 0;
}
.comparison-card > p {
  font-size: 11px;
  color: #8a977d;
  padding: 6px 17px 16px;
}
.comparison-stage {
  height: 310px;
  position: relative;
  overflow: hidden;
  background: #eeeee6;
  touch-action: none;
}
.comparison-palette {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  padding: 15px;
}
.comparison-palette span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: #7c896f;
}
.comparison-palette i {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid #0001;
}
@media (min-width: 1500px) {
  .yarn-stage {
    height: 520px;
  }
  .linked-grid-surface {
    height: 470px;
  }
  .linked-instructions {
    height: 513px;
  }
}
@media (max-width: 1150px) {
  .scheme-strip {
    align-items: flex-start;
  }
  .scheme-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .scheme-actions select {
    max-width: 160px;
  }
  .workbench-grid {
    gap: 13px;
  }
  .workbench-toolbar {
    padding: 12px;
  }
  .workbench-toolbar h2 {
    font-size: 18px;
  }
  .view-switch button {
    padding: 6px 8px;
    font-size: 10px;
  }
  .unit-navigation div {
    gap: 8px;
  }
  .unit-navigation span {
    max-width: 160px;
  }
  .preview-caption {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
    height: 50px;
    padding: 9px 12px;
  }
  .chart-footer {
    height: 50px;
    flex-wrap: wrap;
    gap: 3px;
  }
  .editor-aside.settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 750px) {
  .workbench-grid {
    grid-template-columns: 1fr;
  }
  .yarn-stage {
    height: 380px;
  }
  .linked-grid-surface {
    height: 365px;
  }
  .linked-instructions {
    height: 408px;
  }
  .scheme-strip {
    flex-direction: column;
    gap: 12px;
    padding: 13px;
  }
  .scheme-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .scheme-actions select {
    flex: 1;
    max-width: 100%;
  }
  .scheme-actions .button {
    font-size: 11px;
  }
  .preview-caption {
    flex-direction: row;
    align-items: center;
    height: 45px;
  }
  .chart-footer {
    height: 45px;
  }
  .editor-heading-actions {
    margin-left: 0;
  }
  .comparison-grid {
    grid-template-columns: 1fr;
  }
  .comparison-tools {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }
  .comparison-stage {
    height: 330px;
  }
}
@media (max-width: 500px) {
  .editor-aside.settings-grid {
    grid-template-columns: 1fr;
  }
  .workspace-settings-heading {
    align-items: start;
    flex-direction: column;
    gap: 8px;
  }
  .workspace-settings-heading h2 {
    font-size: 22px;
  }
  .yarn-stage {
    height: 320px;
  }
  .preview-caption {
    flex-direction: column;
    align-items: flex-start;
    height: auto;
    min-height: 45px;
  }
  .unit-navigation span {
    max-width: 145px;
    font-size: 9px;
  }
  .linked-instructions {
    padding: 0 12px;
  }
  .linked-instructions .row-number {
    display: none;
  }
  .linked-instructions .row-dot {
    width: 16px;
    height: 16px;
  }
  .linked-instructions .row-description {
    font-size: 11px;
  }
  .scheme-actions .button {
    flex: 1;
    justify-content: center;
  }
  .scheme-actions select {
    width: 100%;
    flex-basis: 100%;
  }
  .grid-mode-toolbar > span {
    max-width: 100px;
  }
  .comparison-card h3 {
    font-size: 16px;
  }
}

/* A measured, explicit worksheet for fitting an existing pattern section. */
.fitting-intro {
  display: flex;
  gap: 20px;
  padding: 25px 28px;
  background: #edf0e5;
  border: 1px solid #dfe4d5;
  border-radius: 12px;
  margin: 0 0 28px;
  align-items: center;
}
.fitting-intro p {
  font-size: 13px;
  line-height: 1.9;
  color: var(--muted);
  margin: 6px 0 0;
}
.fitting-measure-mark {
  font-size: 40px;
  color: #84936b;
  border: 1px dashed #a5af96;
  padding: 3px 20px;
  border-radius: 8px;
}
.fitting-saved {
  max-width: 450px;
  margin-bottom: 22px;
}
.fitting-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
  gap: 26px;
  align-items: start;
}
.fitting-section,
.fitting-result {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffefa;
  padding: 26px;
}
.fitting-section {
  margin-bottom: 18px;
}
.fitting-section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.fitting-section-title > span {
  font: italic 22px Georgia;
  color: #9b855d;
}
.fitting-section-title h2 {
  font-size: 19px;
  margin: 0;
}
.fitting-form .field {
  margin-bottom: 16px;
}
.fitting-form .field-pair {
  gap: 16px;
}
.fitting-form textarea {
  min-height: 126px;
  resize: vertical;
}
.fitting-form .check-label {
  align-items: flex-start;
  font-size: 12px;
  line-height: 1.8;
  margin-top: 20px;
}
.fitting-result {
  position: sticky;
  top: 22px;
  padding: 28px;
  line-height: 1.9;
}
.fitting-result h2 {
  font-size: 23px;
  margin: 10px 0;
}
.fitting-result p,
.fitting-result li {
  font-size: 13px;
}
.fitting-empty-mark {
  text-align: center;
  color: #9da888;
  font: 50px Georgia;
  line-height: 1.2;
  padding: 32px;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 19px,
    #b0ba9825 20px
  );
  margin: 25px 0;
}
.fitting-metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
  margin: 28px 0;
}
.fitting-metrics > div {
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}
.fitting-metrics span,
.fitting-metrics strong,
.fitting-metrics small {
  display: block;
}
.fitting-metrics span {
  font-size: 12px;
  color: var(--muted);
}
.fitting-metrics strong {
  font: 30px Georgia;
  margin: 6px 0;
}
.fitting-metrics strong small {
  display: inline;
  font-size: 18px;
  color: #959a84;
}
.fitting-metrics small {
  color: var(--muted);
  font-size: 11px;
}
.fitting-dimensions {
  padding: 18px;
  background: #f1f2e8;
  border-radius: 8px;
  margin-bottom: 22px;
}
.fitting-dimensions span {
  display: block;
  font-size: 12px;
}
.fitting-dimensions strong {
  display: block;
  font: 26px Georgia;
  margin: 8px 0;
}
.fitting-dimensions strong small {
  font-size: 13px;
}
.fitting-dimensions p {
  margin-bottom: 0;
  font-size: 12px;
}
.fitting-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}
.fitting-result .notice p {
  margin-bottom: 0;
}
.fitting-result .button {
  margin-top: 20px;
}
@media (max-width: 1000px) {
  .fitting-workbench {
    grid-template-columns: minmax(0, 1fr);
  }
  .fitting-result {
    position: static;
  }
}
@media (max-width: 500px) {
  .fitting-section,
  .fitting-result {
    padding: 20px;
  }
  .fitting-intro {
    padding: 20px;
  }
  .fitting-measure-mark {
    display: none;
  }
  .fitting-form .field-pair {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

/* Task-focused editing: primary work stays visible, tools open on demand. */
[hidden] {
  display: none !important;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.editor-taskbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 13px 0 20px;
}
.quick-palette,
.editor-tool-tabs,
.paint-palette {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.quick-color {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}
.quick-color i,
.paint-palette i {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--swatch);
  border: 1px solid #0002;
  display: inline-block;
}
.quick-color:hover {
  background: #e9eddf;
  border-radius: 8px;
}
.editor-tool-tabs {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px;
  background: #f9faf5;
}
.editor-tool-tabs button {
  border: 0;
  background: transparent;
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 14px;
  color: #596650;
}
.editor-tool-tabs button.selected {
  background: #dde6d3;
  color: #28472e;
}
.editor-tool-panel {
  border: 1px solid var(--line);
  padding: 22px;
  background: #fafbf7;
  border-radius: 14px;
  margin: 0 0 20px;
}
.editor-tool-panel .scheme-strip {
  background: none;
  margin: 0 0 16px;
  padding: 0 0 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}
.editor-tool-panel h2 {
  font-size: 20px;
  margin: 0 0 10px;
}
.tool-heading p {
  margin: 4px 0 16px;
  color: var(--muted);
  font-size: 14px;
}
.parameter-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.parameter-fields .field {
  margin: 0 0 14px;
}
.notes-layout {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
}
.notes-layout .reference-image {
  max-width: 180px;
  max-height: 180px;
  object-fit: contain;
}
.tool-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  flex-wrap: wrap;
}
.project-note {
  white-space: pre-wrap;
  font-size: 14px;
}
.color-names {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.color-name {
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  background: white;
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink);
}
.color-name i {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid #0001;
}
.color-name span {
  color: var(--muted);
  font-size: 13px;
}
.editor-progress {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  margin: 0 0 18px;
  border: 1px solid #ccd7bf;
  border-radius: 12px;
  background: #edf2e5;
}
.editor-progress > div:first-child {
  display: flex;
  gap: 14px;
  align-items: center;
}
.editor-progress strong {
  font-size: 24px;
  color: #344c2c;
  white-space: nowrap;
}
.editor-progress strong small {
  font-size: 14px;
  font-weight: 400;
}
.editor-progress .progress-track {
  flex: 1;
  max-width: none;
  margin: 0 12px 0 0;
  min-width: 50px;
}
.editor-progress .mini-label {
  font-size: 14px;
}
.paint-palette {
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: #f7f9f2;
}
.paint-palette button {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 4px 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 14px;
}
.paint-palette button.selected {
  border-color: #516740;
  background: #e4ecda;
}
.advanced-fields {
  padding: 15px 0;
  margin: 5px 0 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.advanced-fields summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #43553a;
}
.advanced-fields summary span {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  margin-left: 8px;
}
.advanced-fields[open] summary {
  margin-bottom: 16px;
}
.advanced-fields .field-pair {
  margin-top: 10px;
}
.fitting-flow {
  max-width: 900px;
  margin: 10px auto 0;
}
.fitting-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
.fitting-steps button {
  padding: 18px 12px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  font-size: 16px;
  color: #7b8273;
}
.fitting-steps button span {
  display: inline-block;
  margin-right: 12px;
  font-family: Georgia, serif;
  font-size: 20px;
}
.fitting-steps [aria-current="step"] {
  border-bottom-color: #53673f;
  color: #314a2a;
  font-weight: 600;
}
.fitting-focused {
  display: block;
  border: 1px solid var(--line);
  padding: 30px 36px;
  background: #fffefb;
  border-radius: 14px;
}
.fitting-step-heading {
  margin-bottom: 24px;
}
.fitting-focused h2 {
  font-size: 21px;
  margin: 8px 0 18px;
}
.fitting-focused .field {
  font-size: 14px;
}
.fitting-focused .field input,
.fitting-focused .field select,
.fitting-focused textarea {
  font-size: 16px;
}
.fitting-focused .check-label {
  line-height: 1.7;
  font-size: 14px;
  align-items: start;
}
.fitting-focused .check-label input {
  margin-top: 5px;
  flex-shrink: 0;
}
.fitting-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}
.fitting-scope {
  color: #707b66;
  font-size: 14px;
  padding: 18px 8px;
}
.fitting-scope summary {
  cursor: pointer;
}
.fitting-scope p {
  line-height: 1.9;
}
.fitting-final {
  position: static;
  max-width: none;
  border: 1px solid var(--line);
}
.fitting-final .fitting-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.fitting-final .button {
  margin-top: 12px;
}
.fitting-source-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #edf2e6;
  font-size: 14px;
  margin-bottom: 24px;
}
.fitting-source-summary .text-link {
  margin-left: auto;
}
.migration-notice {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.migration-notice span {
  flex: 1;
  min-width: 200px;
}
#storage-notice .notice {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
#storage-notice button {
  border: 1px solid #be8274;
  border-radius: 6px;
  background: #fff8ef;
  padding: 5px 10px;
  color: #743e33;
}
.save-error {
  color: #a14636;
}
.connection-error {
  max-width: 700px;
  margin: 12vh auto;
  padding: 32px;
}
@media (max-width: 900px) {
  .parameter-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .editor-progress {
    gap: 10px;
  }
  .editor-progress .progress-track {
    display: none;
  }
  .editor-progress > div:first-child {
    flex: 1;
  }
}
@media (max-width: 600px) {
  .editor-tool-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
  .editor-progress {
    flex-wrap: wrap;
    padding: 12px;
  }
  .editor-progress > div:first-child {
    flex-basis: 100%;
  }
  .editor-progress .button {
    flex: 1;
  }
  .editor-tool-panel {
    padding: 16px;
  }
  .color-name {
    width: 100%;
  }
  .color-name span {
    margin-left: auto;
  }
  .fitting-focused {
    padding: 20px 16px;
  }
  .fitting-steps button {
    padding: 14px 5px;
    font-size: 14px;
  }
  .fitting-steps button span {
    margin-right: 5px;
    font-size: 16px;
  }
  .fitting-final .fitting-metrics {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .notes-layout {
    grid-template-columns: 1fr;
  }
  .advanced-fields summary span {
    display: block;
    margin: 6px 0 0 16px;
  }
}
