/* Trim Shop — schedule dashboard + elevation callouts */

.trim-shop-root {
  --ts-bg: #0b1220;
  --ts-panel: #111827;
  --ts-line: #334155;
  --ts-text: #e2e8f0;
  --ts-muted: #94a3b8;
  --ts-teal: #14b8a6;
  --ts-amber: #f59e0b;
  color: var(--ts-text);
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  height: 100%;
}

.trim-shop-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid var(--ts-line);
  padding-bottom: 4px;
  flex-shrink: 0;
}

.trim-shop-tabs button {
  appearance: none;
  border: 1px solid var(--ts-line);
  background: #0f172a;
  color: var(--ts-muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.trim-shop-tabs button:hover {
  color: var(--ts-text);
  border-color: #475569;
}

.trim-shop-tabs button.active {
  background: #134e4a;
  border-color: var(--ts-teal);
  color: #ccfbf1;
}

.trim-shop-tabs button[hidden] {
  display: none !important;
}

.trim-shop-panel {
  display: none;
}

.trim-shop-panel.active {
  display: block;
}

.trim-shop-panel.trim-shop-workspace.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  gap: 4px;
}

/* All Profiles: fill remaining viewport and scroll the catalog */
.trim-shop-panel[data-view="profiles"].active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

#trim-shop-profiles-slot {
  flex: 1 1 auto;
  min-height: 12rem;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: 1rem;
}

#page-trim.trim-shop-profiles-active {
  overflow: hidden;
}

#page-trim.trim-shop-profiles-active .trim-shop-page-head {
  flex-shrink: 0;
}

#page-trim.trim-shop-profiles-active #trim-shop-mount,
#page-trim.trim-shop-profiles-active #trim-shop-shell,
#page-trim.trim-shop-profiles-active .trim-shop-root {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#trim-shop-shell {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}

.trim-shop-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 0;
  flex-shrink: 0;
}

.trim-shop-toolbar .hint {
  font-size: 0.68rem;
  color: var(--ts-muted);
  flex: 1 1 12rem;
  line-height: 1.3;
}

/* —— Split workspace: narrow schedule (~1/9) | elevations + editor —— */
.trim-shop-split {
  display: grid;
  /* Was 1:2 (~⅓). Reduce schedule width by ⅔ → ~1/9 of the split (1:8). */
  grid-template-columns: minmax(9.5rem, 1fr) minmax(0, 8fr);
  gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
}

@media (max-width: 1100px) {
  .trim-shop-split {
    grid-template-columns: 1fr;
    overflow: auto;
  }
}

.trim-shop-split-left,
.trim-shop-split-right {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ts-line);
  border-radius: 10px;
  background: var(--ts-panel);
  overflow: hidden;
}

.trim-shop-pane-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--ts-line);
  background: #0f172a;
  flex-shrink: 0;
}

.trim-shop-pane-head h3 {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5eead4;
}

.trim-shop-pane-head .muted {
  font-size: 0.62rem;
  color: var(--ts-muted);
}

.trim-shop-elev-head {
  gap: 4px 10px;
}

.trim-shop-elev-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-left: auto;
}

.trim-shop-elev-tabs button {
  appearance: none;
  border: 1px solid #334155;
  background: #0b1220;
  color: #94a3b8;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 5px;
  cursor: pointer;
  line-height: 1.2;
}

.trim-shop-elev-tabs button:hover {
  color: #e2e8f0;
  border-color: #475569;
}

.trim-shop-elev-tabs button.active {
  background: #134e4a;
  border-color: #14b8a6;
  color: #ccfbf1;
}

.trim-shop-split-left .trim-shop-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.trim-shop-split-right {
  gap: 0;
}

.trim-shop-elev-pane {
  flex: 0 0 42%;
  max-height: 42%;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--ts-line);
  min-height: 0;
}

.trim-shop-profile-pane {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.trim-shop-table-wrap {
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--ts-line);
  border-radius: 10px;
  background: var(--ts-panel);
}

.trim-shop-schedule-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
}

.trim-shop-line {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  border: 1px solid #1e293b;
  border-radius: 8px;
  background: #0b1220;
  cursor: pointer;
  min-width: 0;
}

.trim-shop-line:hover {
  border-color: #334155;
  background: rgba(20, 184, 166, 0.04);
}

.trim-shop-line.selected {
  border-color: #0f766e;
  background: rgba(20, 184, 166, 0.12);
  box-shadow: inset 0 0 0 1px rgba(20, 184, 166, 0.35);
}

.trim-shop-line-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "code del"
    "qty len";
  align-items: center;
  gap: 4px 6px;
  min-width: 0;
}

.trim-shop-line-head .code-cell { grid-area: code; }
.trim-shop-line-head > button { grid-area: del; justify-self: end; }
.trim-shop-line-head .trim-shop-mini:nth-of-type(1) { grid-area: qty; }
.trim-shop-line-head .trim-shop-mini:nth-of-type(2) { grid-area: len; }

.trim-shop-line .code-cell {
  font-family: ui-monospace, Consolas, monospace;
  font-weight: 800;
  color: #5eead4;
  white-space: nowrap;
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trim-shop-mini {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  color: var(--ts-muted);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.trim-shop-mini input {
  width: 100%;
  min-width: 0;
  max-width: 4.5rem;
}

.trim-shop-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.trim-shop-field > span {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ts-muted);
}

.trim-shop-line select,
.trim-shop-line input[type="text"],
.trim-shop-line input[type="number"],
.trim-shop-line textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  background: #111827;
  border: 1px solid #475569;
  color: var(--ts-text);
  border-radius: 6px;
  padding: 5px 7px;
  font-size: 0.74rem;
  box-sizing: border-box;
}

.trim-shop-line textarea {
  resize: vertical;
  min-height: 2.4rem;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.trim-shop-line select {
  text-overflow: ellipsis;
}

.trim-shop-color {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.trim-shop-color select {
  flex: 1 1 auto;
  min-width: 0;
}

.trim-shop-swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid #64748b;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.trim-shop-walls {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.trim-shop-walls label {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.58rem;
  color: var(--ts-muted);
  background: #0b1220;
  border: 1px solid #334155;
  border-radius: 999px;
  padding: 1px 5px;
  cursor: pointer;
}

.trim-shop-walls label.on {
  color: #ccfbf1;
  border-color: #0f766e;
  background: #134e4a;
}

.trim-shop-walls input {
  accent-color: #14b8a6;
}

.trim-shop-elev-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 4px;
  overflow: hidden;
  background: #0b1220;
  flex: 1 1 auto;
  min-height: 0;
}

.trim-shop-elev-card {
  background: #111827;
  border: 1px solid #1e293b;
  border-radius: 6px;
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.trim-shop-elev-card.is-focused {
  border-color: #334155;
}

.trim-shop-elev-card h3 {
  margin: 0;
  padding: 2px 8px;
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #5eead4;
  border-bottom: 1px solid #1e293b;
  background: #0f172a;
  flex-shrink: 0;
}

.trim-shop-elev-card .sheet {
  background: #fff;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.trim-shop-elev-card svg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.trim-shop-active-meta {
  font-size: 0.72rem;
  color: var(--ts-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.trim-shop-active-meta .code {
  font-family: ui-monospace, Consolas, monospace;
  font-weight: 800;
  color: #5eead4;
}

.trim-shop-active-profile {
  flex: 1 1 auto;
  min-height: 0;
  background: #0b1220;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.trim-shop-edit-slot {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.trim-shop-profile-fallback {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  background: #fff;
}

.trim-shop-profile-fallback svg {
  width: 100%;
  height: auto;
  display: block;
}

.trim-shop-profile-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: #64748b;
  font-size: 0.85rem;
  background: #fff;
  min-height: 8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Inline profile editor inside workspace (not Custom Trim branding) */
.trim-shop-inline-editor.custom-trim-addon-host,
.trim-shop-edit-slot .custom-trim-addon-host {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.trim-shop-inline-editor.trim-drawings-root.custom-trim-addon,
.trim-shop-edit-slot .trim-drawings-root.custom-trim-addon {
  height: 100%;
  min-height: 0;
}

.trim-shop-inline-editor .custom-trim-addon-intro,
.trim-shop-edit-slot .custom-trim-addon-intro,
.shop-profile-editor .custom-trim-addon-intro {
  display: none !important;
}

/* Profile Editor: teal tools (not amber Custom Trim) */
.shop-profile-editor .plugin-panel-label {
  background: #0f172a !important;
  border-bottom-color: #0f766e !important;
}

.trim-shop-inline-editor .custom-trim-addon-shell,
.trim-shop-edit-slot .custom-trim-addon-shell {
  height: 100%;
  min-height: 0;
  padding: 0;
}

.trim-shop-inline-editor .custom-trim-addon-panel,
.trim-shop-edit-slot .custom-trim-addon-panel {
  height: 100%;
  min-height: 0;
  border-radius: 0;
  border: 0;
}

.trim-shop-inline-editor .plugin-pane.active,
.trim-shop-edit-slot .plugin-pane.active {
  height: 100%;
  min-height: 0;
}

.trim-shop-inline-editor .canvas-wrap,
.trim-shop-edit-slot .canvas-wrap {
  flex: 1 1 auto;
  min-height: 8rem;
}

.trim-shop-inline-editor .draw-tools,
.trim-shop-edit-slot .draw-tools {
  max-height: 7.5rem;
  overflow: auto;
}

/* Catalog schedule edits → Profile editor chrome (not amber Custom Trim add-on) */
.trim-shop-inline-editor .plugin-panel-label,
.trim-shop-edit-slot .plugin-panel-label,
.shop-profile-editor .plugin-panel-label {
  background: #0f172a !important;
  color: transparent !important;
  border-bottom: 2px solid #0f766e !important;
  letter-spacing: 0.06em;
  font-size: 0 !important;
  line-height: 0 !important;
  padding: 10px 8px !important;
  position: relative;
}

/* Force visible "Profile editor" even if JS label text is still "Custom trim add-on" */
.trim-shop-inline-editor .plugin-panel-label::before,
.trim-shop-edit-slot .plugin-panel-label::before,
.shop-profile-editor .plugin-panel-label::before {
  content: "Profile editor";
  font-size: 0.78rem;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5eead4;
}

/* Hide Custom Trim intro / Done→Trim Drawings copy inside the workspace editor */
.trim-shop-inline-editor .hint:not(#custom-addon-save-status),
.trim-shop-edit-slot .hint:not(#custom-addon-save-status),
.shop-profile-editor .hint:not(#custom-addon-save-status) {
  display: none !important;
}

.trim-shop-inline-editor.shop-profile-editor .plugin-pane.custom-theme .mode-toggle button.active,
.trim-shop-edit-slot .shop-profile-editor .plugin-pane.custom-theme .mode-toggle button.active,
.shop-profile-editor .plugin-pane.custom-theme .mode-toggle button.active {
  background: #0f766e;
  border-color: #14b8a6;
  color: #ecfdf5;
}

.trim-shop-inline-editor.shop-profile-editor .btn-done,
.trim-shop-edit-slot .shop-profile-editor .btn-done,
.shop-profile-editor .btn-done {
  background: #0f766e;
  border-color: #14b8a6;
  color: #ecfdf5;
}

/* Custom Trim tab keeps amber branding */
.trim-shop-custom-slot .plugin-panel-label,
.shop-custom-trim:not(.trim-shop-inline-editor):not(.shop-profile-editor) .plugin-panel-label {
  background: #451a03 !important;
  color: #fde68a !important;
  border-bottom: 2px solid #f59e0b !important;
  font-size: 0.78rem !important;
  line-height: 1.25 !important;
}

.trim-shop-custom-slot .plugin-panel-label::before,
.shop-custom-trim:not(.trim-shop-inline-editor):not(.shop-profile-editor) .plugin-panel-label::before {
  content: none;
}

.trim-shop-line button,
.trim-shop-actions button,
.trim-shop-toolbar button {
  appearance: none;
  border: 1px solid #475569;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 7px;
  cursor: pointer;
}

.trim-shop-line button,
.trim-shop-actions button {
  padding: 4px 8px;
}

.trim-shop-line button.danger {
  flex: 0 0 auto;
  line-height: 1;
  min-width: 1.7rem;
}

.trim-shop-toolbar button.primary {
  background: #0f766e;
  border-color: #14b8a6;
  color: #ecfdf5;
}

.trim-shop-toolbar button.danger,
.trim-shop-line button.danger,
.trim-shop-actions button.danger {
  background: #7f1d1d;
  border-color: #b91c1c;
  color: #fecaca;
}

.trim-shop-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--ts-muted);
  font-size: 0.85rem;
}

/* Profiles gallery lives inside the Profiles panel after mount */
.trim-shop-profiles-host,
.trim-shop-profiles-park {
  margin-top: 0 !important;
}

#trim-shop-profiles-slot .trim-drawings-root,
.trim-shop-panel[data-view="profiles"] .trim-drawings-root {
  display: block !important;
  margin-top: 0;
  min-height: 0;
}

#trim-shop-profiles-slot .trim-drawings-root[hidden],
.trim-shop-panel[data-view="profiles"] .trim-drawings-root[hidden] {
  display: block !important;
}

.trim-shop-custom-panel.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}

.trim-shop-custom-slot {
  flex: 1 1 auto;
  min-height: 22rem;
  display: flex;
  flex-direction: column;
}

.trim-shop-custom-host {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* When Custom Trim section is open, Trim Shop page fills the viewport */
#page-trim.trim-shop-custom-active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 0.75rem 1rem 0.5rem;
}

#page-trim.trim-shop-custom-active > .flex.flex-wrap.items-start,
#page-trim.trim-shop-custom-active > [role="note"] {
  display: none;
}

#page-trim.trim-shop-custom-active #trim-shop-mount {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#page-trim.trim-shop-custom-active #trim-shop-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#page-trim.trim-shop-custom-active .trim-shop-tabs {
  flex-shrink: 0;
}

/* —— Snug page chrome: reclaim vertical space for elevations + editor —— */
#page-trim {
  padding: 0.35rem 0.55rem 0.4rem !important;
}

#page-trim .trim-shop-page-head {
  margin-bottom: 0.2rem !important;
  gap: 0.35rem !important;
  padding-top: 0;
}

#page-trim .trim-shop-page-head h2 {
  font-size: 1.05rem !important;
  line-height: 1.15 !important;
}

#page-trim .trim-shop-page-head > div.min-w-0 > p.text-xs {
  display: none;
}

#page-trim .trim-shop-page-head #trim-sheet-count {
  margin-top: 0;
  line-height: 1.2;
}

#page-trim .trim-shop-page-head .field label {
  margin-bottom: 0.15rem !important;
}

#trim-shop-shell {
  gap: 0;
}
