#playlistsRoot { color: var(--text-primary, #162235); }
#playlistsRoot .plx-head, #playlistsRoot .plx-row, #playlistsRoot .plx-form { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
#playlistsRoot .plx-head { justify-content: space-between; margin-bottom: 1rem; }
#playlistsRoot h2 { font-size: 1.3rem; font-weight: 700; }
#playlistsRoot h3 { font-size: 1rem; font-weight: 700; margin: 0; }
#playlistsRoot h4 { font-size: .85rem; font-weight: 700; margin: .9rem 0 .3rem; }
#playlistsRoot p, #playlistsRoot small { color: var(--text-muted, #64748b); font-size: .85rem; }
#playlistsRoot .plx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; }
#playlistsRoot .plx-card { background: var(--surface, #fff); border: 1px solid var(--border, #dbe4ef); border-radius: .7rem; padding: 1rem; margin-bottom: 1rem; }
#playlistsRoot .plx-grid .plx-card { margin-bottom: 0; display: flex; flex-direction: column; gap: .35rem; align-items: flex-start; }
#playlistsRoot .plx-grid .plx-card button { margin-top: .4rem; }
#playlistsRoot .plx-card > .plx-row { margin-bottom: .6rem; }
#playlistsRoot .plx-sub { color: var(--text-muted, #64748b); font-size: .8rem; }
#playlistsRoot .plx-note { min-height: 1.2rem; margin-top: .4rem; font-weight: 600; color: #137a43; }
#playlistsRoot .plx-note.plx-error, #playlistsRoot .plx-error { color: #b42318; }
#playlistsRoot .plx-warn { color: #a05a00; font-size: .8rem; font-weight: 600; }
#playlistsRoot .plx-empty { padding: .6rem 0; }
#playlistsRoot .plx-grow { flex: 1; min-width: 12rem; }
#playlistsRoot label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; }
#playlistsRoot input:not([type=checkbox]):not([type=radio]) { background: var(--surface, #fff); color: inherit; border: 1px solid var(--border, #cbd5e1); border-radius: .4rem; padding: .5rem; min-width: 0; }
#playlistsRoot button { border: 1px solid var(--border, #94a3b8); border-radius: .4rem; padding: .4rem .65rem; background: var(--surface, #fff); color: inherit; cursor: pointer; }
#playlistsRoot button:hover:not(:disabled) { border-color: #4264bd; }
#playlistsRoot button:disabled { opacity: .5; cursor: not-allowed; }
#playlistsRoot button.plx-primary { background: var(--accent, #18181b); color: var(--accent-fg, #fff); border-color: var(--accent, #18181b); }
#playlistsRoot button:focus-visible, #playlistsRoot input:focus-visible { outline: 2px solid #4264bd; outline-offset: 2px; }
#playlistsRoot ul { margin: .5rem 0; padding: 0; list-style: none; }
#playlistsRoot .plx-items li { display: flex; align-items: center; gap: .6rem; padding: .4rem 0; border-bottom: 1px solid var(--border, #e2e8f0); }
#playlistsRoot .plx-items .plx-name, #playlistsRoot .plx-check .plx-name { flex: 1; overflow-wrap: anywhere; }
#playlistsRoot .plx-items li.plx-bad { background: rgba(180, 83, 9, .08); }
#playlistsRoot .plx-screen { display: flex; align-items: flex-start; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--border, #e2e8f0); }
#playlistsRoot .plx-screen-main { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .6rem; min-width: 0; }
#playlistsRoot .plx-detail { flex-basis: 100%; font-size: .8rem; color: var(--text-muted, #64748b); overflow-wrap: anywhere; }
#playlistsRoot .plx-checked, #playlistsRoot .plx-folder { color: var(--text-muted, #64748b); }
#playlistsRoot .plx-dot { width: .65rem; height: .65rem; border-radius: 50%; margin-top: .4rem; flex: none; }
#playlistsRoot .plx-dot.plx-on { background: #16a34a; }
#playlistsRoot .plx-dot.plx-off { background: #94a3b8; }
#playlistsRoot .plx-chip { font-size: .75rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; background: #e2e8f0; color: #334155; }
#playlistsRoot .plx-st-ok { background: #dcfce7; color: #166534; }
#playlistsRoot .plx-st-syncing { background: #dbeafe; color: #1e40af; }
#playlistsRoot .plx-st-waiting, #playlistsRoot .plx-st-stale, #playlistsRoot .plx-st-drift { background: #fef3c7; color: #92400e; }
#playlistsRoot .plx-st-error { background: #fee2e2; color: #991b1b; }
#playlistsRoot .plx-check { flex-direction: row; align-items: center; gap: .5rem; padding: .3rem 0; }
#playlistsRoot .plx-startup { flex-direction: row; align-items: center; max-width: 12rem; }
#playlistsRoot select { background: var(--surface, #fff); color: inherit; border: 1px solid var(--border, #cbd5e1); border-radius: .4rem; padding: .5rem; max-width: 100%; }
#playlistsRoot .plx-dlg-head + label, #playlistsRoot dialog label + label { margin-top: .75rem; }
#playlistsRoot .plx-picklist { max-height: 45vh; overflow: auto; margin: .6rem 0; border: 1px solid var(--border, #e2e8f0); border-radius: .4rem; padding: 0 .6rem; }
#playlistsRoot .plx-picklist [hidden] { display: none; }
#playlistsRoot dialog { width: min(34rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow: auto; margin: auto; padding: 1.2rem; border: 1px solid var(--border); border-radius: .7rem; background: var(--surface); color: var(--text-primary); box-shadow: 0 1rem 3rem rgba(0, 0, 0, .2); }
#playlistsRoot dialog::backdrop { background: rgba(0, 0, 0, .45); }
#playlistsRoot .plx-dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
#playlistsRoot .plx-dlg-foot { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }
html.dark #playlistsRoot .plx-chip { background: #334155; color: #e2e8f0; }
html.dark #playlistsRoot .plx-st-ok { background: #14532d; color: #bbf7d0; }
html.dark #playlistsRoot .plx-st-syncing { background: #1e3a8a; color: #bfdbfe; }
html.dark #playlistsRoot .plx-st-waiting, html.dark #playlistsRoot .plx-st-stale, html.dark #playlistsRoot .plx-st-drift { background: #78350f; color: #fde68a; }
html.dark #playlistsRoot .plx-st-error { background: #7f1d1d; color: #fecaca; }
html.dark #playlistsRoot .plx-note { color: #4ade80; }
html.dark #playlistsRoot .plx-note.plx-error, html.dark #playlistsRoot .plx-error { color: #f87171; }
html.dark #playlistsRoot .plx-warn { color: #fbbf24; }
#playlistsRoot .plx-bar { display: block; height: 6px; margin: .4rem 0; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
#playlistsRoot .plx-bar > span { display: block; height: 100%; border-radius: 999px; background: #4f46e5; transition: width .4s ease; }
#playlistsRoot .plx-bar.plx-ind > span { width: 35%; transition: none; animation: plx-slide 1.2s ease-in-out infinite; }
@keyframes plx-slide { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
@media (prefers-reduced-motion: reduce) { #playlistsRoot .plx-bar.plx-ind > span { width: 100%; opacity: .5; animation: none; } }
html.dark #playlistsRoot .plx-bar { background: #334155; }
html.dark #playlistsRoot .plx-bar > span { background: #818cf8; }
/* New playlist form and the editor's name row: the buttons sit on the input's baseline and share its height. */
#playlistsRoot .plx-form, #playlistsRoot .plx-namerow { align-items: flex-end; }
#playlistsRoot .plx-form input, #playlistsRoot .plx-namerow input, #playlistsRoot .plx-form button, #playlistsRoot .plx-namerow button { box-sizing: border-box; height: 2.4rem; }
#playlistsRoot .plx-name { flex: 1 1 14rem; max-width: 28rem; min-width: 0; }
#playlistsRoot .plx-form label { flex: 1 1 14rem; max-width: 28rem; }
#playlistsRoot .plx-unsaved { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; margin: 0 0 .6rem; padding: .5rem .75rem; border-radius: .4rem; background: #fef3c7; color: #78350f; font-weight: 600; }
#playlistsRoot .plx-unsaved .plx-bar { flex-basis: 100%; margin: 0; }
#playlistsRoot .plx-unsaved-text { font-size: .85rem; }
#playlistsRoot .plx-danger { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; margin: 1.5rem 0 .5rem; }
#playlistsRoot button.plx-delete { background: transparent; color: #b91c1c; border-color: #b91c1c; }
#playlistsRoot button.plx-delete:hover:not(:disabled) { background: #fef2f2; border-color: #b91c1c; }
html.dark #playlistsRoot .plx-unsaved { background: #78350f; color: #fde68a; }
html.dark #playlistsRoot button.plx-delete { color: #f87171; border-color: #f87171; }
html.dark #playlistsRoot button.plx-delete:hover:not(:disabled) { background: #3a1d1d; border-color: #f87171; }
#playlistsRoot .plx-startup-tag { font-size: .75rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; background: #e2e8f0; color: #334155; white-space: nowrap; }
html.dark #playlistsRoot .plx-startup-tag { background: #334155; color: #e2e8f0; }
@media (max-width: 700px) { #playlistsRoot .plx-screen { flex-wrap: wrap; } }
/* Layout of a playlist: the select under the name, and the small tag on a playlist card. */
#playlistsRoot .plx-layoutrow { margin-top: .75rem; }
#playlistsRoot .plx-layout select { display: block; box-sizing: border-box; height: 2.4rem; min-width: 14rem; max-width: 28rem; margin-top: .25rem; }
#playlistsRoot .plx-layout-tag { display: inline-block; font-size: .75rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; background: #e0e7ff; color: #3730a3; }
html.dark #playlistsRoot .plx-layout-tag { background: #312e81; color: #c7d2fe; }
/* Phone-first restyle of the list and the editor (M2): section cards, count chips, icon tiles, full-width publish buttons.
   Markup and handlers are unchanged; this block only restyles them, so it sits last and wins. */
#playlistsRoot .plx-ico { width: 1.05em; height: 1.05em; flex: none; }
#playlistsRoot button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 2.5rem; border-radius: .7rem; font-weight: 600; }
#playlistsRoot button.plx-soft { background: #eef2ff; color: #4338ca; border-color: #e0e7ff; }
#playlistsRoot button.plx-soft:hover:not(:disabled) { border-color: #a5b4fc; }
#playlistsRoot .plx-card { border-radius: 1rem; padding: 1rem; box-shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 4px 12px -2px rgba(15, 23, 42, .04); }
#playlistsRoot .plx-namecard label { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted, #64748b); }
#playlistsRoot .plx-namecard input { font-size: .95rem; font-weight: 600; text-transform: none; letter-spacing: normal; }
#playlistsRoot .plx-namerow { flex-wrap: nowrap; }
#playlistsRoot .plx-namerow .plx-name { max-width: none; }
#playlistsRoot input:not([type=checkbox]):not([type=radio]), #playlistsRoot select { border-radius: .7rem; }
#playlistsRoot .plx-namerow input, #playlistsRoot .plx-namerow button, #playlistsRoot .plx-form input, #playlistsRoot .plx-form button { height: 2.5rem; }
#playlistsRoot .plx-layout select { width: 100%; min-width: 0; max-width: none; height: 2.5rem; }
#playlistsRoot .plx-layoutrow .plx-sub { margin: .35rem 0 0; }

/* Section header: title with count chip, one line of help, the two actions. */
#playlistsRoot .plx-sechead { padding-bottom: .75rem; border-bottom: 1px solid var(--border, #e2e8f0); margin-bottom: .25rem; }
#playlistsRoot .plx-sectitle { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
#playlistsRoot .plx-sectitle h3 { font-size: 1.1rem; }
#playlistsRoot .plx-sechead .plx-sub { margin: .15rem 0 .6rem; }
#playlistsRoot .plx-actions { margin: 0; gap: .5rem; }
#playlistsRoot .plx-count { font-size: .72rem; font-weight: 700; padding: .12rem .55rem; border-radius: 999px; background: #eef2ff; color: #4338ca; border: 1px solid #e0e7ff; white-space: nowrap; }
#playlistsRoot .plx-count.plx-count-ok { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }

/* Icon tile shared by file rows and screen rows. */
#playlistsRoot .plx-tile { position: relative; flex: none; width: 2.75rem; height: 2.75rem; border-radius: .8rem; display: inline-flex; align-items: center; justify-content: center; background: #eef2ff; color: #4f46e5; border: 1px solid #e0e7ff; }
#playlistsRoot .plx-tile .plx-ico { width: 1.3rem; height: 1.3rem; }
#playlistsRoot .plx-tile-screen { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
#playlistsRoot .plx-tile .plx-dot { position: absolute; right: -.2rem; top: -.2rem; margin: 0; width: .75rem; height: .75rem; border: 2px solid var(--surface, #fff); box-sizing: border-box; }

/* Media rows */
#playlistsRoot .plx-items li { gap: .75rem; padding: .7rem 0; }
#playlistsRoot .plx-items li:last-child { border-bottom: 0; }
#playlistsRoot .plx-fileinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; }
#playlistsRoot .plx-fileinfo .plx-name { flex: none; font-weight: 600; font-size: .9rem; overflow-wrap: anywhere; }
#playlistsRoot .plx-sizechip { font-size: .72rem; font-weight: 600; padding: .05rem .45rem; border-radius: .4rem; background: #f1f5f9; color: #475569; }
#playlistsRoot button.plx-remove { background: #fef2f2; color: #dc2626; border-color: #fee2e2; flex: none; padding: .4rem .85rem; }
#playlistsRoot button.plx-remove:hover:not(:disabled) { border-color: #fca5a5; }

/* Screen rows: icon tile, name with the status pill under it (one line), then the button on its own line. */
#playlistsRoot .plx-screen { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: .5rem .75rem; padding: .85rem 0; }
#playlistsRoot .plx-screen:last-child { border-bottom: 0; }
#playlistsRoot .plx-screen-main { display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; min-width: 0; }
#playlistsRoot .plx-screen-name strong { font-size: .95rem; overflow-wrap: anywhere; }
#playlistsRoot .plx-screen .plx-chip { white-space: nowrap; max-width: 100%; }
#playlistsRoot .plx-screen .plx-detail { flex-basis: auto; }
#playlistsRoot .plx-screen .plx-startup, #playlistsRoot .plx-screen .plx-startup-tag { grid-column: 2; max-width: none; justify-self: start; }
#playlistsRoot .plx-screen button.plx-screen-remove { grid-column: 1 / -1; width: 100%; background: #f1f5f9; border-color: #e2e8f0; color: #334155; }
#playlistsRoot .plx-screen button.plx-screen-remove:hover:not(:disabled) { border-color: #94a3b8; }

/* Publish buttons: full width, dark then soft. */
#playlistsRoot .plx-publishrow { flex-direction: column; align-items: stretch; gap: .6rem; margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--border, #e2e8f0); }
#playlistsRoot .plx-publishrow > button { width: 100%; min-height: 3rem; font-size: .95rem; }
#playlistsRoot button.plx-publish { background: #0f172a; border-color: #0f172a; color: #fff; }
#playlistsRoot button.plx-publish-play { background: #eef2ff; border-color: #c7d2fe; color: #3730a3; }
#playlistsRoot .plx-publishrow .plx-unsaved-text, #playlistsRoot .plx-publishrow .plx-warn { text-align: center; }

/* Delete: soft red outline. Back: a quiet pill. */
#playlistsRoot .plx-danger { margin: 1rem 0 .5rem; }
#playlistsRoot button.plx-delete { background: #fff; color: #dc2626; border-color: #fecaca; }
#playlistsRoot button.plx-delete:hover:not(:disabled) { background: #fef2f2; border-color: #f87171; }
#playlistsRoot button.plx-back { background: var(--surface, #fff); padding: .4rem .85rem; }
#playlistsRoot .plx-unsaved { border-radius: .7rem; }

/* Wider screens: the same cards, with the rows back on one line. */
@media (min-width: 701px) {
  #playlistsRoot .plx-screen { display: flex; align-items: center; }
  #playlistsRoot .plx-screen-main { flex: 1; }
  #playlistsRoot .plx-screen button.plx-screen-remove { width: auto; }
  #playlistsRoot .plx-screen .plx-startup, #playlistsRoot .plx-screen .plx-startup-tag { justify-self: auto; }
  #playlistsRoot .plx-sechead { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; }
  #playlistsRoot .plx-sechead .plx-sub { margin: 0; flex: 1; }
  #playlistsRoot .plx-publishrow { flex-direction: row; align-items: center; }
  #playlistsRoot .plx-publishrow > button { width: auto; min-width: 12rem; }
}

html.dark #playlistsRoot button.plx-soft, html.dark #playlistsRoot .plx-count, html.dark #playlistsRoot .plx-tile { background: #1e1b4b; color: #c7d2fe; border-color: #3730a3; }
html.dark #playlistsRoot .plx-count.plx-count-ok { background: #052e1c; color: #6ee7b7; border-color: #065f46; }
html.dark #playlistsRoot .plx-tile-screen { background: #1e293b; color: #cbd5e1; border-color: #334155; }
html.dark #playlistsRoot .plx-sizechip { background: #1e293b; color: #cbd5e1; }
html.dark #playlistsRoot button.plx-remove { background: #3a1d1d; color: #f87171; border-color: #7f1d1d; }
html.dark #playlistsRoot .plx-screen button.plx-screen-remove { background: #1e293b; border-color: #334155; color: #e2e8f0; }
html.dark #playlistsRoot button.plx-publish { background: #e2e8f0; border-color: #e2e8f0; color: #0f172a; }
html.dark #playlistsRoot button.plx-publish-play { background: #1e1b4b; border-color: #3730a3; color: #c7d2fe; }
html.dark #playlistsRoot button.plx-delete { background: transparent; color: #f87171; border-color: #7f1d1d; }
html.dark #playlistsRoot button.plx-delete:hover:not(:disabled) { background: #3a1d1d; border-color: #f87171; }
html.dark #playlistsRoot .plx-sechead, html.dark #playlistsRoot .plx-publishrow { border-color: #334155; }
/* M2 review fixes: the screen column starts at one left edge whatever the page inherits; the layout select keeps the 40 px minimum. */
#playlistsRoot .plx-screen-main, #playlistsRoot .plx-screen-main > * { text-align: left; }
#playlistsRoot .plx-screen-main > * { align-self: flex-start; }
#playlistsRoot .plx-layout select, #playlistsRoot .plx-namerow input { box-sizing: border-box; height: auto; min-height: 2.5rem; }
