.project-editor {
  min-width: 0;
  color: var(--ink);
  --pe-gap: clamp(12px, 2vw, 20px);
  --pe-radius: 15px;
  scroll-margin-top: 12px;
}
.project-editor :where(button, input, select, textarea, fieldset) { font: inherit; }
.project-editor :where(input, select, textarea) {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 9px;
  padding: 7px 10px;
  min-height: 42px;
  line-height: 1.3;
}
.project-editor textarea { resize: vertical; }
.project-editor .cab-glyph { width: 19px; height: 19px; flex-shrink: 0; }
.project-editor :is(button,a,input,select,textarea,summary):focus-visible {
  outline: 2px solid var(--cab-accent-text); outline-offset: 2px;
}
.project-editor [hidden] { display: none !important; }
.project-editor :disabled { opacity: .58; }
.pe-top { display: grid; justify-items: start; gap: 3px; margin-bottom: var(--pe-gap); }
.pe-top h1 { font-size: clamp(25px, 3.2vw, 36px); line-height: 1.13; letter-spacing: -.035em; }
.pe-form,.pe-controls { display: grid; gap: var(--pe-gap); min-width: 0; }
.pe-controls { margin: 0; padding: 0; border: 0; }
.pe-panel {
  display: grid; min-width: 0; gap: 12px;
  padding: var(--pe-gap); border: 1px solid var(--line-soft);
  border-radius: var(--pe-radius); background: var(--surface);
}
.pe-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pe-panel-head h2,.pe-panel-head h3,.pe-event > summary {
  display: flex; align-items: center; gap: 9px;
  font-size: 18px; font-weight: 670; line-height: 1.2; letter-spacing: -.018em;
}
.pe-panel-head h3 { font-size: 16px; }
.pe-panel-head h2 svg, .pe-event > summary > .cab-glyph:first-child { color: var(--cab-accent-text); }
.pe-count,.pe-muted,.pe-line-price,.pe-total-label { color: var(--muted); font-size: 14px; line-height: 1.35; }
.pe-count { white-space: nowrap; }
.pe-lines,.pe-results { list-style: none; margin: 0; padding: 0; }
.pe-line { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.pe-line:first-child { padding-top: 3px; border: 0; }
.pe-line:last-child { padding-bottom: 0; }
.pe-line-head,.pe-line-tools { display: flex; align-items: center; gap: 9px; min-width: 0; flex-wrap: wrap; }
.pe-line-head { flex-wrap: nowrap; align-items: flex-start; }
.pe-thumb { width: 41px; height: 41px; flex: 0 0 41px; object-fit: cover; border-radius: 8px; background: var(--surface-soft); }
.pe-copy { display: grid; min-width: 0; flex: 1; gap: 2px; align-self: center; }
.pe-copy > strong,.pe-pick { overflow-wrap: anywhere; }
.pe-copy strong { font-weight: 630; font-size: 16px; line-height: 1.23; }
.pe-copy .pe-muted { font-size: 13px; }
.pe-text,.pe-icon,.pe-step,.pe-add,.pe-save,.pe-pick {
  display: inline-flex; justify-content: center; align-items: center; gap: 6px;
  cursor: pointer; border: 0; border-radius: 9px;
  font-weight: 580; color: var(--ink); line-height: 1.15;
}
.pe-text { min-height: 40px; background: transparent; color: var(--cab-accent-text); padding: 3px 6px; font-size: 14px; }
.pe-back { color: var(--muted); padding-left: 0; }
.pe-icon,.pe-step { min-height: 40px; min-width: 36px; padding: 4px; background: transparent; color: var(--muted); }
.pe-icon:hover,.pe-text:hover,.pe-step:hover,.pe-pick:hover { background: var(--surface-soft); color: var(--ink); }
.pe-remove { justify-self: end; margin-left: auto; }
.pe-quantity {
  display: grid; grid-template-columns: 32px minmax(37px,49px) auto 32px; align-items: center;
  border-radius: 9px; border: 1px solid var(--line-soft); background: var(--surface-soft);
}
.pe-unit { color: var(--muted); font-size: 12px; margin-inline: 2px 4px; }
.pe-quantity .pe-step { min-width: 0; min-height: 42px; padding: 3px; }
.pe-quantity .cab-glyph { width: 16px; height: 16px; }
.pe-quantity input { appearance: textfield; -moz-appearance: textfield; border: 0; padding: 5px 0; text-align: center; border-radius: 0; background: transparent; min-height: 36px; font-weight: 650; }
.pe-quantity input::-webkit-inner-spin-button,.pe-quantity input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.pe-line-price { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; }
.pe-settings { margin-left: auto; font-size: 13px; }
.pe-settings svg { width: 16px !important; height: 16px !important; }
.pe-line-options { padding: 12px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--surface-soft); }
.pe-fields,.pe-picker-filters { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,180px),1fr)); gap: 10px 12px; min-width: 0; }
.pe-field,.pe-dates { display: grid; gap: 4px; min-width: 0; }
.pe-field > span { color: var(--muted); font-size: 13px; font-weight: 570; line-height: 1.3; }
.pe-wide { grid-column: 1/-1; }
.pe-dates { justify-items: start; }
.pe-date-list { display: grid; gap: 6px; width: 100%; }
.pe-date { display: flex; gap: 6px; align-items: end; }
.pe-date label { flex: 1; }
.pe-event > summary { cursor: pointer; list-style: none; min-height: 38px; }
.pe-event > summary::-webkit-details-marker { display: none; }
.pe-event > summary > .cab-glyph:last-child { margin-left: auto; color: var(--muted); }
.pe-event[open] > summary { margin-bottom: 12px; }
.pe-event[open] > summary > .cab-glyph:last-child { transform: rotate(90deg); }
.pe-add { justify-self: start; min-height: 44px; padding: 9px 14px; color: var(--cab-accent-text); background: var(--cab-highlight); border: 1px solid var(--cab-highlight-line); }
.pe-picker { border: 1px solid var(--cab-highlight-line); background: var(--surface-soft); border-radius: 12px; padding: 12px; display: grid; gap: 9px; }
.pe-results li+li { border-top: 1px solid var(--line-soft); }
.pe-pick { width: 100%; min-height: 46px; padding: 5px 2px; text-align: start; justify-content: flex-start; background: transparent; font-size: 15px; }
.pe-pick > span:not(.cab-glyph) { flex: 1; min-width: 0; }
.pe-pick .pe-thumb { width: 32px; height: 32px; flex-basis: 32px; }
.pe-undo { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 9px; color: var(--muted); font-size: 14px; }
.pe-approval,.pe-error,.pe-status,.pe-state,.pe-empty { padding: 4px 0; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.4; }
.pe-error { color: var(--danger, #d85757); }
.pe-footer {
  position: sticky; bottom: 10px; z-index: 4;
  display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 9px var(--pe-gap);
  box-shadow: 0 3px 12px rgb(0 0 0 / 8%);
}
.pe-total { display: grid; gap: 1px; }
.pe-total strong { font-size: clamp(19px,2.2vw,24px); line-height: 1.15; font-variant-numeric: tabular-nums; }
.pe-total-label { font-size: 12px; }
.pe-save { min-height: 44px; padding: 9px 16px; background: var(--lime); color: var(--accent-ink); }
.pe-save:disabled { opacity: .6; cursor: default; }
@media (max-width: 739px) {
  .pe-footer { bottom: calc(62px + env(safe-area-inset-bottom)); }
  .project-editor :where(input, select, textarea) { font-size: 16px; }
  .pe-top h1 { font-size: 25px; }
  .pe-settings { margin-left: 0; }
  .pe-panel { gap: 9px; }
  .pe-line-tools { gap: 5px 8px; }
}
@media (max-width: 419px) {
  .pe-line-tools { display: grid; grid-template-columns: auto minmax(0,1fr); }
  .pe-quantity { grid-row: 1; }
  .pe-settings { grid-row: 1; justify-self: end; }
  .pe-line-price:empty { display: none; }
  .pe-line-price { grid-column: 1/-1; }
  .pe-add { width: 100%; }
}

.pe-event-rows { display: grid; gap: 0 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%,260px), 1fr)); min-width: 0; }
.pe-event-field { min-width: 0; border-top: 1px solid var(--line-soft); }
.pe-event-field > summary {
  display: grid; grid-template-columns: minmax(0,1fr) 16px; gap: 1px 12px; min-height: 44px;
  align-content: center; padding: 6px 0; cursor: pointer; list-style: none;
}
.pe-event-field > summary::-webkit-details-marker { display: none; }
.pe-event-label { color: var(--muted); font-size: 13px; }
.pe-event-value { grid-column: 1; font-size: 15px; font-weight: 550; overflow-wrap: anywhere; white-space: pre-line; }
.pe-event-field > summary .cab-glyph { width: 15px; height: 15px; grid-area: 1/2/span 2/3; align-self: center; color: var(--muted); }
.pe-event-field[open] > summary { color: var(--cab-accent-text); }
.pe-event-field[open] > summary .pe-event-value { display: none; }
.pe-event-field[open] > :last-child { margin-bottom: 9px; }
