/* "Monitor" — design system for the media library UI (library.php).
   Extracted from the design-2-monitor.html mockup; tab-switcher JS/CSS
   dropped since real navigation here is separate pages, not JS panels. */

:root {
  --bg: #eceae4;
  --surface: #f8f7f2;
  --surface-2: #dfdcd2;
  --text: #16181a;
  --text-dim: #6a6d6f;
  --line: #cac6b8;
  --accent: #b3701f;
  --accent-2: #2f5fa8;
  --accent-ink: #fbf9f2;
  --ok: #3c7a52;
  --now-playing: #caa02c;
  --now-playing-ink: #1c1a12;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14151a; --surface: #1a1c22; --surface-2: #21242c; --text: #e6e6e8;
    --text-dim: #83868f; --line: #2e313b; --accent: #e8a23d; --accent-2: #5b93ff; --accent-ink: #16181a; --ok: #5fbf82;
    --now-playing: #ffd54f; --now-playing-ink: #1c1a12;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text); min-height: 100vh;
  font-family: -apple-system, "Helvetica Neue", Arial, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.mono { font-family: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace; font-variant-numeric: tabular-nums; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.app { max-width: 1220px; margin: 0 auto; padding: 0 28px 100px; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 26px 0; gap: 20px; flex-wrap: wrap; }
.wordmark { display: flex; align-items: center; gap: 12px; }
.wordmark a { display: flex; align-items: center; gap: 12px; }
.meter { display: flex; align-items: flex-end; gap: 2px; height: 20px; }
.meter i { width: 3px; display: block; background: var(--accent); border-radius: 1px; animation: pulse 1.6s ease-in-out infinite; }
.meter i:nth-child(1) { height: 40%; animation-delay: -0.9s; }
.meter i:nth-child(2) { height: 90%; animation-delay: -0.4s; }
.meter i:nth-child(3) { height: 60%; animation-delay: -1.2s; }
.meter i:nth-child(4) { height: 100%; background: var(--accent-2); animation-delay: -0.1s; }
.meter i:nth-child(5) { height: 50%; animation-delay: -0.7s; }
@keyframes pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .meter i { animation: none; } }
.wordmark .name { font-weight: 800; font-size: 19px; letter-spacing: -0.01em; color: var(--text); }
.wordmark .name b { color: var(--accent); }

.crumbs { font-size: 12.5px; color: var(--text-dim); }
.crumbs a { border-bottom: 1px solid transparent; }
@media (hover: hover) {
  .crumbs a:hover { color: var(--text); }
  .crumbs a:hover { border-color: var(--text); }
}

h2.st {
  font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-dim);
  margin: 40px 0 14px; display: flex; align-items: center; justify-content: space-between;
  gap: 8px 16px; flex-wrap: wrap; overflow-wrap: anywhere;
}
h2.st span.cnt { font-family: ui-monospace, monospace; color: var(--text-dim); font-weight: 400; }

/* dashboard */
.dash { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 14px; }
@media (max-width: 900px) { .dash { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px) { .dash { grid-template-columns: repeat(2, 1fr); gap: 6px; } }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
}
.card .v { font-family: ui-monospace, monospace; font-size: 20px; font-weight: 600; }
.card .l { font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); margin-top: 3px; }

table.rows { width: 100%; border-collapse: collapse; margin-top: 6px; }
table.rows thead th {
  text-align: left; font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-dim);
  font-weight: 600; padding: 0 10px 8px; border-bottom: 1px solid var(--line);
}
table.rows thead th.num, table.rows td.num { text-align: right; }
table.rows tbody td { padding: 11px 10px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
table.rows tbody tr { transition: background .12s ease; }
table.rows tbody tr.is-playing {
  background: color-mix(in srgb, var(--accent-2) 14%, var(--surface)) !important;
}
table.rows tbody tr.is-playing td.num {
  color: var(--accent-2);
  font-weight: 700;
}
table.rows tbody tr.is-playing td a,
table.rows tbody tr.is-playing td {
  color: var(--accent-2);
}
@media (hover: hover) {
  table.rows tbody tr:hover { background: var(--surface); }
}
table.rows tbody tr.linked { cursor: pointer; }
table.rows tbody tr.playlist-album-heading:hover, table.rows tbody tr.playlist-other-heading:hover { background: transparent; }
table.rows tbody tr.playlist-album-heading td { padding: 16px 0 6px; border-bottom: 0; }
.playlist-album-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-left: 3px solid var(--accent-2); border-radius: 8px; background: var(--surface); color: var(--text); box-sizing: border-box; }
.playlist-album-cover { width: 44px; height: 44px; flex: none; overflow: hidden; border: 1px solid var(--line); border-radius: 5px; background: repeating-linear-gradient(100deg, color-mix(in srgb, var(--accent-2) 22%, var(--surface)) 0 3px, var(--surface) 3px 7px); }
.playlist-album-cover img { width: 100%; height: 100%; object-fit: cover; }
.playlist-album-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.playlist-album-kicker { font-family: ui-monospace, monospace; font-size: 9.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--accent-2); }
.playlist-album-title { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.playlist-album-stats { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; color: var(--text-dim); font-family: ui-monospace, monospace; font-size: 10px; }
.playlist-album-stats .tag { font-size: 9px; padding: 1px 4px; }
table.rows tbody tr.playlist-other-heading td { padding: 16px 10px 6px; border-bottom: 1px solid var(--line); color: var(--text-dim); font-family: ui-monospace, monospace; font-size: 10.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; }
@media (hover: hover) {
  .playlist-album-card:hover { border-color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 7%, var(--surface)); }
}
.wrap-x { overflow-x: auto; }
.tag {
  display: inline-flex; align-items: center; gap: 5px; font-family: ui-monospace, monospace; font-size: 10.5px;
  border: 1px solid var(--line); padding: 2px 6px; border-radius: 4px; color: var(--text-dim);
}
.tag.hi { border-color: var(--accent); color: var(--accent); }
.dim { color: var(--text-dim); }
.removed-note { margin: -4px 0 18px; font-size: 13px; }

/* playlist / album cards on home and search */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
@media (max-width: 480px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}
.pl-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
  transition: border-color .15s ease, transform .15s ease;
}
@media (hover: hover) {
  .pl-card:hover { border-color: var(--accent-2); transform: translateY(-2px); }
}
.pl-card .art {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  border: 1px solid var(--line);
  margin-bottom: 8px;
  overflow: hidden;
  position: relative;
  background: repeating-linear-gradient(100deg, color-mix(in srgb, var(--accent-2) 22%, var(--surface)) 0 3px, var(--surface) 3px 7px);
}
.pl-card .art img { width: 100%; height: 100%; object-fit: cover; }
.pl-card-favorites .art { position: relative; }
.pl-card-favorites .fav-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: color-mix(in srgb, var(--accent) 90%, black);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  line-height: 1;
}
.pl-card .t {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: 2.6em;
  word-break: break-word;
}
.pl-card .s {
  font-family: ui-monospace, monospace;
  font-size: 10.5px;
  color: var(--text-dim);
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2px 4px;
  line-height: 1.25;
}
.pl-card .s .s-tracks { white-space: nowrap; }
.pl-card .s .s-dur { white-space: nowrap; color: var(--text-dim); }

/* album / playlist detail head */
.a-grid { display: grid; grid-template-columns: 250px 1fr; gap: 32px; margin-top: 22px; }
@media (max-width: 760px) { .a-grid { grid-template-columns: 1fr; } }
.art-block { width: 250px; height: 250px; border-radius: 8px; border: 1px solid var(--line);
  background: repeating-linear-gradient(100deg, color-mix(in srgb, var(--accent-2) 22%, var(--surface)) 0 3px, var(--surface) 3px 7px);
  display: flex; align-items: flex-end; padding: 16px; position: relative; overflow: hidden; }
.art-block.amber { background: repeating-linear-gradient(100deg, color-mix(in srgb, var(--accent) 20%, var(--surface)) 0 3px, var(--surface) 3px 7px); }
.art-block img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.art-block::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, color-mix(in srgb, var(--bg) 70%, transparent)); }
.art-block .lbl { position: relative; z-index: 1; font-weight: 800; font-size: 19px; line-height: 1.2; }
.eyebrow { font-family: ui-monospace, monospace; font-size: 11px; color: var(--accent-2); letter-spacing: 0.04em; margin-bottom: 8px; }
h1.title { font-size: 34px; font-weight: 800; letter-spacing: -0.015em; margin: 0 0 6px; text-wrap: balance; }
.by-line { color: var(--text-dim); font-size: 14.5px; margin-bottom: 18px; }
.by-line a { border-bottom: 1px solid var(--accent-2); color: var(--text); }

.spec-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 18px; }
.spec { background: var(--surface); padding: 10px 12px; }
.spec .k { font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); }
.spec .v { font-family: ui-monospace, monospace; font-size: 15px; margin-top: 3px; }
@media (max-width: 560px) { .spec-grid { grid-template-columns: repeat(2, 1fr); } }

.award-line { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-dim); margin-bottom: 10px; }
.award-line b { color: var(--text); font-family: ui-monospace, monospace; }
.credits-line { font-size: 12.5px; color: var(--text-dim); }
.credits-line a { border-bottom: 1px solid var(--line); color: var(--text); }

.two-col { display: grid; grid-template-columns: 1.5fr 1fr; gap: 32px; margin-top: 8px; align-items: start; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }
.two-col p.desc { font-size: 14.5px; line-height: 1.7; color: var(--text); }
.file-row { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); margin-bottom: 10px; }
.file-row .ext { font-family: ui-monospace, monospace; font-size: 10px; font-weight: 700; border: 1px solid var(--accent-2); color: var(--accent-2); padding: 3px 6px; border-radius: 4px; }
.file-row .meta .t { font-size: 13px; font-weight: 600; }
.file-row .meta .s { font-size: 11.5px; color: var(--text-dim); font-family: ui-monospace, monospace; }
.file-row .dl { margin-left: auto; font-size: 12px; color: var(--accent-2); border-bottom: 1px solid var(--accent-2); }

/* artist */
.ar-head { display: flex; gap: 24px; align-items: center; margin-top: 22px; flex-wrap: wrap; }
.ar-portrait { width: 132px; height: 132px; border-radius: 8px; border: 1px solid var(--line); flex: none; position: relative; overflow: hidden;
  background: repeating-linear-gradient(100deg, color-mix(in srgb, var(--accent) 20%, var(--surface)) 0 3px, var(--surface) 3px 7px);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 30px; }
.ar-portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ar-stat-row { display: flex; gap: 24px; margin-top: 10px; flex-wrap: wrap; }
.ar-stat-row div b { font-family: ui-monospace, monospace; font-size: 18px; display: block; }
.ar-stat-row div span { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }

.graph { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.node { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 20px; padding: 6px 14px 6px 6px; font-size: 13px; background: var(--surface); }
.node .av { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); flex: none; overflow: hidden; position: relative; }
.node .av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.node.self { border-color: var(--accent-2); color: var(--accent-2); font-weight: 700; }
@media (hover: hover) {
  .node:hover:not(.self) { border-color: var(--accent); }
}

.empty-note { font-size: 13px; color: var(--text-dim); font-style: italic; }

/* Public library search: one persistent form outside the soft-nav swap zone. */
.library-search {
  display: flex; align-items: stretch; flex: 1 1 220px; max-width: 290px; margin-left: auto;
  min-height: 38px; overflow: hidden; background: var(--surface);
  border: 1px solid var(--line); border-radius: 20px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.library-search.is-active {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-2) 12%, transparent);
}
.library-search:focus-within {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 32%, transparent);
}
.library-search input[type="search"] {
  min-width: 0; flex: 1; border: 0; outline: 0; padding: 8px 4px 8px 14px;
  background: transparent; color: var(--text); font: inherit; font-size: 14px;
}
.library-search input[type="search"]::placeholder { color: var(--text-dim); opacity: 1; }
.library-search button {
  width: 42px; flex: none; display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--text-dim); cursor: pointer;
}
@media (hover: hover) {
  .library-search button:hover { color: var(--accent-2); }
}
.library-search button:focus-visible { outline: 2px solid var(--accent-2); outline-offset: -4px; border-radius: 50%; }

/* top navigation (list pages) */
.topnav { display: flex; gap: 4px; flex-wrap: wrap; }
.topnav a { padding: 6px 12px; border: 1px solid transparent; border-radius: 16px; font-size: 13px; color: var(--text-dim); }
.topnav a.on { color: var(--accent-2); border-color: var(--accent-2); }
.topnav a.adm { border-style: dashed; border-color: var(--line); }
.topnav a.adm.on { border-color: var(--accent-2); }
@media (hover: hover) {
  .topnav a:hover { color: var(--text); border-color: var(--line); }
}

@media (max-width: 760px) {
  .topbar { gap: 12px; padding: 18px 0; }
  .wordmark { order: 1; }
  .library-search { order: 2; flex-basis: 100%; width: 100%; max-width: none; min-height: 44px; margin-left: 0; }
  .library-search input[type="search"] { font-size: 16px; }
  .topnav { order: 3; width: 100%; }
  .topnav a { padding: 7px 10px; }
}

/* Grouped search overview. */
.search-title { margin: 22px 0 0; }
.search-title:focus { outline: 2px solid var(--accent-2); outline-offset: 5px; }
.search-summary { margin: 9px 0 0; color: var(--text-dim); font-size: 14px; }
.search-summary q { color: var(--text); font-weight: 700; overflow-wrap: anywhere; }
.search-empty {
  margin-top: 22px; padding: 24px; border: 1px dashed var(--line); border-radius: 8px;
  background: var(--surface); color: var(--text-dim);
}
.search-empty p { margin: 0 0 5px; color: var(--text); font-size: 16px; font-weight: 700; }
.search-empty span { font-size: 13px; }
.search-group h2.st { margin-top: 34px; }
.search-group h2.st .cnt a { color: var(--accent-2); border-bottom: 1px solid currentColor; }

/* dash cards that link to list pages */
@media (hover: hover) {
  a.card:hover { border-color: var(--accent-2); }
  a.card:hover .l { color: var(--accent-2); }
}

/* pagination (list pages, playlist tracklist) */
.pager { display: flex; gap: 6px; align-items: center; margin-top: 18px; font-family: ui-monospace, monospace; font-size: 13px; flex-wrap: wrap; }
.pager a, .pager .cur, .pager .off { min-width: 30px; padding: 5px 8px; text-align: center; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.pager a { color: var(--text); }
@media (hover: hover) {
  .pager a:hover { border-color: var(--accent-2); color: var(--accent-2); }
}
.pager .cur { border-color: var(--accent-2); color: var(--accent-ink); background: var(--accent-2); font-weight: 700; }
.pager .off { opacity: 0.3; }
.pager .gap { color: var(--text-dim); }

/* small artwork in list-page rows */
.row-thumb { display: block; width: 36px; height: 36px; border-radius: 4px; border: 1px solid var(--line); background: var(--surface-2); overflow: hidden; position: relative; }
.row-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.row-av { display: block; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); overflow: hidden; position: relative; }
.row-av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* Active / playing row highlights */
tr.is-playing { background: color-mix(in srgb, var(--now-playing) 10%, transparent); }
tr.is-playing td.cell-title { color: var(--now-playing); font-weight: 700; }
tr.is-playing td.cell-title a { color: var(--now-playing); }
tr.is-playing .row-thumb { border-color: var(--now-playing); }
tr.is-paused { background: color-mix(in srgb, var(--now-playing) 4%, transparent); }

/* admin tabs */
.admin-tabs {
  display: flex;
  gap: 6px;
  margin: 16px 0 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.admin-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  background: transparent;
  white-space: nowrap;
  transition: all .15s ease;
}
@media (hover: hover) {
  .admin-tab:hover {
    color: var(--text);
    border-color: var(--line);
    background: color-mix(in srgb, var(--surface) 60%, transparent);
  }
}
.admin-tab.is-active {
  background: var(--surface);
  color: var(--accent-2);
  border-color: var(--accent-2);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.admin-tab .badge {
  font-size: 11px;
  font-family: ui-monospace, monospace;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--text-dim) 18%, var(--surface));
  color: var(--text);
}
.admin-tab.is-active .badge {
  background: color-mix(in srgb, var(--accent-2) 20%, var(--surface));
  color: var(--accent-2);
}
.admin-tab .badge-running {
  background: color-mix(in srgb, var(--accent) 25%, var(--surface));
  color: var(--accent);
  animation: pulseBadge 1.5s ease-in-out infinite alternate;
}
@keyframes pulseBadge {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}
.admin-tab-content {
  margin-top: 6px;
}

/* admin job runner (Ф6) */
form.run-job { display: inline; }
form.run-job button {
  font-family: ui-monospace, monospace; font-size: 11.5px; font-weight: 700; cursor: pointer;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 5px 12px;
  transition: border-color .12s ease, color .12s ease;
}
@media (hover: hover) {
  form.run-job button:hover:not(:disabled) { border-color: var(--accent-2); color: var(--accent-2); }
}
form.run-job button:disabled { opacity: 0.35; cursor: default; }
.job-table { min-width: 760px; }
.job-table-scroll:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }
.job-table .job-status-cell { min-width: 180px; }
.job-table .job-run-cell { min-width: 106px; }
.job-progress, .job-inline-error { display: block; margin-top: 5px; font-family: ui-monospace, monospace; font-size: 10.5px; }
.job-progress { color: var(--text-dim); }
.job-inline-error { color: var(--accent); max-width: 320px; overflow-wrap: anywhere; }
.job-progress[hidden], .job-inline-error[hidden], tr.job-log[hidden] { display: none; }
tr.job-full td { border-top: 2px solid var(--line); }
.tag.run { border-color: var(--accent-2); color: var(--accent-2); }
.tag.ok { border-color: var(--ok); color: var(--ok); }
.tag.err { border-color: var(--accent); color: var(--accent); }
@media (hover: hover) {
  tr.job-log:hover { background: transparent; }
}
tr.job-log td { padding-top: 0; }
tr.job-log summary { font-size: 11px; font-family: ui-monospace, monospace; cursor: pointer; }
.log-tail {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; margin: 8px 0 4px;
  padding: 10px 12px; font-size: 11px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
  max-height: 260px; overflow-y: auto;
}
.log-tail:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.log-tail[hidden] { display: none; }

.jobs-live-status {
  display: flex; align-items: center; gap: 7px 12px; flex-wrap: wrap;
  min-height: 20px; margin: 8px 0 0; color: var(--text-dim); font-size: 12px;
}
.jobs-live-status::before { content: ''; width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--text-dim); opacity: .5; }
.jobs-live-status.is-active::before { background: var(--accent-2); opacity: 1; }
.jobs-live-status.is-error { color: var(--accent); }
.jobs-live-status.is-error::before { background: var(--accent); opacity: 1; }
.jobs-live-status a { color: var(--accent-2); border-bottom: 1px solid currentColor; font-weight: 700; }

.job-history-list { display: grid; gap: 8px; }
.job-run { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.job-run > summary { padding: 11px 14px; cursor: pointer; }
.job-run > summary::marker { color: var(--text-dim); }
.job-run > summary:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 7px; }
.job-run-line { display: inline-flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; width: calc(100% - 14px); vertical-align: middle; }
.job-run-task { min-width: 0; font-size: 12.5px; font-weight: 700; overflow-wrap: anywhere; }
.job-run-meta { display: inline-flex; align-items: center; gap: 5px 12px; flex-wrap: wrap; margin-left: auto; color: var(--text-dim); font-family: ui-monospace, monospace; font-size: 10.5px; }
.job-run-meta span + span::before, .job-run-meta time + span::before { content: '·'; margin-right: 12px; color: var(--line); }
.job-run-body { padding: 0 14px 13px; border-top: 1px solid var(--line); }
.job-run-step, .job-run-error, .job-log-state { margin: 10px 0 0; font-size: 11.5px; }
.job-run-step, .job-log-state { color: var(--text-dim); }
.job-run-step { font-family: ui-monospace, monospace; }
.job-run-error { color: var(--accent); overflow-wrap: anywhere; }
.job-history-log { margin-top: 10px; max-height: 320px; }

@media (max-width: 760px) {
  .job-table-scroll { margin-right: -28px; padding-right: 28px; }
  .job-table th:last-child, .job-table .job-run-cell {
    position: sticky; right: 0; background: var(--bg); box-shadow: -8px 0 10px color-mix(in srgb, var(--bg) 88%, transparent);
  }
  .job-table .job-run-cell button { min-height: 44px; }
  .job-run > summary { padding: 12px; }
  .job-run-line { gap: 7px 9px; width: calc(100% - 12px); }
  .job-run-meta { width: 100%; margin-left: 0; }
  .job-run-body { padding: 0 12px 12px; }
}

.not-found { padding: 80px 0; text-align: center; }
.not-found h1 { font-size: 26px; }
.not-found a { color: var(--accent-2); border-bottom: 1px solid var(--accent-2); }

footer.hint { margin-top: 64px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--text-dim); font-size: 11.5px; font-family: ui-monospace, monospace; }

/* Login modal (Ф8 итерация 2): in-place sign-in for play/admin, no route hops. */
.login-modal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  padding: 16px;
}
.login-modal[hidden] { display: none; }
.login-modal-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 22px 22px 18px; width: 100%; max-width: 360px;
  box-shadow: 0 18px 50px color-mix(in srgb, var(--bg) 55%, transparent);
}
.login-modal-title { font-weight: 800; font-size: 18px; letter-spacing: .02em; }
.login-modal-hint { color: var(--text-dim); font-size: 13px; margin: 8px 0 0; }
.login-modal-error { color: var(--accent); font-size: 13px; margin: 10px 0 0; }
.login-modal form { margin-top: 14px; }
.login-modal input[type="password"] {
  width: 100%; box-sizing: border-box;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 10px 12px; color: var(--text); font-size: 14px;
}
.login-modal-actions { display: flex; gap: 8px; margin-top: 12px; }
.login-modal-actions button { border-radius: 6px; padding: 9px 16px; font-weight: 700; cursor: pointer; font-size: 13.5px; }
.login-modal-actions .lm-primary { flex: 1; background: var(--accent); color: var(--accent-ink); border: none; }
.login-modal-actions .lm-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--line); }

/* "Play collection" button in playlist/album headers -- same round-icon
   language as the player bar's own play button (views/library/footer.php
   #play-btn), just bigger: this is the header's primary action. */
.collection-play {
  margin: 14px 0; width: 44px; height: 44px; border-radius: 50%; border: none;
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex: none;
}
@media (hover: hover) {
  .collection-play:hover { background: var(--accent-2); }
}
.collection-play:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.collection-play.active { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 3px; }
.collection-play svg { display: block; flex: none; }
.collection-play .i-pause, .collection-play.playing .i-play { display: none; }
.collection-play.playing .i-pause { display: block; }

/* Bio language toggle (RU/EN) — matches job-table button language */
.bio-lang-toggle { display: inline-flex; gap: 4px; }
.bio-toggle-btn {
  font-family: ui-monospace, monospace; font-size: 11px; font-weight: 700;
  cursor: pointer; background: var(--surface); color: var(--text-dim);
  border: 1px solid var(--line); border-radius: 5px; padding: 3px 9px;
  transition: border-color .12s ease, color .12s ease; line-height: 1.4;
}
.bio-toggle-btn.active { border-color: var(--accent-2); color: var(--accent-2); }
@media (hover: hover) {
  .bio-toggle-btn:hover:not(.active) { border-color: var(--text-dim); color: var(--text); }
}

/* Download Manager */
.dl-controls-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px; margin: 24px 0 14px;
}
.dl-tabs { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 3px; gap: 3px; }
.dl-tab {
  padding: 6px 14px; font-size: 13px; font-weight: 700; border-radius: 5px; color: var(--text-dim);
  text-decoration: none; transition: background .12s, color .12s;
}
.dl-tab.on { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.dl-filter-form { display: flex; align-items: center; gap: 6px; }
.dl-search-input {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 7px 12px;
  font-size: 13px; color: var(--text); min-width: 240px;
}
.dl-search-btn {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 7px 12px;
  font-size: 13px; font-weight: 700; color: var(--text); cursor: pointer;
}
.dl-reset-btn { font-size: 12px; color: var(--text-dim); text-decoration: underline; margin-left: 4px; }
.dl-filter-pills { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.dl-pill {
  font-size: 12px; font-family: ui-monospace, monospace; padding: 4px 10px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-dim); text-decoration: none;
}
.dl-pill.on { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); border-color: var(--accent); color: var(--text); font-weight: 700; }
.dl-export-link { font-size: 12px; color: var(--text-dim); border-bottom: 1px solid var(--line); text-decoration: none; }
.btn-dl-track, .btn-dl-album {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px;
  font-size: 12px; font-weight: 700; color: var(--text); cursor: pointer; transition: all .15s ease;
}
.btn-dl-track:hover, .btn-dl-album:hover {
  background: color-mix(in srgb, var(--accent) 25%, var(--surface)); border-color: var(--accent);
}
.btn-dl-done {
  background: color-mix(in srgb, #4CAF50 20%, var(--surface)) !important;
  border-color: #4CAF50 !important; color: #4CAF50 !important; cursor: default;
}
.dl-toast-container { position: fixed; bottom: 85px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.dl-toast {
  padding: 10px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4); pointer-events: auto; transition: all .3s ease;
}
.dl-toast-ok { background: #2e7d32; }
.dl-toast-err { background: #c62828; }
.dl-play-cell { vertical-align: middle; }
.play-btn-quick-dl {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px dashed color-mix(in srgb, var(--accent) 70%, var(--line));
  background: var(--surface); color: var(--text-dim);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; padding: 0; line-height: 1; transition: all .15s ease;
}
.play-btn-quick-dl:hover {
  border-color: var(--accent); color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, var(--surface));
  transform: scale(1.06);
}
.play-btn-quick-dl.is-loading {
  pointer-events: none; opacity: 0.7;
}
.dl-batch-btn {
  background: var(--accent); color: var(--accent-ink); border: none; border-radius: 6px;
  padding: 6px 14px; font-size: 12.5px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: all .15s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}
.dl-batch-btn:hover:not(:disabled) {
  background: var(--accent-2); transform: translateY(-1px);
}
.dl-batch-btn:disabled {
  opacity: 0.7; cursor: wait; transform: none;
}
.dl-batch-btn.dl-batch-done {
  background: color-mix(in srgb, #4CAF50 20%, var(--surface)) !important;
  color: #4CAF50 !important; border: 1px solid #4CAF50 !important; cursor: default;
}

/* Playlist UI Enhancements */
.collection-actions {
  display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap;
}
.collection-shuffle {
  display: inline-flex; align-items: center; gap: 7px; height: 44px; padding: 0 18px;
  border-radius: 22px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
@media (hover: hover) {
  .collection-shuffle:hover {
    border-color: var(--accent-2);
    color: var(--accent-2);
    background: color-mix(in srgb, var(--accent-2) 8%, var(--surface));
  }
}
.collection-shuffle:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.playlist-hydration-status {
  font-family: ui-monospace, monospace; font-size: 12px; color: var(--accent-2);
  padding: 5px 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--accent-2) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent-2) 30%, transparent);
}
.avail-status { color: var(--text-dim); }
.missing-link { color: var(--accent) !important; text-decoration: underline; text-underline-offset: 2px; }
.playlist-tracklist-head {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 12px; margin: 28px 0 10px;
}
.playlist-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.view-toggle { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 2px; gap: 2px; }
.view-opt {
  padding: 4px 10px; font-size: 12px; font-weight: 600; border-radius: 4px; color: var(--text-dim);
  text-decoration: none; transition: background .12s, color .12s;
}
.view-opt.on { background: var(--bg); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,0.15); }
.playlist-filter-form {
  display: flex; align-items: center; position: relative; gap: 4px;
}
.playlist-filter-input {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px;
  font-size: 12.5px; color: var(--text); min-width: 190px;
}
.playlist-filter-input:focus { outline: 2px solid var(--accent-2); border-color: transparent; }
.playlist-filter-reset {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; background: var(--line);
  color: var(--text-dim); text-decoration: none; font-size: 11px; font-weight: bold;
  transition: background .12s, color .12s;
}
.playlist-filter-reset:hover { background: var(--accent-2); color: var(--accent-ink); }
.tag-spec { opacity: 0.85; font-size: 9.5px; margin-left: 3px; font-weight: normal; }

/* Animated Equalizer Icon for Now Playing Rows (PL-09) */
.track-eq-anim {
  display: none;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  width: 14px;
  height: 14px;
  vertical-align: middle;
}
.track-eq-anim i {
  display: block;
  width: 2.5px;
  background: var(--accent-2);
  border-radius: 1px;
  animation: eqBounce 0.75s ease-in-out infinite alternate;
}
.track-eq-anim i:nth-child(1) { height: 50%; animation-delay: 0.1s; }
.track-eq-anim i:nth-child(2) { height: 100%; animation-delay: 0.35s; }
.track-eq-anim i:nth-child(3) { height: 35%; animation-delay: 0.2s; }

@keyframes eqBounce {
  0% { height: 20%; }
  100% { height: 100%; }
}

table.rows tbody tr.is-playing .track-num-text {
  display: none;
}
table.rows tbody tr.is-playing .track-eq-anim {
  display: inline-flex;
}
table.rows tbody tr.is-playing.is-paused .track-eq-anim i {
  animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
  .track-eq-anim i { animation: none; }
}

/* Mobile Track Cards (PL-16) */
@media (max-width: 768px) {
  .playlist-tracklist-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .playlist-toolbar { width: 100%; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
  .playlist-filter-form { width: 100%; display: flex; align-items: center; position: relative; gap: 4px; }
  .playlist-filter-input { width: 100%; min-width: 0; box-sizing: border-box; }
  .view-toggle { width: 100%; display: flex; }
  .view-opt { flex: 1; text-align: center; }
  .track-table-wrap,
  .album-table-wrap { overflow-x: visible; }
  table.rows.track-table thead,
  table.rows.album-table thead { display: none; }
  table.rows.track-table,
  table.rows.track-table tbody,
  table.rows.album-table,
  table.rows.album-table tbody {
    display: block;
    width: 100%;
  }
  table.rows.track-table tbody tr.playlist-album-heading td,
  table.rows.track-table tbody tr.playlist-other-heading td {
    display: block;
    padding: 12px 0 4px;
  }

  /* Track Cards (Tracks list & Playlist) */
  table.rows.track-table tbody tr:not(.playlist-album-heading):not(.playlist-other-heading) {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    grid-template-areas:
      "play title  length"
      "play artist flags";
    align-items: center;
    column-gap: 8px;
    row-gap: 2px;
    padding: 8px 10px;
    margin-bottom: 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-sizing: border-box;
    transition: border-color .15s ease, background .15s ease;
  }
  table.rows.track-table tbody tr.is-playing:not(.playlist-album-heading):not(.playlist-other-heading) {
    border-color: var(--accent-2);
    background: color-mix(in srgb, var(--accent-2) 12%, var(--surface)) !important;
  }
  table.rows.track-table tbody td { padding: 0; border-bottom: 0; min-width: 0; }
  table.rows.track-table tbody td.cell-play {
    grid-area: play;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px !important;
  }
  table.rows.track-table tbody td.cell-num { display: none; }
  table.rows.track-table tbody td.cell-title {
    grid-area: title;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  table.rows.track-table tbody td.cell-title a { color: var(--text); text-decoration: none; }
  table.rows.track-table tbody td.cell-artist {
    grid-area: artist;
    font-size: 11.5px;
    color: var(--text-dim);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  table.rows.track-table tbody td.cell-artist a { color: var(--text-dim); text-decoration: none; }
  table.rows.track-table tbody tr.is-playing td.cell-title a,
  table.rows.track-table tbody tr.is-playing td.cell-artist a { color: var(--now-playing); }
  table.rows.track-table tbody td.cell-album { display: none; }
  table.rows.track-table tbody td.cell-flags {
    grid-area: flags;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
    min-width: 0;
  }
  table.rows.track-table tbody td.cell-flags .tag { font-size: 9px; padding: 1px 3px; }
  table.rows.track-table tbody td.cell-flags .tag-spec { display: none; }
  table.rows.track-table tbody td.cell-length {
    grid-area: length;
    font-size: 11px;
    font-family: ui-monospace, monospace;
    color: var(--text-dim);
    text-align: right;
    white-space: nowrap;
    justify-self: end;
  }

  /* Album Cards (Albums list & Search) */
  table.rows.album-table tbody tr {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    grid-template-areas:
      "thumb title  year"
      "thumb artist tracks";
    align-items: center;
    column-gap: 8px;
    row-gap: 2px;
    padding: 8px 10px;
    margin-bottom: 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-sizing: border-box;
    transition: border-color .15s ease, background .15s ease;
  }
  table.rows.album-table tbody td { padding: 0; border-bottom: 0; min-width: 0; }
  table.rows.album-table tbody td.cell-thumb {
    grid-area: thumb;
    width: 36px !important;
    display: flex;
    align-items: center;
  }
  table.rows.album-table tbody td.cell-thumb .row-thumb {
    width: 36px;
    height: 36px;
    border-radius: 4px;
  }
  table.rows.album-table tbody td.cell-title {
    grid-area: title;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  table.rows.album-table tbody td.cell-title a { color: var(--text); text-decoration: none; }
  table.rows.album-table tbody td.cell-artist {
    grid-area: artist;
    font-size: 11.5px;
    color: var(--text-dim);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  table.rows.album-table tbody td.cell-artist a { color: var(--text-dim); text-decoration: none; }
  table.rows.album-table tbody td.cell-year {
    grid-area: year;
    font-size: 11px;
    font-family: ui-monospace, monospace;
    color: var(--text-dim);
    text-align: right;
    white-space: nowrap;
    justify-self: end;
  }
  table.rows.album-table tbody td.cell-tracks {
    grid-area: tracks;
    font-size: 11px;
    font-family: ui-monospace, monospace;
    color: var(--text-dim);
    text-align: right;
    white-space: nowrap;
    justify-self: end;
  }

  /* Artist Cards (Artists list & Search) */
  table.rows.artist-table tbody tr {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    grid-template-areas:
      "av name lib"
      "av name qobuz";
    align-items: center;
    column-gap: 8px;
    row-gap: 2px;
    padding: 8px 10px;
    margin-bottom: 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-sizing: border-box;
    transition: border-color .15s ease, background .15s ease;
  }
  table.rows.artist-table tbody td { padding: 0; border-bottom: 0; min-width: 0; }
  table.rows.artist-table tbody td.cell-av {
    grid-area: av;
    width: 36px !important;
    display: flex;
    align-items: center;
  }
  table.rows.artist-table tbody td.cell-av .row-av {
    width: 36px;
    height: 36px;
    border-radius: 50%;
  }
  table.rows.artist-table tbody td.cell-name {
    grid-area: name;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  table.rows.artist-table tbody td.cell-name a { color: var(--text); text-decoration: none; }
  table.rows.artist-table tbody td.cell-lib-albums {
    grid-area: lib;
    font-size: 11px;
    font-family: ui-monospace, monospace;
    color: var(--text-dim);
    text-align: right;
    white-space: nowrap;
    justify-self: end;
  }
  table.rows.artist-table tbody td.cell-qobuz-albums {
    grid-area: qobuz;
    font-size: 11px;
    font-family: ui-monospace, monospace;
    color: var(--text-dim);
    text-align: right;
    white-space: nowrap;
    justify-self: end;
  }
}
