
.machine-editor-heading,.machine-section-heading,.machine-editor-actions { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; }

.machine-library-actions,.machine-editor-actions>div { display:flex; flex-wrap:wrap; gap:9px; }.machine-library-actions { flex-shrink:0; }

.machine-library label { display:flex; flex-direction:column; gap:7px; color:#536c4c; font-size:11px; font-weight:600; min-width:0; }
.machine-library input:not([type=checkbox]),.machine-library select { width:100%; min-width:0; min-height:39px; padding:8px 10px; border:1px solid #d7e0cf; border-radius:6px; color:var(--ink); background:#fff; font-size:12px; }
.machine-help { margin:9px 0; color:#66795e; font-size:11px; line-height:1.75; overflow-wrap:anywhere; }
.machine-link { padding:4px 0; border:0; background:none; color:var(--primary); font-size:11px; font-weight:600; text-decoration:underline; text-underline-offset:3px; cursor:pointer; }.machine-link.is-delete { color:#986150; margin-left:auto; }
.machine-library-cards { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(270px,100%),1fr)); gap:18px; margin-top:22px; }
.machine-card { padding:20px 20px 0; border:1px solid #dfe6da; border-radius:10px; background:#fff; min-width:0; }.machine-card h2 { font-size:17px; font-weight:600; margin:0 0 12px; overflow-wrap:anywhere; }.machine-card-ends { color:var(--ink); font-size:15px; margin:13px 0 4px; }.machine-card-actions { display:flex; flex-wrap:wrap; gap:19px; border-top:1px solid #edf0e8; margin-top:17px; padding:12px 0; }
.machine-empty { text-align:center; padding:60px 24px; border:1px solid var(--line); border-radius:12px; background:#fff; margin-top:24px; }.machine-empty h2 { font-size:23px; font-weight:550; margin:0; }.machine-empty p { color:var(--muted); font-size:12px; line-height:1.8; margin:13px 0 24px; }
.machine-editor { width:min(1100px,calc(100% - 40px)); max-width:none; max-height:calc(100dvh - 40px); margin:auto; padding:26px; overflow:auto; border:1px solid #d9e3d2; border-radius:13px; color:var(--ink); background:#fdfefb; box-shadow:0 24px 85px #17342630; }
.machine-editor::backdrop,.machine-confirm::backdrop { background:#1c302966; backdrop-filter:blur(3px); }.machine-editor-heading { margin-bottom:22px; }.machine-editor-heading .eyebrow { font-size:9px; margin-bottom:7px; }.machine-editor h2 { font-size:25px; letter-spacing:-.6px; margin:0; font-weight:600; }.machine-editor-heading .icon-button { font-size:24px; }.machine-name-field { max-width:540px; }
.machine-editor-top-actions { display:flex; align-items:center; gap:10px; flex-shrink:0; }
.machine-editor-top-actions .button { padding:9px 12px; white-space:nowrap; }
.machine-hook-preview { width:min(1240px,calc(100% - 32px)); max-width:none; max-height:calc(100dvh - 32px); margin:auto; padding:22px; overflow:auto; border:1px solid #d9e3d2; border-radius:13px; color:var(--ink); background:#fdfefb; box-shadow:0 24px 85px #17342630; }
.machine-hook-preview::backdrop { background:#1c302977; backdrop-filter:blur(3px); }
.machine-hook-preview-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.machine-hook-preview-heading h2 { margin:0; font-size:23px; font-weight:600; letter-spacing:-.4px; }
.machine-hook-preview-heading .icon-button { font-size:24px; flex-shrink:0; }
.machine-hook-preview-controls { display:flex; flex-wrap:wrap; justify-content:space-between; gap:12px; margin:14px 0; }
.machine-hook-preview-zoom, #machine-hook-preview-search { display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
.machine-hook-preview-controls .button { padding:9px 13px; min-height:38px; }
#machine-hook-preview-scale { min-width:85px; font-size:11px; color:var(--muted); text-align:center; }
#machine-hook-preview-go { width:100px; }
.machine-hook-preview-viewport { height:min(58dvh,620px); overflow:auto; position:relative; border:1px solid #dce4d5; border-radius:7px; background:#f4f6f0; overscroll-behavior:contain; }
#machine-hook-preview-space { position:relative; }
#machine-hook-preview-canvas { position:sticky; top:0; left:0; display:block; cursor:crosshair; }
.machine-hook-preview-detail { display:block; margin-top:14px; font-size:12px; line-height:1.7; overflow-wrap:anywhere; font-variant-numeric:tabular-nums; }
@media(max-width:700px) {
  .machine-hook-preview { width:calc(100% - 20px); max-height:calc(100dvh - 20px); padding:15px; }
  .machine-hook-preview-viewport { height:min(45dvh,400px); }
  .machine-editor-top-actions { gap:4px; }
  .machine-editor-top-actions .button { font-size:11px; padding:8px; }
}
.machine-section { margin-top:24px; padding-top:21px; border-top:1px solid var(--line); }.machine-section h3 { margin:0; font-size:14px; font-weight:600; }.machine-fields { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; margin-top:15px; }.machine-presets { display:flex; gap:12px; align-items:center; flex-wrap:wrap; margin:16px 0; font-size:11px; color:#66795e; }.machine-presets>div { display:flex; flex-wrap:wrap; gap:6px; }.machine-preset { font-size:10px; padding:6px 8px; background:#fff; color:var(--primary); border:1px solid #d7e0cf; border-radius:5px; }.machine-numbering { max-width:320px; }.machine-section-heading { align-items:center; }
.machine-table-scroll { max-width:100%; overflow:auto; margin:13px 0 9px; }.machine-library table { width:100%; border-collapse:collapse; font-size:11px; }.machine-library th,.machine-library td { text-align:left; padding:8px 7px; border-bottom:1px solid #e4eadf; white-space:nowrap; }.machine-library th { color:#65785e; font-size:10px; font-weight:600; }.machine-harness-table { min-width:885px; }.machine-harness-table td:first-child { min-width:143px; }.machine-harness-table input[type=number] { min-width:64px; padding:7px; }.machine-harness-table input[type=checkbox] { width:16px; height:16px; accent-color:var(--primary); margin:7px 10px; }.machine-controller-fields { grid-template-columns:repeat(3,minmax(0,1fr)); }.machine-map-scroll { overflow:auto; max-height:220px; padding:10px; background:#f0f3e9; border:1px solid #dce4d5; border-radius:6px; }.machine-map-scroll canvas { display:block; max-width:none; image-rendering:pixelated; }.machine-map-legend { color:#66795e; font-size:10px; line-height:1.8; margin:9px 0; }.machine-section details { font-size:11px; color:#536c4c; }.machine-section summary { cursor:pointer; }.machine-ranges { font-variant-numeric:tabular-nums; }.machine-ranges tbody { color:var(--ink); }
.machine-conflict { padding:12px 14px; border:1px solid #e7dab7; background:#fffbef; border-radius:8px; margin-top:14px; }.machine-conflict p { font-size:11px; line-height:1.75; color:#775e2c; }.machine-editor-actions { align-items:center; margin-top:23px; padding-top:18px; border-top:1px solid var(--line); }.machine-editor-actions>p { color:#7b7355; font-size:11px; }.machine-confirm { width:min(440px,calc(100% - 32px)); padding:26px; border:1px solid #dbe4d4; border-radius:12px; color:var(--ink); background:#fff; }.machine-confirm h2 { margin:0; font-size:21px; line-height:1.45; font-weight:600; overflow-wrap:anywhere; }.machine-confirm p { font-size:12px; line-height:1.8; color:var(--muted); margin:14px 0; }.machine-confirm .machine-library-actions { justify-content:flex-end; margin-top:24px; }.machine-danger { background:#a05140; border-color:#a05140; color:#fff; }

@media(max-width:700px){.machine-editor { width:calc(100% - 24px); max-height:calc(100dvh - 24px); padding:19px; }.machine-fields,.machine-controller-fields { grid-template-columns:repeat(2,minmax(0,1fr)); }.machine-section-heading { align-items:flex-start; flex-direction:column; gap:7px; }}
@media(max-width:400px){.machine-editor { padding:15px; }.machine-editor-actions { flex-direction:column; align-items:stretch; }.machine-editor-actions>div { justify-content:flex-end; }.machine-controller-fields { grid-template-columns:minmax(0,1fr); }}
.machine-card { display:flex; flex-direction:column; }
.machine-card > :not(.machine-card-actions):nth-last-child(2) { margin-bottom:17px; }
.machine-card-actions { margin-top:auto; }
.machine-card-actions .machine-link { text-decoration:none; }
.machine-card-actions .machine-link:hover { text-decoration:underline; }
.machine-library .topbar-search { display: block; }
.machine-library .topbar-search input { min-height: 0; height: 38px; padding: 0 12px 0 36px; border-color: var(--line); border-radius: 10px; background: #f8faf8; font-size: 13.5px; }
.machine-library-cards { margin-top: 0; }
/* Library cards match the project cards: no border, soft shadow, rounder corners. */
.machine-card { border: 0; border-radius: 14px; box-shadow: var(--card-shadow); }

/* Compact machine editor: tighter rhythm so the whole setup fits on fewer screens. */
.machine-editor { padding:18px 20px; }
.machine-editor-heading { margin-bottom:12px; align-items:center; }
.machine-editor h2 { font-size:20px; letter-spacing:-.4px; }
.machine-editor-heading .eyebrow { margin-bottom:3px; }
.machine-editor label { gap:4px; font-size:10.5px; }
.machine-editor input:not([type=checkbox]),.machine-editor select { min-height:32px; padding:5px 8px; }
.machine-editor .machine-help { margin:5px 0; line-height:1.5; }
.machine-editor .machine-section { margin-top:14px; padding-top:12px; }
.machine-editor .machine-section h3 { font-size:13px; }
.machine-editor .machine-fields { grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:8px 10px; margin-top:8px; }
/* The harness tie: how the body repeats on one row, the hooks set apart and ends per hook on the next. */
.machine-editor .machine-fields.machine-tie-fields { grid-template-columns:repeat(3,minmax(0,1fr)); }
@media(max-width:700px){ .machine-editor .machine-fields.machine-tie-fields { grid-template-columns:repeat(2,minmax(0,1fr)); } }
/* The loom form asks only hook counts, reed and pick: four fields to a row. */
.machine-library .machine-editor { width:min(820px,calc(100% - 40px)); }
.machine-editor .machine-presets { margin:9px 0; gap:8px; }
.machine-editor .machine-table-scroll { margin:8px 0 6px; }
.machine-editor th,.machine-editor td { padding:4px 6px; }
.machine-editor .machine-harness-table input[type=number] { padding:4px 6px; min-height:28px; }
.machine-editor .machine-harness-table input[type=checkbox] { margin:4px 8px; }
.machine-editor .machine-map-scroll { padding:6px; max-height:180px; }
.machine-editor .machine-map-legend { margin:5px 0; }
.machine-editor .machine-editor-actions { margin-top:14px; padding-top:12px; position:sticky; bottom:-18px; background:#fdfefb; padding-bottom:4px; }
.machine-name-field { max-width:420px; }
.machine-import-note { margin:10px 0 0; padding:8px 12px; color:#36553f; background:#f0f6ec; border:1px solid #d5e4cc; border-radius:7px; font-size:11px; line-height:1.55; overflow-wrap:anywhere; }

/* Looms page: profile list on the left, the selected profile's details and hook preview on the right. */
.machine-split { display:grid; grid-template-columns:minmax(220px,280px) minmax(0,1fr); gap:20px; align-items:start; }
.machine-split[hidden] { display:none; }
.machine-list-pane { position:sticky; top:12px; max-height:calc(100dvh - 140px); overflow:auto; padding:8px; border-radius:14px; background:#fff; box-shadow:var(--card-shadow); }
.machine-list { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:2px; }
.machine-list-item { display:flex; flex-direction:column; align-items:flex-start; gap:3px; width:100%; padding:10px 12px; border:0; border-radius:9px; background:none; color:var(--ink); text-align:left; cursor:pointer; }
.machine-list-item:hover { background:#f2f6ef; }
.machine-list-item[aria-current=true] { background:#e6efe1; box-shadow:inset 3px 0 0 var(--primary); }
.machine-list-name { font-size:13px; font-weight:600; overflow-wrap:anywhere; }
.machine-list-sub { font-size:11px; color:#66795e; font-variant-numeric:tabular-nums; }
.machine-detail { min-width:0; padding:20px 22px; border-radius:14px; background:#fff; box-shadow:var(--card-shadow); }
.machine-detail-head { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; flex-wrap:wrap; }
.machine-detail-head .eyebrow { font-size:9px; margin:0 0 4px; }
.machine-detail-head h2 { margin:0; font-size:22px; font-weight:600; letter-spacing:-.4px; overflow-wrap:anywhere; }
.machine-detail-head .machine-help { margin:4px 0 0; }
.machine-detail-actions { display:flex; flex-wrap:wrap; gap:8px; }
.machine-detail-actions .button { padding:8px 12px; min-height:36px; }
.machine-detail-actions .machine-delete { color:#a05140; }
.machine-detail-facts { display:grid; grid-template-columns:1fr 1.6fr 1fr; gap:14px; margin-top:16px; }
.machine-fact-group { padding:12px 14px; border:1px solid #e4eadf; border-radius:10px; background:#fbfcf9; min-width:0; }
.machine-fact-group h3 { margin:0 0 8px; font-size:12px; font-weight:600; }
.machine-fact-group dl { display:grid; grid-template-columns:repeat(auto-fill,minmax(120px,1fr)); gap:8px 14px; margin:0; }
.machine-fact dt { font-size:10px; color:#66795e; }
.machine-fact dd { margin:2px 0 0; font-size:13px; font-weight:600; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.machine-detail-preview { margin-top:18px; padding-top:14px; border-top:1px solid var(--line); }
.machine-detail-preview-heading { display:flex; align-items:baseline; gap:12px; flex-wrap:wrap; }
.machine-detail-preview-heading h3 { margin:0; font-size:14px; font-weight:600; }
.machine-detail-preview-heading .machine-help { margin:0; }
.machine-detail-preview .machine-hook-preview-controls { margin:10px 0; }
.machine-hook-space { position:relative; }
.machine-hook-canvas { position:sticky; top:0; left:0; display:block; cursor:crosshair; }
/* The inline preview is as tall as the hook grid; vertical wheel scrolls the page. */
.machine-detail-viewport { height:auto; min-height:120px; max-height:min(60dvh,520px); overscroll-behavior-x:contain; overscroll-behavior-y:auto; }
.machine-hook-search { display:flex; align-items:center; flex-wrap:nowrap; gap:8px; }
.machine-hook-search label { white-space:nowrap; }
.machine-hook-search label { flex-direction:row; align-items:center; }
#machine-detail-hooks-go { width:100px; }
#machine-detail-hooks-scale { min-width:85px; font-size:11px; color:var(--muted); text-align:center; }
.machine-map-legend .legend-item { display:inline-flex; align-items:center; gap:4px; margin-right:12px; white-space:nowrap; }
.machine-map-legend .swatch { display:inline-block; width:9px; height:9px; border-radius:50%; background:var(--c); }
@media(max-width:1100px) { .machine-detail-facts { grid-template-columns:1fr 1fr; } .machine-fact-group:last-child { grid-column:1 / -1; } }
@media(max-width:800px) {
  .machine-split { grid-template-columns:minmax(0,1fr); }
  .machine-list-pane { position:static; max-height:240px; }
  .machine-detail { padding:16px; }
  .machine-detail-facts { grid-template-columns:minmax(0,1fr); }
}
@media(max-width:700px) {
  .machine-import-formats,.machine-wide-label { display:none; }
  .machine-library .topbar-actions { gap:6px; }
}

/* EP import: choose the jacquard module's hook column height. */
.machine-height-options { display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:8px; margin:12px 0; }
.machine-library .machine-height-option { flex-direction:row; align-items:center; gap:8px; padding:9px 11px; border:1px solid #d7e0cf; border-radius:8px; color:var(--ink); font-size:12px; font-weight:500; cursor:pointer; }
.machine-height-option:has(input:checked) { border-color:var(--primary); background:#eef5ea; }
.machine-library .machine-height-option input[type=radio] { width:16px; height:16px; min-height:0; padding:0; flex:none; accent-color:var(--primary); margin:0; }
.machine-height-custom { max-width:200px; }
#machine-ep-height { width:min(520px,calc(100% - 32px)); }

/* Hook configuration editor: paint hooks by role on the circle grid. */
.machine-arranger { width:min(1240px,calc(100% - 32px)); }
.machine-arranger .eyebrow { font-size:9px; margin:0 0 4px; }
.machine-arrange-tools { display:flex; flex-wrap:wrap; align-items:center; gap:10px 16px; margin:14px 0 8px; }
.machine-arrange-roles { display:flex; flex-wrap:wrap; gap:6px; }
.machine-library .machine-arrange-role { flex-direction:row; align-items:center; gap:7px; padding:7px 11px; border:1px solid #d7e0cf; border-radius:999px; color:var(--ink); font-size:12px; font-weight:500; cursor:pointer; background:#fff; }
.machine-arrange-role:has(input:checked) { border-color:var(--primary); background:#eef5ea; box-shadow:inset 0 0 0 1px var(--primary); }
.machine-library .machine-arrange-role input { position:absolute; opacity:0; width:1px; height:1px; min-height:0; }
.machine-arrange-role:focus-within { outline:2px solid var(--primary); outline-offset:2px; }
.machine-arrange-role .swatch { display:inline-block; width:11px; height:11px; border-radius:50%; background:var(--c); }
.machine-library .machine-arrange-columns { flex-direction:row; align-items:center; gap:6px; font-size:12px; color:var(--ink); }
.machine-library .machine-arrange-columns input { width:16px; height:16px; min-height:0; accent-color:var(--primary); }
.machine-arrange-actions { display:flex; gap:6px; margin-left:auto; }
.machine-arrange-range { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:4px 0 6px; }
.machine-library .machine-arrange-range label { flex-direction:row; align-items:center; gap:6px; font-size:12px; color:var(--ink); }
.machine-library .machine-arrange-range input { width:96px; }
.machine-library .machine-arrange-range select { width:auto; }
.machine-arrange-viewport { height:min(46dvh,460px); }
.machine-arrange-counts { margin:10px 0 0; font-size:12px; color:var(--ink); font-variant-numeric:tabular-nums; }
.machine-arrange-discard { display:flex; flex-wrap:wrap; align-items:center; gap:8px; font-size:12px; }
.machine-arrange-discard[hidden] { display:none; }
.machine-arranger .machine-editor-actions { margin-top:12px; padding-top:12px; border-top:1px solid var(--line); }
.machine-warning-note { color:#775e2c; background:#fffbef; border-color:#e7dab7; }
@media(max-width:700px) { .machine-arrange-actions { margin-left:0; } .machine-arrange-viewport { height:min(40dvh,360px); } }
.machine-library .machine-hook-go { width:100px; }
.machine-hook-scale { min-width:85px; font-size:11px; color:var(--muted); text-align:center; }
.machine-hook-search label { flex-shrink:0; }
.machine-library .machine-hook-search input { flex:0 0 100px; width:100px; }
/* Hook ranges table in the hook editor. */
.machine-arrange-table { margin-top:12px; }
.machine-arrange-table h3 { margin:0 0 6px; font-size:13px; font-weight:600; }
.machine-arrange-table .machine-table-scroll { max-height:260px; overflow:auto; border:1px solid #e4eadf; border-radius:8px; margin:0; }
.machine-arrange-table table { font-variant-numeric:tabular-nums; }
.machine-arrange-table thead th { position:sticky; top:0; background:#f6f8f3; z-index:1; }
.machine-library .machine-arrange-table select { width:auto; min-height:28px; padding:3px 6px; }
.machine-arrange-side { margin-left:8px; color:var(--muted); font-size:11px; }
/* Saree setup opens the loom editor while the library page stays hidden: only its dialogs show. */
.machine-library[data-dialogs-only] { display:contents; }
.machine-library[data-dialogs-only] > :not(dialog) { display:none; }
/* Card viewer: an .EP or .JC5 file's header, hook lifts and control bits. */
.card-viewer .eyebrow { font-size:9px; margin:0 0 4px; }
.card-viewer-facts { display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:8px 14px; margin:14px 0 4px; padding:12px 14px; border:1px solid #e4eadf; border-radius:10px; background:#fbfcf9; }
.card-viewer-facts .machine-fact dd { font-size:12px; }
.card-viewer-scale { min-width:110px; font-size:11px; color:var(--muted); text-align:center; }
.card-viewer-viewport { height:min(52dvh,560px); }
.machine-library .card-viewer .machine-hook-search input { flex:0 0 110px; width:110px; }
.card-viewer-square { border-radius:2px !important; }
.card-viewer-tables { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr)); gap:12px 18px; margin-top:8px; }
.card-viewer-tables h3 { margin:0 0 6px; font-size:13px; font-weight:600; }
.card-viewer-tables .machine-table-scroll { max-height:260px; overflow:auto; margin:0; border:1px solid #e4eadf; border-radius:8px; }
.card-viewer-tables td:last-child { white-space:normal; }
.card-viewer-tables table { width:100%; border-collapse:collapse; font-size:12px; font-variant-numeric:tabular-nums; }
.card-viewer-tables :is(th,td) { padding:6px 9px; border-bottom:1px solid #edf0e8; text-align:left; }
.card-viewer-tables thead th { position:sticky; top:0; background:#f6f8f3; color:#536c4c; font-weight:600; }
.card-viewer-word { font-family:ui-monospace,SFMono-Regular,Consolas,monospace; white-space:nowrap; }
@media(max-width:700px) { .card-viewer-viewport { height:min(44dvh,380px); } .card-viewer .machine-editor-top-actions .button { font-size:11px; padding:8px; } }
