/* customise_menu_html — every rule from the form's old <style> block,
   carried across unchanged except for the scoping.

   .cm-root is the adopted form root and stays a BARE rule: it carries the four
   accent custom properties the shared .px-* chrome reads off the form root.
   Nothing is added to it — this form is a screen inside the shell's content
   slot, not a body rule moving onto a root, and no descendant resolves a
   percentage height or flexes against it.

   Four rules are compounded with .px-card. A head <link> loses a padding tie
   to .px-card { padding: 20px } on document order, so they win on
   specificity instead.

   No .themed-scrollbar rule: that class stays the dependency's. */

.cm-root {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px;
  /* Accent family the shared px-* classes (px-page-title bar,
     px-btn-primary, focus rings) read off the form root. Slate
     matches the navigation menu this screen customises. */
  --accent: #64748b;
  --accent-hover: #475569;
  --accent-subtle: rgba(100, 116, 139, 0.12);
  --px-loading-accent: #64748b;
}

:where(.cm-root) .cm-topbar.px-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
}

:where(.cm-root) .cm-topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

/* Sound-test strip at the top of the page. */
:where(.cm-root) .cm-sound-test.px-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
}

:where(.cm-root) .cm-sound-test-label {
  font-size: 0.85rem;
  color: var(--px-text-secondary);
}

:where(.cm-root) .cm-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--px-text-secondary);
  cursor: pointer;
  user-select: none;
}

:where(.cm-root) .cm-dirty-indicator {
  font-family: var(--px-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--px-danger);
}

:where(.cm-root) .cm-validation {
  font-size: 0.82rem;
  color: var(--px-danger);
  background: var(--px-bg-elevated);
  border: 1px solid var(--px-danger);
  border-radius: var(--px-radius-sm);
  padding: 8px 12px;
}

:where(.cm-root) .cm-grouped-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

:where(.cm-root) .cm-columns {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  align-items: flex-start;
}

:where(.cm-root) .cm-col.px-card {
  flex: 0 0 190px;
  /* Without this the flex item's auto min-width = the longest
     card's min-content, so long screen names widen the column
     past its basis instead of ellipsis-clipping. */
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
}

:where(.cm-root) .cm-col-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

:where(.cm-root) .cm-group-name {
  flex: 1 1 auto;
  font-family: var(--px-font);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 6px 8px;
  border: 1px solid var(--px-border);
  border-radius: var(--px-radius-sm);
  background: var(--px-input-bg);
  color: var(--px-text-primary);
  outline: none;
  min-width: 0;
}

:where(.cm-root) .cm-group-name:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

:where(.cm-root) .cm-col-delete-wrap {
  flex: 0 0 auto;
  display: inline-flex;
}

:where(.cm-root) .cm-col-delete {
  width: 26px;
  height: 26px;
  border: 1px solid var(--px-border);
  border-radius: var(--px-radius-sm);
  background: var(--px-bg-elevated);
  color: var(--px-text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1;
}

:where(.cm-root) .cm-col-delete:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

:where(.cm-root) .cm-col-delete:not(:disabled):hover {
  border-color: var(--px-danger);
  color: var(--px-danger);
}

:where(.cm-root) .cm-col-counter {
  font-family: var(--px-mono);
  font-size: 0.62rem;
  color: var(--px-text-muted);
  text-align: right;
}

:where(.cm-root) .cm-screens,
:where(.cm-root) .cm-flat-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 44px;
}

:where(.cm-root) .cm-flat-list.px-card {
  max-width: 360px;
  padding: 12px;
}

:where(.cm-root) .cm-card {
  padding: 8px 10px;
  background: var(--px-bg-elevated);
  border: 1px solid var(--px-border);
  border-radius: var(--px-radius-sm);
  font-size: 0.85rem;
  color: var(--px-text-primary);
  cursor: grab;
}

:where(.cm-root) .cm-card:active {
  cursor: grabbing;
}

:where(.cm-root) .cm-card-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:where(.cm-root) .cm-card.sortable-ghost {
  opacity: 0.4;
}

:where(.cm-root) .cm-card.sortable-chosen {
  border-color: var(--accent);
}

:where(.cm-root) .cm-flat-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

:where(.cm-root) .cm-flat-hint {
  font-size: 0.78rem;
  color: var(--px-text-muted);
}

/* The .cm-hidden state class for the dirty indicator, the validation line and
   the two areas the mode toggle swaps. Written as a compound against each base
   rule so no declaration order inside this file decides it: .cm-grouped-area
   and .cm-flat-area both carry display: flex at (0,1,0) and this is (0,2,0).
   No designer gate: the designer canvas loads this head-linked asset, so the
   canvas shows what first paint shows. */
:where(.cm-root) .cm-dirty-indicator.cm-hidden,
:where(.cm-root) .cm-validation.cm-hidden,
:where(.cm-root) .cm-grouped-area.cm-hidden,
:where(.cm-root) .cm-flat-area.cm-hidden {
  display: none;
}
