.site-main { width: min(100% - 48px, 1700px); margin: 0 auto; }
.workspace-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  padding: 27px 0 20px;
}
.workspace-heading h1 {
  margin: 4px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.65rem, 2.6vw, 2.25rem);
  font-weight: 500;
  letter-spacing: -.035em;
  line-height: 1.14;
}
.project-identity { width: min(100%, 360px); flex: none; }
.project-identity label, .field label, .repeat-controls label {
  display: block;
  margin-bottom: 6px;
  color: var(--sp-muted);
  font-size: .75rem;
  font-weight: 750;
  letter-spacing: .02em;
}
.project-identity input, .field input:not([type="checkbox"]), .field select, .repeat-controls input {
  width: 100%;
  min-height: 42px;
  padding: 8px 11px;
  border: 1px solid #cbd5c9;
  border-radius: 8px;
  background: var(--sp-surface);
  color: var(--sp-text);
  font-size: .88rem;
}
.project-identity input::placeholder { color: #5d6f65; }
.project-identity input:hover, .field input:hover, .field select:hover, .repeat-controls input:hover { border-color: #9eafa0; }
.status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  min-height: 43px;
  padding: 0 2px 13px;
  font-size: .79rem;
}
.status-strip p { margin: 0; }
#project-status {
  position: relative;
  padding-left: 15px;
  color: var(--sp-deep);
  font-weight: 700;
}
#project-status::before {
  position: absolute;
  top: .58em;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #83a384;
  content: "";
}
.local-note { color: var(--sp-muted); text-align: right; }
.workspace-grid {
  display: grid;
  grid-template-columns: minmax(205px, 235px) minmax(0, 1fr) minmax(235px, 275px);
  align-items: start;
  gap: 16px;
}
.panel, .board-panel {
  min-width: 0;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius);
  background: var(--sp-surface);
  box-shadow: var(--sp-shadow);
}
.panel { padding: 19px 17px; }
.panel-heading { padding-bottom: 16px; border-bottom: 1px solid var(--sp-line); }
.panel-heading h2, .board-header h2 {
  margin: 5px 0 3px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -.025em;
}
.panel-heading > p:last-child { margin: 4px 0 0; color: var(--sp-muted); font-size: .78rem; line-height: 1.55; }
.stitch-palette {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 16px 0 7px;
}
.stitch-palette button {
  display: flex;
  min-width: 0;
  min-height: 75px;
  padding: 8px 5px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  border: 1px solid var(--sp-border);
  border-radius: 9px;
  background: #faf9f3;
  color: var(--sp-text);
  font-size: .7rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}
.stitch-palette button:hover:not(:disabled) { border-color: #7d9b84; background: #f2f6ed; }
.stitch-palette button[aria-pressed="true"], .stitch-palette button[aria-selected="true"] {
  border-color: var(--sp-deep);
  background: #e8efe6;
  box-shadow: inset 0 0 0 1px var(--sp-deep);
}
.stitch-palette button svg { width: 30px; height: 30px; flex: none; }
.palette-help { display: flex; gap: 10px; padding-top: 15px; border-top: 1px solid var(--sp-line); }
.palette-help p { margin: 0; color: var(--sp-muted); font-size: .72rem; line-height: 1.55; }
.tiny-loop { display: block; width: 15px; height: 15px; margin-top: 2px; flex: none; border: 2px solid var(--sp-accent); border-radius: 50%; transform: rotate(-32deg) scaleX(.77); }
.board-panel { overflow: visible; }
.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 80px;
  padding: 15px 18px;
}
.board-header h2 { margin-bottom: 0; }
.mode-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.mode-button {
  padding: 0 14px;
  border-color: var(--sp-border);
  background: #f8faf5;
  color: var(--sp-deep);
}
.mode-button:hover:not(:disabled) { background: var(--sp-soft); }
.mode-button[aria-pressed="true"] {
  border-color: var(--sp-deep);
  background: var(--sp-deep);
  color: white;
  box-shadow: 0 2px 0 #143529;
}
.board-utility {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 9px 16px;
  border-top: 1px solid var(--sp-line);
  background: #fcfbf6;
}
.history-actions, .zoom-actions { display: flex; align-items: center; gap: 5px; }
.tool-button {
  padding: 0 12px;
  border-color: var(--sp-border);
  background: var(--sp-surface);
  color: var(--sp-deep);
}
.tool-button:hover:not(:disabled) { border-color: #9caf9e; background: #f1f5ed; }
.tool-button[aria-pressed="true"] { border-color: var(--sp-deep); background: var(--sp-soft); }
.sample-menu summary { min-height: 36px; background: transparent; }
.sample-options { right: 0; min-width: 211px; }
.canvas-wrap {
  position: relative;
  height: clamp(450px, 44vw, 670px);
  min-height: 450px;
  overflow: hidden;
  border-top: 1px solid var(--sp-line);
  border-bottom: 1px solid var(--sp-line);
  background-color: #fffefa;
  background-image: radial-gradient(circle, #dbe4d8 0.7px, transparent .85px);
  background-size: 24px 24px;
  touch-action: none;
}
#chart-svg { width: 100%; height: 100%; touch-action: none; }
#chart-svg:focus-visible { outline-offset: -5px; }
.board-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 59px;
  padding: 9px 16px;
}
.chart-counts { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; color: var(--sp-muted); font-size: .8rem; font-weight: 650; }
.count-divider { width: 3px; height: 3px; border-radius: 50%; background: #a6b4a7; }
.icon-button { min-width: 37px; padding: 0; font-size: 1.2rem; line-height: 1; }
.edit-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--sp-line);
}
.edit-actions .tool-button { min-height: 33px; padding: 0 9px; font-size: .76rem; }
.action-caption { margin-right: 5px; color: var(--sp-muted); font-size: .71rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.edit-actions .danger-button { margin-left: auto; color: #9a4b36; }
.edit-actions .danger-button:hover:not(:disabled) { border-color: #bd8067; background: #fff3ec; }
.settings-stack { padding: 16px 0 19px; }
.field { min-width: 0; margin-bottom: 15px; }
.field select { appearance: none; padding-right: 29px; background-image: linear-gradient(45deg, transparent 50%, #687b6d 50%), linear-gradient(135deg, #687b6d 50%, transparent 50%); background-position: calc(100% - 16px) 18px, calc(100% - 11px) 18px; background-size: 5px 5px; background-repeat: no-repeat; }
.field-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.color-field input[type="color"] { padding: 3px; cursor: pointer; }
.toggle-stack { border-top: 1px solid var(--sp-line); }
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 41px;
  border-bottom: 1px solid var(--sp-line);
  color: #345044;
  font-size: .81rem;
  font-weight: 650;
  cursor: pointer;
}
.toggle-row input { width: 17px; height: 17px; flex: none; margin: 0; accent-color: var(--sp-deep); cursor: pointer; }
.repeat-panel { padding: 17px 0 20px; border-top: 1px solid var(--sp-line); }
.repeat-panel h3, .legend-panel h3 { margin: 0 0 4px; font-family: Georgia, "Times New Roman", serif; font-size: 1.16rem; font-weight: 500; }
.repeat-panel p, .legend-panel p { margin: 0 0 14px; color: var(--sp-muted); font-size: .76rem; line-height: 1.5; }
.repeat-controls { display: grid; grid-template-columns: auto minmax(45px, 1fr) auto; align-items: end; gap: 8px; }
.repeat-controls label { align-self: center; margin: 0; }
.repeat-controls input { min-width: 0; }
.repeat-controls button { min-height: 42px; padding: 0 11px; }
.legend-panel { padding-top: 17px; border-top: 1px solid var(--sp-line); }
#legend-list { display: grid; gap: 6px; padding: 0; margin: 0; list-style: none; }
#legend-list[hidden] { display: none; }
#legend-list li { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 7px 9px; border: 1px solid var(--sp-line); border-radius: 7px; background: #faf9f4; color: var(--sp-text); font-size: .76rem; overflow-wrap: anywhere; }
#legend-list svg { width: 28px; height: 28px; flex: none; }
.getting-started {
  display: grid;
  grid-template-columns: minmax(190px, 310px) minmax(0, 1fr);
  gap: 18px 38px;
  margin-top: 31px;
  padding: 30px;
  border: 1px solid #d4ded1;
  border-radius: var(--sp-radius);
  background: #eaf0e7;
}
.getting-started h2 { margin: 7px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.7rem; font-weight: 500; line-height: 1.2; }
.getting-started ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; padding: 0; margin: 0; list-style: none; counter-reset: steps; }
.getting-started li { position: relative; padding-top: 34px; counter-increment: steps; color: var(--sp-muted); font-size: .79rem; line-height: 1.5; }
.getting-started li::before { position: absolute; top: 0; left: 0; width: 25px; height: 25px; display: grid; place-items: center; border: 1px solid #b3c6b5; border-radius: 50%; color: var(--sp-deep); content: counter(steps); font-size: .71rem; font-weight: 800; }
.getting-started li strong, .getting-started li span { display: block; }
.getting-started li strong { margin-bottom: 5px; color: var(--sp-text); font-size: .86rem; }
.getting-started > a { grid-column: 2; }

@media (max-width: 1170px) {
  .workspace-grid { grid-template-columns: 220px minmax(0, 1fr); }
  .settings-panel { grid-column: 1 / -1; }
  .settings-stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 25px; }
  .settings-stack .toggle-stack { grid-column: 1 / -1; }
  .toggle-stack { display: flex; flex-wrap: wrap; gap: 0 25px; }
  .toggle-row { min-width: 185px; flex: 1; }
}
@media (max-width: 760px) {
  .site-main { width: min(100% - 32px, 1700px); }
  .workspace-heading { display: block; padding: 12px 0 9px; }
  .heading-copy .eyebrow { display: none; }
  .workspace-heading h1 { margin: 0 0 9px; }
  .project-identity { width: 100%; }
  .project-identity label { margin-bottom: 3px; }
  .project-identity input { min-height: 44px; }
  .status-strip { align-items: flex-start; flex-direction: column; gap: 3px; min-height: 0; padding-bottom: 8px; }
  .local-note { text-align: left; }
  .workspace-grid { display: flex; flex-direction: column; gap: 10px; }
  .tool-button, .mode-button, .sample-menu summary { min-height: 44px; }
  .edit-actions .tool-button { min-height: 40px; }
  .toggle-row { min-height: 44px; }
  .workspace-grid > * { width: 100%; }
  .palette-panel { order: 1; padding: 9px 12px; }
  .palette-panel .panel-heading { padding-bottom: 4px; }
  .palette-panel .eyebrow { display: none; }
  .palette-panel .panel-heading h2 { margin: 0; font-size: 1.2rem; }
  .palette-panel .panel-heading > p:last-child { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .board-panel { order: 2; }
  .settings-panel { order: 3; }
  .stitch-palette { display: flex; overflow-x: auto; gap: 8px; padding: 6px 0 1px; }
  .stitch-palette button { flex: 0 0 112px; min-height: 56px; padding: 5px 6px; flex-direction: row; gap: 6px; font-size: .66rem; line-height: 1.12; text-align: left; }
  .stitch-palette button svg { width: 24px; height: 24px; }
  .palette-help { display: none; }
  .canvas-wrap { height: min(65vh, 520px); min-height: 380px; }
  .settings-stack { display: block; }
  .toggle-stack { display: block; }
  .getting-started { display: block; padding: 24px; }
  .getting-started ol { margin: 24px 0 19px; }
}
@media (max-width: 520px) {
  .board-header { flex-wrap: nowrap; gap: 8px; min-height: 0; padding: 10px; }
  .board-header .eyebrow { display: none; }
  .board-header h2 { margin: 0; font-size: 1.15rem; line-height: 1.2; }
  .mode-toolbar { flex-wrap: nowrap; gap: 4px; }
  .mode-button { min-width: 44px; padding: 0 5px; font-size: .76rem; }
  .board-utility { gap: 4px; padding: 6px 10px; }
  .board-utility .tool-button { padding: 0 9px; font-size: .8rem; }
  .sample-menu summary { gap: 5px; padding: 0 8px; font-size: .8rem; text-transform: capitalize; }
  .sample-menu-long { display: none; }
  .canvas-wrap { height: min(47vh, 390px); min-height: 320px; }
  .board-footer { padding: 8px 12px; }
  .edit-actions { padding: 12px; }
  .edit-actions .action-caption { width: 100%; }
  .getting-started ol { grid-template-columns: 1fr; gap: 16px; }
  .getting-started li { padding: 0 0 0 37px; }
  .getting-started li::before { top: 2px; }
}
@media (max-width: 380px) {
  .board-utility .sample-menu { margin-left: 0; }
  .board-footer { flex-wrap: wrap; }
  .zoom-actions { margin-left: auto; }
}
