/* Neutral surfaces so thread colors read true. CutArc's Source Sans 3 and
   Barlow (same files as plasma/fonts/vendor). Nothing below 11px. */
@font-face{font-family:"Source Sans 3";font-weight:400 700;font-display:swap;src:url(source-sans-3.woff2) format("woff2")}
@font-face{font-family:Barlow;font-weight:600;font-display:swap;src:url(barlow-600.woff2) format("woff2")}

:root{
  /* App switcher above header popovers (30), below native dialogs in the top layer. */
  --cutarc-apps-z:50;
  --ink:#1c2924;--ink-2:#47534d;--muted:#66706a;
  --line:#e2e4e0;--line-strong:#cdd2cc;
  --panel:#fff;--subtle:#f4f5f3;--stage:#e5e7e3;
  --brand:#1f4a39;--brand-hover:#163829;--brand-tint:#e3ede7;--brand-line:#93b2a1;
  --warn:#8f540d;--error:#a33a26;
  --radius:6px;
  /* Names used by threads.css and older rules. */
  --paper:var(--panel);--green:var(--brand);--green-soft:var(--brand-tint);--accent:var(--brand);
  --display:Barlow,"Source Sans 3",system-ui,sans-serif;
  font-family:"Source Sans 3",system-ui,-apple-system,"Segoe UI",sans-serif;
  font-size:14px;line-height:1.4;color:var(--ink);background:var(--panel);
  font-synthesis:none;-webkit-font-smoothing:antialiased;
}
*{box-sizing:border-box}
body{margin:0;background:var(--panel)}
button,input,select,textarea{font:inherit;color:inherit}
button,a,input,select,summary{-webkit-tap-highlight-color:transparent}
button{cursor:pointer;background:var(--panel);border:1px solid var(--line-strong);border-radius:var(--radius);padding:7px 12px;font-size:13.5px;transition:background .12s,border-color .12s}
button:hover:not(:disabled){background:var(--subtle)}
button:disabled{cursor:default;opacity:.45}
:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
input:not([type=range]):not([type=color]):not([type=checkbox]),select,textarea{border:1px solid var(--line-strong);background:var(--panel);border-radius:var(--radius);padding:7px 9px;width:100%;font-size:14px}
select{cursor:pointer}
input[type=number]{font-variant-numeric:tabular-nums}
button.primary{background:var(--brand);border-color:var(--brand);color:#fff;font-weight:600;padding:8px 16px;display:inline-flex;align-items:center;justify-content:center;gap:8px}
button.primary:hover:not(:disabled){background:var(--brand-hover)}
button.secondary{display:flex;align-items:center;justify-content:center;gap:8px}
button.quiet{border-color:transparent;background:transparent;color:var(--ink-2);padding:5px 8px;font-size:13px}
button.quiet:hover:not(:disabled){background:var(--subtle);color:var(--ink)}
.wide{width:100%}
.muted{color:var(--muted);font-size:12.5px;line-height:1.5;margin:6px 0}
.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}
[hidden]{display:none!important}
.icon{flex-shrink:0;display:block}
h2{margin:0;font-size:13px;font-weight:700;color:var(--ink)}

/* Header: one 56px bar carrying the project, machine and hoop. */
.app-header{height:56px;display:flex;align-items:center;gap:16px;padding:0 16px;border-bottom:1px solid var(--line);background:var(--panel);position:relative;z-index:10}
.brand{display:flex;align-items:center;gap:9px;text-decoration:none;color:var(--ink);padding-right:16px;border-right:1px solid var(--line);height:32px}
.brand img{border-radius:7px}
.brand-name{font-family:var(--display);font-weight:600;font-size:16px;letter-spacing:.1px;white-space:nowrap}
.brand-name span{color:var(--muted)}
.project-title{display:flex;flex-direction:column;min-width:0;width:220px}
.project-title input{border:1px solid transparent!important;background:transparent!important;padding:1px 6px!important;margin-left:-6px;font-weight:600;font-size:15px!important;border-radius:4px!important}
.project-title input:hover{border-color:var(--line)!important}
.project-title input:focus{border-color:var(--line-strong)!important;background:var(--panel)!important}
.project-title>span{font-size:11.5px;color:var(--muted)}
.history-controls{display:flex;gap:2px}
.icon-button{width:32px;height:32px;padding:0;display:grid;place-items:center;border-color:transparent;background:transparent;color:var(--ink-2)}
.header-setup{display:flex;gap:8px;margin-left:auto}
.setup-field{display:flex;align-items:center;gap:0;border:1px solid var(--line-strong);border-radius:var(--radius);padding-left:10px;background:var(--panel)}
.setup-field>span{font-size:12px;color:var(--muted);white-space:nowrap}
.setup-field select{border:0!important;background:transparent!important;width:auto!important;padding:6px 8px!important;font-size:13.5px!important}
/* The header fits on every desktop width: the Machine / Hoop labels give way first, then the two names truncate. */
.header-setup,.setup-field,.setup-field select{min-width:0}
.setup-field select{text-overflow:ellipsis}
@media(max-width:1480px){.header-setup .setup-field>span{display:none}}
.unit-toggle{display:inline-flex;align-self:stretch;justify-self:start;flex-shrink:0;border:1px solid var(--line-strong);border-radius:var(--radius);overflow:hidden;background:var(--panel)}
.unit-toggle button{border:0;border-radius:0;background:transparent;color:var(--muted);padding:6px 12px;font:inherit;font-size:13.5px;min-width:40px;cursor:pointer}
.unit-toggle button[aria-pressed=true]{background:var(--ink);color:var(--panel)}
.unit-toggle button:focus-visible{outline:2px solid var(--brand);outline-offset:-2px}
.header-actions{display:flex;align-items:center;gap:8px;flex-shrink:0}
.header-actions>a,.header-actions>button{white-space:nowrap}
.header-actions .primary{padding:8px 18px}
.account-link{font-size:13.5px;text-decoration:none;color:var(--ink-2);padding:6px 8px}
.menu{position:relative}
.menu summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:6px;padding:7px 10px 7px 12px;border:1px solid var(--line-strong);border-radius:var(--radius);font-size:13.5px}
.menu summary::-webkit-details-marker{display:none}
.menu[open] summary{background:var(--subtle)}
.menu-panel{position:absolute;right:0;top:calc(100% + 6px);width:264px;background:var(--panel);border:1px solid var(--line-strong);border-radius:8px;box-shadow:0 12px 32px rgb(28 41 36/.14);padding:6px;z-index:30}
.menu-item{display:block;width:100%;text-align:left;border:0;background:transparent;padding:8px 10px;border-radius:5px}
.menu-sample{border-top:1px solid var(--line);margin-top:6px;padding:10px 4px 4px}
.menu-sample label{display:block;font-size:12px;color:var(--muted);margin-bottom:6px}
.menu-sample-row{display:flex;gap:6px}
.menu-sample-row select{flex:1;min-width:0}
#load-sample .sample-art{display:none!important}

/* Three columns that fill the window and scroll independently. */
.studio{display:grid;grid-template-columns:280px minmax(420px,1fr) 300px;height:calc(100vh - 56px)}
.panel{background:var(--panel);min-height:0}
.library{border-right:1px solid var(--line);display:flex;flex-direction:column;overflow:hidden}
.rail-section{padding:16px 16px 14px;border-bottom:1px solid var(--line)}
.rail-section h2{margin-bottom:10px}
.tool-grid{display:grid;grid-template-columns:1fr 1fr;gap:4px}
.tool-grid button{display:flex;align-items:center;gap:8px;border-color:transparent;background:transparent;padding:7px 8px;font-size:13.5px;text-align:left;color:var(--ink)}
.tool-grid button .icon{color:var(--ink-2)}
.tool-grid button:hover:not(:disabled){background:var(--subtle);border-color:var(--line)}
.ai-entry{margin:0 0 10px}
.order-section{flex:1;display:flex;flex-direction:column;min-height:0;border-bottom:0;padding-bottom:12px}
.order-head{display:flex;align-items:center;justify-content:space-between}
.order-head h2{margin:0;display:flex;align-items:center;gap:8px}
.count{font-size:12px;font-weight:600;color:var(--ink-2);background:var(--subtle);border:1px solid var(--line);border-radius:10px;padding:0 7px;line-height:18px}
.selection-shortcuts{display:flex;gap:2px}
.selection-shortcuts .quiet{font-size:12.5px;padding:3px 6px}
.order-hint{font-size:12px;color:var(--muted);margin:4px 0 8px}
.object-list{flex:1;overflow:auto;margin:0 -8px;padding:0 4px;display:flex;flex-direction:column;gap:1px}
.object-row{display:flex;align-items:center;gap:9px;padding:7px 8px;border-radius:6px;border:1px solid transparent;cursor:pointer;min-height:48px}
.object-row:hover{background:var(--subtle)}
.object-row.selected{background:var(--brand-tint);border-color:var(--brand-line)}
.object-row.hidden-object{opacity:.45}
.row-index{width:16px;text-align:right;font-size:12px;color:var(--muted);font-variant-numeric:tabular-nums;flex-shrink:0}
/* A wound-thread swatch: the twist texture says "thread", not "dot". */
.object-row .thread-dot{width:26px;height:26px;border-radius:5px;flex-shrink:0;box-shadow:inset 0 0 0 1px rgb(0 0 0/.14);background-image:repeating-linear-gradient(-62deg,rgb(255 255 255/.22) 0 1.2px,transparent 1.2px 3px),linear-gradient(rgb(255 255 255/.18),rgb(0 0 0/.12))}
.object-row .object-copy{flex:1;min-width:0;display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:8px;align-items:baseline}
.object-row .object-copy small{grid-column:1/-1}
.object-row strong{display:block;font-size:13.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.object-row small{display:flex;gap:6px;align-items:center;font-size:12px;color:var(--muted);margin-top:1px;white-space:nowrap;overflow:hidden}
.row-thumb{width:40px;height:40px;border-radius:6px;flex-shrink:0;background:#f7f4e9;box-shadow:inset 0 0 0 1px var(--line)}
.step-toggle{border:0;background:transparent;color:var(--muted);width:18px;padding:0;font-size:12px;cursor:pointer;flex-shrink:0}
.step-row{display:flex;align-items:center;gap:9px;padding:4px 8px 4px 38px;border-radius:6px;border:1px solid transparent;cursor:pointer;min-height:46px}
.step-row:hover{background:var(--subtle)}
.step-row.selected{background:var(--brand-tint);border-color:var(--brand-line)}
.step-row.hidden-object{opacity:.45}
.step-row .object-copy{flex:1;min-width:0;display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:8px;align-items:baseline}
.step-row strong{font-size:13px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.step-row .step-stitches{font-size:12px;color:var(--muted)}
.imported-thread.focused{outline:2px solid var(--brand);outline-offset:1px;border-radius:6px}
.row-thread{color:var(--ink-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row-thread:before{content:"";display:inline-block;width:3px;height:3px;border-radius:50%;background:var(--muted);vertical-align:middle;margin-right:6px}
.row-stitches{font-size:12px;color:var(--ink-2);font-variant-numeric:tabular-nums}
.eye-button{border:0;background:transparent;padding:4px;color:var(--muted);font-size:12px}
.order-actions{display:flex;gap:4px;margin-top:10px}
.order-actions button{flex:1;display:grid;place-items:center;height:32px;padding:0;color:var(--ink-2)}
.order-actions #delete:hover:not(:disabled){color:var(--error);border-color:#e3c3bb;background:#fbf3f1}

/* Work area: the hoop gets the height that the old toolbar and cards used. */
.workarea{display:flex;flex-direction:column;min-width:0;min-height:0;background:var(--stage)}
.canvas-topbar{display:flex;align-items:center;justify-content:space-between;padding:12px 16px 0;gap:12px}
.view-switch{display:flex;background:rgb(255 255 255/.55);border:1px solid var(--line-strong);border-radius:7px;padding:2px}
.view-switch button{border:0;background:transparent;padding:5px 14px;font-size:13px;color:var(--ink-2);border-radius:5px}
.view-switch button.active{background:var(--panel);color:var(--ink);font-weight:600;box-shadow:0 1px 2px rgb(28 41 36/.12)}
.zoom-controls{display:flex;align-items:center;background:var(--panel);border:1px solid var(--line-strong);border-radius:7px;overflow:hidden}
.zoom-controls button{border:0;border-radius:0;background:transparent;height:30px;padding:0 9px;display:grid;place-items:center}
.zoom-controls #zoom-fit{font-size:12.5px;min-width:52px;font-variant-numeric:tabular-nums;border-left:1px solid var(--line);border-right:1px solid var(--line)}
.canvas-wrap{position:relative;flex:1;min-height:320px;overflow:hidden}
.canvas-wrap canvas{position:absolute;inset:0;width:100%;height:100%;touch-action:none}
.canvas-caption{position:absolute;left:16px;bottom:10px;font-size:12px;color:var(--ink-2);pointer-events:none}
.busy-overlay{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);background:var(--panel);border:1px solid var(--line-strong);border-radius:10px;box-shadow:0 16px 48px rgb(28 41 36/.18);padding:20px 24px;min-width:260px;display:flex;flex-direction:column;align-items:center;gap:6px;z-index:3}
.busy-overlay strong{font-size:14px}
.busy-overlay>span:last-child{font-size:12.5px;color:var(--muted)}
.spinner{border:2px solid var(--line);border-top-color:var(--brand);border-radius:50%;width:22px;height:22px;animation:spin .8s linear infinite;margin-bottom:4px}
@keyframes spin{to{transform:rotate(360deg)}}
.drawing-bar{display:flex;gap:6px;align-items:center;flex-wrap:wrap;margin:10px 16px 0;padding:8px 10px;background:#fff7e6;border:1px solid #ecd6ad;border-radius:7px;color:#6b4a14;font-size:13px;z-index:2}
.drawing-bar span{flex:1;min-width:140px}
.drawing-bar button{padding:4px 10px;font-size:12.5px}

/* Playback: the scrubber is the thread sequence itself. */
.playback{display:flex;align-items:center;gap:14px;padding:10px 16px;background:var(--panel);border-top:1px solid var(--line)}
.play-button{width:34px;height:34px;border-radius:50%;padding:0;background:var(--brand);border-color:var(--brand);color:#fff;font-size:12px;flex-shrink:0}
.play-button:hover:not(:disabled){background:var(--brand-hover)!important}
.playback-main{flex:1;min-width:0}
.scrub-wrap{position:relative;height:18px;display:flex;align-items:center}
.thread-track{position:absolute;left:0;right:0;top:5px;height:8px;border-radius:2px;display:flex;overflow:hidden;background:var(--line);box-shadow:inset 0 0 0 1px rgb(0 0 0/.08)}
.thread-track span{display:block;height:100%;min-width:1px;box-shadow:inset -1px 0 0 rgb(255 255 255/.7)}
.thread-track .veil{position:absolute;right:0;top:0;bottom:0;background:rgb(255 255 255/.7);pointer-events:none}
#scrub{position:relative;margin:0!important;width:100%;appearance:none;background:transparent;height:18px;cursor:pointer}
#scrub::-webkit-slider-runnable-track{height:18px;background:transparent}
#scrub::-webkit-slider-thumb{appearance:none;width:4px;height:18px;border-radius:2px;background:var(--ink);box-shadow:0 0 0 2px #fff}
#scrub::-moz-range-thumb{width:4px;height:18px;border-radius:2px;background:var(--ink);border:2px solid #fff}
.playback-meta{display:flex;justify-content:space-between;gap:12px;font-size:12px;color:var(--ink-2);margin-top:3px;font-variant-numeric:tabular-nums}
.playback-meta span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.speed,.jump-toggle{display:flex;align-items:center;gap:6px;font-size:12.5px;color:var(--ink-2);white-space:nowrap}
.speed select{width:auto!important;padding:4px 6px!important;font-size:12.5px!important}
.jump-toggle input{margin:0;accent-color:var(--brand)}

/* Production summary: what a machine operator checks before hooping. */
.design-stats{display:flex;align-items:stretch;background:var(--panel);border-top:1px solid var(--line);height:54px;flex-shrink:0}
.design-stats>div{display:flex;flex-direction:column;justify-content:center;padding:0 18px;border-right:1px solid var(--line)}
.design-stats strong{font-family:var(--display);font-weight:600;font-size:18px;line-height:1.1;font-variant-numeric:tabular-nums}
.design-stats span{font-size:11.5px;color:var(--muted)}
.machine-note{margin:0 0 0 auto;align-self:center;padding:0 16px;font-size:12px;color:var(--muted);max-width:340px;line-height:1.35}
.design-stats .engine{border-right:0;flex-direction:row;align-items:center;gap:7px}
.design-stats .engine span:last-child{font-size:12px;color:var(--ink-2)}
.status-dot{width:7px;height:7px;border-radius:50%;background:#c2953f;flex-shrink:0}
.status-dot.ready{background:#3f8a5f}

/* Inspector */
.inspector{border-left:1px solid var(--line);display:flex;flex-direction:column;overflow:hidden;padding:0}
.inspector-scroll{flex:1;min-height:0;overflow:auto;padding:16px 16px 12px}
.panel-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}
.panel-heading h2{font-size:13px}
.empty-selection{color:var(--muted);font-size:13.5px;line-height:1.55;padding:12px 0}
.field-label{display:block;font-size:12.5px;font-weight:600;color:var(--ink-2);margin:14px 0 5px}
.section-label{display:flex;align-items:center;justify-content:space-between;margin:20px 0 8px;padding-top:16px;border-top:1px solid var(--line)}
.section-label h2{font-size:13px}
.selection-heading{display:flex;flex-direction:column;gap:2px;font-size:14px}
.selection-heading>span{color:var(--muted);font-size:12.5px;font-variant-numeric:tabular-nums}
#thread-identity{margin:8px 0 6px;color:var(--ink-2)}
#choose-thread,#choose-multi-thread,#match-design-threads{margin:6px 0 4px}
#edit-points{margin-top:6px;text-align:left;padding-left:0;color:var(--brand);font-weight:600}
.color-picker{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--ink-2);font-variant-numeric:tabular-nums}
.color-picker input{width:20px;height:20px;border:0;padding:0;background:transparent;cursor:pointer}
.color-picker input::-webkit-color-swatch-wrapper{padding:0}
.color-picker input::-webkit-color-swatch{border:1px solid rgb(0 0 0/.15);border-radius:4px}
.palette{display:grid;grid-template-columns:repeat(8,minmax(0,36px));gap:6px}
.palette button{aspect-ratio:1;width:100%;height:auto;padding:0;border-radius:5px;border:0;box-shadow:inset 0 0 0 1px rgb(0 0 0/.14);background-image:repeating-linear-gradient(-62deg,rgb(255 255 255/.2) 0 1.2px,transparent 1.2px 3px)}
.palette button.active{box-shadow:0 0 0 2px var(--panel),0 0 0 4px var(--ink)}
.stitch-picker{display:grid;grid-template-columns:repeat(5,1fr);gap:4px}
.stitch-picker button{display:flex;flex-direction:column;align-items:center;gap:3px;padding:7px 2px 5px;font-size:11.5px;color:var(--ink-2)}
.stitch-picker svg{width:30px;height:24px}
.stitch-picker button[aria-checked=true]{background:var(--brand-tint);border-color:var(--brand);color:var(--brand);font-weight:600}
select.picker-source{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}
.stitch-description{font-size:12.5px;color:var(--muted);line-height:1.5;margin:8px 0 4px}
.direction-presets{display:flex;gap:4px;margin:6px 0}
.direction-presets button{flex:1;padding:5px 0;font-size:12.5px;font-variant-numeric:tabular-nums}
.direction-presets .active,#edit-direction[aria-pressed=true]{background:var(--brand-tint);border-color:var(--brand);color:var(--brand)}
#edit-direction{margin-top:4px}
.number-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:10px 0}
.group-resize-grid{margin:0}
.group-resize .muted{margin:6px 0 0;font-size:12px}
.number-grid label{font-size:12.5px;font-weight:600;color:var(--ink-2);position:relative}
.number-grid label>span:not(#length-label){position:absolute;right:9px;bottom:8px;font-size:12px;font-weight:400;color:var(--muted);pointer-events:none}
#custom-hoop-dialog .number-grid label>span{position:static;font:inherit;color:inherit}
.number-grid input{margin-top:4px;padding-right:30px!important}
.number-grid input::-webkit-inner-spin-button{opacity:0}
.range-label{display:flex;justify-content:space-between;font-size:12.5px;font-weight:600;color:var(--ink-2);margin:14px 0 4px}
.range-label>span{font-weight:400;font-variant-numeric:tabular-nums}
input[type=range]:not(#scrub){width:100%;accent-color:var(--brand);margin:4px 0}
.density-help{margin-top:2px}
.toggle-label{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:14px 0}
.toggle-label strong{font-size:13px;font-weight:600}
.toggle-label small{display:block;font-size:12px;color:var(--muted);margin-top:1px}
.toggle-label input{appearance:none;width:32px;height:18px;border-radius:9px;background:var(--line-strong);position:relative;margin:0;cursor:pointer;flex-shrink:0}
.toggle-label input:before{content:"";position:absolute;width:14px;height:14px;border-radius:50%;background:#fff;left:2px;top:2px;transition:transform .15s}
.toggle-label input:checked{background:var(--brand)}
.toggle-label input:checked:before{transform:translateX(14px)}
.toolbox{border-top:1px solid var(--line);padding:12px 0;margin-top:12px}
.toolbox summary,.position-details summary{cursor:pointer;font-size:13px;font-weight:700;list-style:none;display:flex;justify-content:space-between;align-items:center}
.toolbox summary::-webkit-details-marker,.position-details summary::-webkit-details-marker{display:none}
.toolbox summary:after,.position-details summary:after{content:"";width:7px;height:7px;border-right:1.5px solid var(--muted);border-bottom:1.5px solid var(--muted);transform:rotate(45deg) translateY(-2px);margin-right:4px}
.toolbox[open] summary:after,.position-details[open] summary:after{transform:rotate(-135deg) translateY(-1px)}
.toolbox[open] summary{margin-bottom:10px}
.position-details{border-top:1px solid var(--line);padding:12px 0;margin-top:12px}
.position-details[open] summary{margin-bottom:6px}
.compact-grid{display:grid;grid-template-columns:1fr 1fr;gap:4px}
.compact-grid button{padding:6px 6px;font-size:12.5px;min-height:32px}
.compact-grid button.active{background:var(--brand-tint);border-color:var(--brand)}
.toolbox .secondary{margin-top:8px}
.checks summary span{color:var(--warn);font-size:12.5px;font-weight:600;margin-left:auto;margin-right:10px}
.check-item{border-left:2px solid var(--brand-line);padding:4px 0 4px 10px;margin:10px 0}
.check-item.error{border-color:var(--error)}
.check-item.warning{border-color:#c79a53}
.check-item strong,.check-item button{font-size:13px;font-weight:600;text-align:left;border:0;background:none;padding:0}
.check-item p{font-size:12.5px;line-height:1.5;color:var(--muted);margin:3px 0 0}
.thread-row{display:flex;align-items:center;gap:8px;width:100%;border:0;background:none;font-size:13px;padding:6px 0;text-align:left}
.thread-row .thread-dot{width:16px;height:16px;border-radius:4px;box-shadow:inset 0 0 0 1px rgb(0 0 0/.15);flex-shrink:0}
#studio-help{margin-top:10px;padding-left:0;color:var(--ink-2)}
.jump-toggle input{accent-color:var(--brand)}
.generate-area{flex-shrink:0;padding:12px 16px 14px;border-top:1px solid var(--line);background:var(--panel)}
.plan-status{display:flex;align-items:center;gap:7px;font-size:12.5px;color:var(--warn);margin-bottom:8px}
.plan-status:before{content:"";width:7px;height:7px;border-radius:50%;background:currentColor;flex-shrink:0}
.plan-status.current{color:#2f7a4f}
.generate-area .primary{width:100%;padding:10px 16px;font-size:14px}
.generate-area>p{font-size:12px;color:var(--muted);text-align:center;margin:8px 0 0}
.imported-heading{margin-top:16px}
.imported-thread{display:flex;align-items:center;gap:9px;margin:8px 0;font-size:13px}
.imported-thread input{width:34px;height:30px;padding:2px;border:1px solid var(--line-strong);border-radius:5px;background:var(--panel)}
#multi-color{width:100%;height:32px;padding:2px;border:1px solid var(--line-strong);border-radius:var(--radius);background:var(--panel)}

/* Messages */
#toast{position:fixed;left:50%;bottom:72px;transform:translateX(-50%);background:var(--ink);color:#fff;padding:9px 16px;border-radius:7px;font-size:13.5px;z-index:40;box-shadow:0 10px 30px rgb(0 0 0/.2);max-width:90vw}
.error-banner{position:fixed;left:50%;bottom:72px;transform:translateX(-50%);background:#fdf4f1;color:#7a2d1d;border:1px solid #e8c3b8;border-radius:8px;padding:12px 14px;z-index:41;display:flex;align-items:center;gap:16px;max-width:min(640px,90vw);font-size:13.5px}
.error-banner button{border:0;background:none;font-size:18px;color:inherit;padding:0 4px}
.inline-error{color:var(--error);font-size:13px}
.inline-error:empty{display:none}

/* Dialogs: plain task titles, no eyebrows. */
dialog{border:1px solid var(--line-strong);border-radius:12px;padding:24px;width:460px;max-width:calc(100vw - 32px);max-height:calc(100vh - 32px);overflow:auto;background:var(--panel);color:var(--ink);box-shadow:0 24px 64px rgb(28 41 36/.24)}
dialog::backdrop{background:rgb(28 41 36/.45)}
.dialog-eyebrow{display:none}
dialog h1{font-family:var(--display);font-weight:600;font-size:22px;letter-spacing:0;margin:0 32px 6px 0}
dialog>p{font-size:13.5px;color:var(--ink-2);line-height:1.55;margin:0 0 12px}
.dialog-close{position:absolute;right:14px;top:14px;border:0;background:transparent;font-size:22px;line-height:1;color:var(--muted);padding:4px 8px}
dialog .primary,dialog .secondary{margin-top:10px}
.export-summary{display:flex;gap:0;margin:14px 0 6px;border:1px solid var(--line);border-radius:8px;overflow:hidden}
.export-summary>*{flex:1;padding:10px 12px;border-right:1px solid var(--line)}
.export-summary>*:last-child{border-right:0}
.export-summary strong{display:block;font-family:var(--display);font-weight:600;font-size:18px;font-variant-numeric:tabular-nums}
.export-summary small{font-size:11.5px;color:var(--muted)}
#download-file{width:100%;margin-top:16px;padding:10px}
#save-to-folder{margin-top:4px}
.usb-panel{margin:14px 0 4px;padding:12px 14px;border:1px solid var(--line);border-radius:8px;background:var(--subtle)}
.usb-panel .field-label{margin-top:0}
.usb-drive-row{display:flex;gap:6px}
.usb-drive-row select{flex:1;min-width:0}
.usb-panel .primary{width:100%}
.machine-send{margin:14px 0 4px;padding:12px 14px;border:1px solid var(--line);border-radius:8px;background:var(--subtle)}
.machine-send .primary{width:100%;margin-top:6px}
.machine-send p{margin:0;font-size:13px}
#machine-send-status:not(:empty){margin-top:8px}
#machine-send-status[data-tone=error]{color:var(--danger,#a12a1f)}
.error-text{color:var(--danger,#a12a1f);font-size:13px;min-height:1em;margin:6px 0 0}
.usb-panel .primary:disabled{background:var(--panel);color:var(--muted);border-color:var(--line-strong);opacity:1}
#usb-status{font-size:13px;margin:10px 0 0;overflow-wrap:anywhere}
#usb-status:empty{display:none}
#usb-status[data-tone=success]{color:#2f6d48}
#usb-status[data-tone=error],#usb-status[data-tone=notice]{color:var(--warn)}
.transfer-note{font-size:12.5px!important;color:var(--muted);margin-top:14px}
dialog>a{font-size:13px;color:var(--brand);text-underline-offset:3px}
.studio-dialog{width:540px}
.studio-dialog .number-grid label{font-size:12.5px}
.studio-dialog select{margin-top:4px}
.guide-steps{padding-left:18px;line-height:1.6;font-size:13.5px;color:var(--ink-2)}
.guide-steps li{margin-bottom:10px}
.guide-steps strong{color:var(--ink)}
.library-dialog{width:760px}
.saved-designs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-top:16px}
.saved-card{border:1px solid var(--line);border-radius:8px;padding:10px;min-width:0}
.saved-card img{width:100%;border-radius:4px;background:var(--subtle)}
.saved-card strong{display:block;font-size:13.5px;overflow-wrap:anywhere}
.saved-card small{display:block;font-size:12px;color:var(--muted);margin:4px 0 10px}
.trace-previews{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:16px}
.trace-previews figure{margin:0;background:var(--subtle);border:1px solid var(--line);border-radius:7px;padding:8px;text-align:center}
.trace-previews img{display:block;width:100%;height:160px;object-fit:contain}
.trace-previews figcaption{font-size:12px;color:var(--muted);margin-top:6px}
#inspect-preview{display:block;width:100%;max-height:330px;object-fit:contain;margin:12px 0;border:1px solid var(--line);border-radius:8px}
#import-actions{margin-top:14px}
.ai-preview{width:100%;max-height:280px;object-fit:contain;background:#fff;border:1px solid var(--line);border-radius:8px;margin-top:12px}

/* Component rules carried over from the previous stylesheet. */
.sewing-attributes{margin-top:4px}
.sewing-attributes input[type=number]{width:100%}
.sewing-attributes #spacing-settings{margin-top:14px}
#sewing-copy-tools{border-top:1px solid var(--line);padding-top:12px;margin-top:12px}
#sewing-copy-tools button{font-size:12.5px;padding:7px 4px}
.checks summary{display:flex}
.thread-row span:last-child{overflow-wrap:anywhere}
.saved-card .compact-grid button{font-size:12px;padding:6px 3px}
#inspect-result>p{font-size:13px;line-height:1.55}
#inspect-name{display:block;overflow-wrap:anywhere}
#inspect-status{font-size:12.5px}
.imported-thread span{overflow-wrap:anywhere;min-width:0}
#import-actions button{font-size:13px;padding:10px 8px}
#ai-brief{font-size:12.5px}
#ai-live .wide{margin:8px 0}
#ai-artwork .compact-grid{margin:12px 0}
#ai-account{line-height:1.5}
#ai-sign-in{display:block;margin:10px 0}
#ai-sign-in[hidden]{display:none}
.ai-palette{display:flex;gap:12px;flex-wrap:wrap}
.ai-palette label{font-size:12px;display:grid;gap:5px}
.ai-palette label[hidden]{display:none}
.ai-palette input[type=color]{width:46px;height:35px;padding:3px}

/* Narrower windows: inspector drops below; phones stack everything. */
@media(max-width:1180px){
  .studio{grid-template-columns:232px minmax(360px,1fr) 272px}
  .header-setup .setup-field>span{display:none}
  .project-title{width:170px}
}
@media(max-width:900px){
  .app-header{flex-wrap:wrap;height:auto;padding:8px 12px;gap:8px 12px}
  .brand{border-right:0;padding-right:0}
  .project-title{flex:1;width:auto}
  .header-setup{order:5;margin-left:0;width:100%;flex-wrap:wrap}
  .setup-field{flex:1;min-width:0}
  .setup-field select{flex:1;min-width:0;width:100%!important}
  .studio{display:flex;flex-direction:column;height:auto}
  .workarea{order:0;height:78vh;min-height:560px}
  .library{order:1;border-right:0;border-top:1px solid var(--line);overflow:visible}
  .object-list{max-height:none;overflow:visible}
  .inspector{order:2;border-left:0;border-top:1px solid var(--line);overflow:visible}
  .inspector-scroll{overflow:visible}
  .generate-area{position:sticky;bottom:0;box-shadow:0 -6px 16px rgb(28 41 36/.06)}
  .tool-grid{grid-template-columns:repeat(4,1fr)}
  .playback{flex-wrap:wrap}
  .playback-main{flex-basis:calc(100% - 50px)}
  .design-stats{height:auto;flex-wrap:wrap}
  .design-stats>div{padding:8px 14px}
  .design-stats .engine{display:none}
  .machine-note{flex-basis:100%;max-width:none;margin:0;padding:6px 14px 8px}
}
@media(max-width:600px){
  .brand-name span{display:none}
  .history-controls{display:none}
  .header-actions{margin-left:auto}
  .project-title{order:4;flex-basis:100%}
  .header-setup .setup-field:first-child{flex-basis:100%}
  .tool-grid{grid-template-columns:repeat(2,1fr)}
  .workarea{height:72vh;min-height:500px}
  .design-stats>div{flex:1 1 45%;border-bottom:1px solid var(--line)}
  .speed{display:none}
  .saved-designs{grid-template-columns:1fr 1fr}
  dialog{padding:20px}
}
@media(prefers-reduced-motion:reduce){*{transition:none!important}.spinner{animation:none}}

@media print{@page{size:auto;margin:15mm}
  body>*{display:none!important}
  body>#sewing-worksheet{display:block!important;font:11pt "Source Sans 3",sans-serif;color:#1c2924}
  #sewing-worksheet h1{font-size:22pt}
  #sewing-worksheet img{max-width:80mm;max-height:70mm;display:block}
  #sewing-worksheet table{border-collapse:collapse;width:100%;margin:7mm 0}
  #sewing-worksheet th,#sewing-worksheet td{border-bottom:1px solid #aaa;text-align:left;padding:3mm;font-size:10pt}
  #sewing-worksheet tr{break-inside:avoid}
}

/* Only shown by the explicitly enabled standalone browser-engine prototype. */
.browser-engine-panel{padding:12px;border:1px solid var(--brand-line);border-radius:8px;background:var(--brand-tint);margin:12px 16px 0}
.browser-engine-panel .muted{font-size:12px;line-height:1.5;margin:10px 0}

/* Embroidery Pro (spec 2026-10-23): badges show only while the account lacks Pro. */
.pro-badge,.pro-locked [data-pro-badge]::after{display:inline-block;padding:1px 7px;border-radius:999px;background:var(--brand-tint);color:var(--brand);font-size:11px;font-weight:700;line-height:1.5;letter-spacing:.02em;vertical-align:middle}
.pro-locked [data-pro-badge]::after{content:'Pro';margin-left:6px}
.pro-dialog{width:440px}
.pro-kicker{display:flex;align-items:center;gap:8px;margin:0 0 4px;color:var(--muted);font-size:13px}
.pro-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px;flex-wrap:wrap}
/* In the two-column Add grid the badge sits at the right edge, so one-word labels never push it out of the panel. */
.pro-locked .tool-grid [data-pro-badge]{position:relative;padding-right:38px}
.pro-locked .tool-grid [data-pro-badge]::after{position:absolute;right:6px;top:50%;transform:translateY(-50%);margin:0}
/* The stitch picker's icon buttons carry the badge in their top-right corner. */
.pro-locked .stitch-picker [data-pro-badge]{position:relative}
.pro-locked .stitch-picker [data-pro-badge]::after{position:absolute;top:2px;right:2px;margin:0;padding:0 5px;line-height:1.4}

.brand-name .beta-pill{display:inline-block;margin-left:6px;padding:1px 7px;border-radius:999px;border:1px solid var(--brand-line);color:var(--brand);font-size:11px;font-weight:700;letter-spacing:.02em;vertical-align:middle}
a.menu-item{color:inherit;text-decoration:none}
