/* Presets studio, the Presets page (docs/studio/REMAKE.md 6.6; DESIGN 1.4.5): what the preset editor puts inside the
   shared frame. Loaded after the inline styles and studio.css, which owns the frame itself (the top bar, the left
   list, the part, its sections, markers, the save bar) and how a field looks on a card. Owned here, and all of it
   lives inside a section body, a part's notes or a window: .st-row, .st-field*, .st-item*, .st-lines, .st-line*
   and .st-ed-* (the small things the parts are made of). Tokens only, so both themes come through the variables. */

/* ── fields: label above, the control, one help line; two to a row ── */
.st-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 20px;align-items:start}
.st-row.st-row3{grid-template-columns:repeat(3,minmax(0,1fr))}
.st-field{min-width:0}
/* the field's name (a tick-box row inside a field is a label too: it keeps its own layout) */
.st-field > label:not(.st-field-toggle){display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:7px}
.st-field textarea{min-height:68px;line-height:1.5;resize:vertical}
.st-field .range-row{min-height:40px}                           /* as tall as the field beside it */
.st-field-mono{font-family:var(--font-mono);font-size:12px}
textarea.st-field-mono{min-height:220px;line-height:1.5}
.st-field-pct{min-width:44px}
.st-field-toggle{margin:8px 0;font-size:13.5px}
.st-field-toggle input{margin-top:2px;accent-color:var(--accent)}
.st-modal-body .st-field > label{margin-top:0}
.st-modal-body label.st-field-toggle{margin:7px 0}

/* ── lists: an item is a card with a header strip (its name and the quiet facts, its tools at the right) ── */
.st-item-list{display:flex;flex-direction:column;gap:10px}
.st-item-list > .st-add{align-self:flex-start;margin-top:0}
.st-item-list > .st-err{margin-top:0}
.st-item-empty{padding:18px 14px;border:1px dashed var(--border-hover);border-radius:10px;text-align:center;font-size:13px;color:var(--muted)}
.st-item{min-width:0;border:1px solid var(--border-hover);border-radius:10px;background:var(--surface)}
.st-item.st-item-bad{border-color:var(--red)}
.st-item-head{display:flex;align-items:center;gap:6px;min-height:44px;padding:0 8px 0 4px;border-radius:9px;background:var(--surface2)}
.st-item.open > .st-item-head{border-bottom:1px solid var(--border);border-radius:9px 9px 0 0}
.st-item-toggle{display:flex;align-items:center;gap:9px;flex:1;min-width:0;min-height:44px;padding:0 8px;border:0;border-radius:7px;
  background:transparent;color:var(--text);font:600 14px/1.3 var(--font-ui);text-align:left;cursor:pointer}
.st-item-toggle:focus-visible,.st-item-copy:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
.st-item-caret{flex-shrink:0;width:7px;height:7px;margin:0 4px 0 3px;border:solid var(--muted);border-width:0 1.5px 1.5px 0;
  transform:rotate(-45deg);transition:transform .15s ease}
.st-item.open > .st-item-head .st-item-caret{transform:rotate(45deg) translate(-2px,-2px)}
/* its place in the order, where the order is what she follows (stages, follow-ups) */
.st-item-n{flex-shrink:0;min-width:20px;height:20px;padding:0 5px;border-radius:6px;background:var(--bg);color:var(--muted);
  font:600 12px/20px var(--font-ui);font-variant-numeric:tabular-nums;text-align:center}
.st-item-title{min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.st-item-tags{display:inline-flex;gap:6px;flex-shrink:0}
.st-item-meta{flex-shrink:0;margin-left:auto;padding-left:10px;font-size:12.5px;font-weight:400;color:var(--muted2);white-space:nowrap}
.st-item-tags:empty,.st-item-meta:empty,.st-item-tools:empty{display:none}
.st-item-tools{display:flex;align-items:center;gap:4px;flex-shrink:0}
.st-item-copy{padding:6px 8px;border:0;border-radius:7px;background:transparent;color:var(--muted);font:500 12.5px var(--font-ui);cursor:pointer}
.st-item-copy:hover{color:var(--text)}
.st-item-body{display:flex;flex-direction:column;gap:16px;padding:16px}
.st-item-err{margin:0;padding:8px 14px 0}
/* a one-line item (a link): no card, no fold */
.st-item-flat,.st-item-flat.st-item-bad{border:0;border-radius:0;background:none}
.st-item-flat-row{display:flex;align-items:flex-start;gap:8px}
.st-item-flat .st-item-body{flex:1;min-width:0;padding:0}
.st-item-flat .st-item-tools{padding-top:6px}
.st-item-flat .st-item-err{padding:0;margin-top:5px}

/* a message sequence: one field per bubble, a text area of one row that grows with its words (fields.js fits its
   height), as tall as a one-line field while the line is short. The number and the tools stand by its first row. */
.st-lines{display:flex;flex-direction:column;gap:6px}
.st-line{display:flex;align-items:flex-start;gap:6px}
textarea.st-line-text{min-height:40px;padding-top:8.5px;padding-bottom:8.5px;line-height:1.5;resize:none;overflow-y:auto;
  overflow-wrap:anywhere}
.st-line textarea.st-line-text{flex:1;min-width:0}
.st-line-n{flex-shrink:0;width:16px;font-size:12px;line-height:40px;color:var(--muted2);text-align:right;font-variant-numeric:tabular-nums}
.st-line-tools{display:flex;gap:4px;flex-shrink:0;padding-top:6px}
.st-line-opt{margin:-2px 0 4px 22px}
.st-line-opt .st-field-toggle{margin:2px 0;font-size:12.5px;color:var(--muted)}
.st-line-add{align-self:flex-start;margin-top:2px;padding:6px 10px}
.st-lines > .st-err{margin:0 0 0 22px}
.st-lines > .st-help{margin-top:2px}
.st-lines > .st-item-empty{padding:12px;font-size:12.5px}

/* ── the small things the parts are made of ── */
/* notes above the two columns sit as they come; an empty holder takes no room */
.st-ed-notes:empty{display:none}
/* "Still missing", then each missing thing as a way to its field */
.st-ed-need{display:flex;align-items:center;gap:8px 12px;flex-wrap:wrap}
/* a part that could not be drawn: its note keeps the part's own margins */
.st-ed-broken{padding:20px 24px}
.st-ed-broken > .st-banner{margin-bottom:0}
/* round tabs inside a section: the section's own gap follows them */
.st-sec-body > .st-ed-tabs{margin-bottom:0}
.st-ed-tabs .tag{margin-left:2px}
/* a round that is not open and holds a field that needs a look */
.st-ed-tab-bad::after{content:'';display:inline-block;width:6px;height:6px;margin-left:6px;border-radius:50%;background:var(--red);
  vertical-align:middle}
.st-ed-inline{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.st-ed-value{font-size:14px;color:var(--text)}
.st-ed-muted{font-size:12.5px;line-height:1.5;color:var(--muted2)}
.st-ed-text{max-width:640px;font-size:13.5px;line-height:1.55;color:var(--muted)}
.st-ed-id{font-family:var(--font-mono);font-size:12.5px;color:var(--muted)}
/* what a locked answer always does, said under it */
.st-ed-note{padding:9px 12px;border-radius:8px;background:var(--surface2);font-size:12.5px;line-height:1.45;color:var(--muted)}
/* a quiet text action: muted like the other secondary actions (blue is a status colour on this dashboard) */
.st-ed-link{align-self:flex-start;flex-shrink:0;padding:0;border:0;background:transparent;color:var(--muted);
  font:500 12.5px var(--font-ui);cursor:pointer}
.st-ed-link:hover{color:var(--text);text-decoration:underline}
.st-ed-chip{align-self:flex-start;font-family:var(--font-ui)}
.st-ed-link:focus-visible,.st-ed-chip:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
/* a model she runs with: her name and what she has, the way to her photos at the right */
.st-ed-model{display:flex;align-items:center;justify-content:space-between;gap:12px 16px;flex-wrap:wrap;padding:12px 14px;
  border:1px solid var(--border-hover);border-radius:10px}
.st-ed-model-text{min-width:0;flex:1 1 260px}
.st-ed-model-name{margin-bottom:2px;font-size:14px;font-weight:600;color:var(--text)}
/* windows: New preset, Rename, Add a model */
.st-ed-form{display:flex;flex-direction:column;gap:14px}
.st-ed-ticks{max-height:190px;overflow-y:auto;padding:4px 12px;border:1px solid var(--border-hover);border-radius:8px;background:var(--bg)}

/* ── narrower screens ── */
@media (max-width:768px){
  .st-row,.st-row.st-row3{grid-template-columns:minmax(0,1fr)}
  .st-item-meta{display:none}
  .st-item-body{padding:14px 12px}
  .st-ed-broken{padding:16px}
}
/* thumb targets (a phone, and a touch screen of any width; studio.css has the same block for the frame). A line is as
   tall as the base's 44px field and its tools are 44px buttons. The tools of an item keep their look and take the tap
   over 44 x 44px, with room between them so two never share a tap; "Duplicate", the quiet links and the chip take it
   over 44px of height; a tick-box row is 44px high, as the base makes it on a phone. */
@media (max-width:768px),(pointer:coarse){
  textarea.st-line-text{min-height:44px;padding-top:9px;padding-bottom:9px}
  .st-line-n{line-height:44px}
  .st-line-tools{padding-top:0}
  .st-line-tools .st-icon-btn{width:44px;height:44px}
  .st-item-tools{gap:18px}
  .st-item-tools .st-icon-btn::after{inset:min(0px,calc((100% - 44px) / 2))}
  .st-item-copy,.st-ed-link,.st-ed-chip{position:relative}
  .st-item-copy::after,.st-ed-link::after,.st-ed-chip::after{content:'';position:absolute;inset:min(0px,calc((100% - 44px) / 2)) 0}
  .st-item-flat .st-item-tools{padding-top:8px}
  label.st-field-toggle{min-height:44px;padding:13px 0}
  .st-line-opt .st-field-toggle{margin:0}
}
/* a phone: the words of a line get the whole width. Its tools go on a row of their own under it, Remove at the far end
   from the arrows; the tools of an item drop under its name when the two do not fit side by side. The round tabs
   stay one row that scrolls sideways (parts.js keeps the open one in view); the hairline is drawn inside the row,
   so the open tab's line still sits on it. */
@media (max-width:520px){
  .st-line-n{display:none}
  .st-lines{gap:12px}                                         /* a line and its tools (6px apart) read as one */
  .st-line{flex-wrap:wrap}
  .st-line textarea.st-line-text{flex:1 1 100%}
  .st-line-tools{flex:1 1 100%;gap:8px}
  .st-line-tools .st-icon-btn.danger{margin-left:auto}
  .st-item-head{flex-wrap:wrap}
  .st-item-toggle{flex:1 1 170px}
  .st-item-tools{min-height:44px;margin-left:auto}
  .pool-tabs.st-ed-tabs{flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;border-bottom:0;
    box-shadow:inset 0 -1px 0 var(--border)}
  .pool-tabs.st-ed-tabs::-webkit-scrollbar{display:none}
  .st-ed-tabs .st-tab{flex:none;margin-bottom:0;padding:10px 12px;white-space:nowrap}
  .st-line-opt,.st-lines > .st-err{margin-left:0}
  /* an item's name is what tells it from the next one: it takes two lines before it is cut, and the "Special" tag
     of a row steps aside (the tag beside the section title stays) */
  .st-item-title{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;white-space:normal;overflow-wrap:anywhere;
    line-height:1.35;text-align:left}
  .st-item-head .st-item-tags{display:none}
  .st-item-toggle{padding:6px 8px}
}
