/* ClickBuddy — rozpiska z nagrania. Jasny i ciemny motyw za systemem (albo przełącznikiem, data-theme na <html>).
   Jeden akcent (żółć z ikony) tylko dla działania i bieżącej pozycji; kolory fragmentów niosą informację. */

:root {
  color-scheme: light;
  --bg: #F5F5F7;
  --surface: #FFFFFF;
  --raised: #EDEDF0;
  --hover: #F2F2F4;
  --line: rgba(0, 0, 0, 0.09);
  --line-strong: rgba(0, 0, 0, 0.18);
  --text: #1D1D1F;
  --dim: #6E6E73;
  --faint: #8E8E93;
  --accent: #F5B400;
  --accent-ink: #9A6400;
  --accent-soft: rgba(245, 180, 0, 0.16);
  --on-accent: #1D1D1F;
  --red: #D70015;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.05);
  --shadow-menu: 0 8px 30px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.06);
  --tick: rgba(0, 0, 0, 0.12);
  /* Fragmenty: pastelowe wypełnienie, napis w ciemnym odcieniu tej samej barwy. */
  --seg-base: #FFFFFF;
  --seg-mix: 34%;
  --seg-hover: 46%;
  --seg-now: 62%;
  --seg-ink-base: #000000;
  --seg-ink-mix: 58%;

  --c-intro: #6F7DB8;
  --c-verse: #3F9C93;
  --c-chorus: #D8695F;
  --c-bridge: #9370CF;
  --c-inst: #6FA85C;
  --c-break: #8A8A96;
  --c-outro: #5F6A8A;
  --c-other: #7C7C88;

  /* Zgodność ze starszymi stronami (app/): */
  --amber: var(--accent-ink);
  --cyan: var(--accent-ink);

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI Variable Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --radius: 10px;
  --radius-lg: 14px;
  --maxw: 1040px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000;
    --surface: #1C1C1E;
    --raised: #2C2C2E;
    --hover: #26262A;
    --line: rgba(255, 255, 255, 0.11);
    --line-strong: rgba(255, 255, 255, 0.22);
    --text: #F5F5F7;
    --dim: #98989D;
    --faint: #6E6E73;
    --accent: #FFB020;
    --accent-ink: #FFC24D;
    --accent-soft: rgba(255, 176, 32, 0.18);
    --on-accent: #1A1200;
    --red: #FF453A;
    --shadow: 0 16px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
    --shadow-menu: 0 10px 34px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08);
    --tick: rgba(255, 255, 255, 0.13);
    --seg-base: #1C1C1E;
    --seg-mix: 52%;
    --seg-hover: 64%;
    --seg-now: 84%;
    --seg-ink-base: #FFFFFF;
    --seg-ink-mix: 42%;
    --amber: var(--accent);
    --cyan: var(--accent-ink);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #1C1C1E;
  --raised: #2C2C2E;
  --hover: #26262A;
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.22);
  --text: #F5F5F7;
  --dim: #98989D;
  --faint: #6E6E73;
  --accent: #FFB020;
  --accent-ink: #FFC24D;
  --accent-soft: rgba(255, 176, 32, 0.18);
  --on-accent: #1A1200;
  --red: #FF453A;
  --shadow: 0 16px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --shadow-menu: 0 10px 34px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --tick: rgba(255, 255, 255, 0.13);
  --seg-base: #1C1C1E;
  --seg-mix: 52%;
  --seg-hover: 64%;
  --seg-now: 84%;
  --seg-ink-base: #FFFFFF;
  --seg-ink-mix: 42%;
  --amber: var(--accent);
  --cyan: var(--accent-ink);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
main { max-width: var(--maxw); margin: 0 auto; padding: 0 24px 140px; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
b { font-weight: 600; }
::selection { background: var(--accent-soft); }

/* Nagłówek ---------------------------------------------------------------- */
.top {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 24px 0;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand span { font-weight: 400; font-size: 14px; color: var(--dim); margin-left: 2px; }
.mark { width: 26px; height: 26px; border-radius: 7px; }
.top-end { display: flex; align-items: center; gap: 8px; }
.top-right { display: flex; align-items: center; gap: 8px; }
.theme-btn {
  width: 36px; height: 36px;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--dim);
  display: grid; place-items: center;
}
.theme-btn:hover { color: var(--text); background: var(--raised); }
.theme-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .sun { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-btn .sun { display: block; } :root:not([data-theme="light"]) .theme-btn .moon { display: none; } }
:root[data-theme="dark"] .theme-btn .sun { display: block; }
:root[data-theme="dark"] .theme-btn .moon { display: none; }
:root[data-theme="light"] .theme-btn .sun { display: none; }
:root[data-theme="light"] .theme-btn .moon { display: block; }

/* Przyciski --------------------------------------------------------------- */
.primary {
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  border-radius: 999px;
  padding: 0 20px;
  height: 44px;
  font-weight: 600;
  white-space: nowrap;
  transition: filter 0.12s ease, transform 0.08s ease;
}
.primary:hover:not(:disabled) { filter: brightness(1.05); }
.primary:active:not(:disabled) { transform: scale(0.98); }
.primary:disabled { opacity: 0.45; cursor: default; }
.ghost {
  background: var(--raised);
  color: var(--text);
  border: 0;
  border-radius: 999px;
  padding: 0 14px;
  height: 36px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.12s ease, transform 0.08s ease;
}
.ghost:hover:not(:disabled) { background: color-mix(in srgb, var(--raised) 80%, var(--text) 8%); }
.ghost:active:not(:disabled) { transform: scale(0.98); }
.ghost:disabled { opacity: 0.4; cursor: default; }
.ghost.on { background: var(--accent-soft); color: var(--accent-ink); }
.link {
  background: none; border: 0; padding: 0;
  color: var(--accent-ink);
  font-weight: 500;
}
.link:hover { text-decoration: underline; }

/* Wejście: jedno duże pole jak wyszukiwarka ----------------------------------- */
.intake { padding: 32px 0 8px; }
.urlbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 6px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.urlbar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.urlbar input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 10px;
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 16px;
}
.urlbar input::placeholder { color: var(--faint); }
.urlbar input:focus { outline: none; }
.urlbar .file-btn { flex: none; height: 40px; display: inline-flex; align-items: center; gap: 8px; }
.urlbar .file-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.urlbar .primary { height: 40px; }
/* Plik przeciągany nad stroną: pole zmienia się w strefę upuszczania. */
.intake.drop .urlbar { border-color: var(--accent); border-style: dashed; box-shadow: 0 0 0 4px var(--accent-soft); }
.intake.drop .file-btn { color: var(--accent-ink); background: var(--accent-soft); }
.hint { color: var(--dim); font-size: 14px; max-width: 64ch; margin: 12px 0 0; }

.status { margin-top: 20px; }
.status-line { display: flex; justify-content: space-between; gap: 12px; color: var(--text); }
.status-time { color: var(--dim); }
.status.error .status-line { color: var(--red); }
.bar { height: 4px; background: color-mix(in srgb, var(--text) 10%, transparent); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: 2px; transition: width 0.4s ease; }
.bar-fill.indeterminate { width: 30%; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }
.status.error .bar-fill { background: var(--red); width: 100%; animation: none; }
.status-actions { margin-top: 12px; }

/* Lista piosenek: grupy jak listy w iOS ---------------------------------------- */
.recent { padding: 28px 0 0; }
.recent h2 { font-weight: 600; font-size: 20px; letter-spacing: -0.01em; margin: 0 0 8px; }
.recent .group { margin-top: 28px; }
.recent .group:first-child { margin-top: 0; }
.recent .count { color: var(--faint); font-weight: 400; font-size: 15px; margin-left: 6px; }
.recent .group-empty { margin: 4px 0 0; font-size: 14px; }
.recent-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.recent-list li + li { border-top: 1px solid var(--line); }
.recent-list button {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto auto 16px;
  gap: 16px;
  align-items: center;
  text-align: left;
  background: none;
  border: 0;
  padding: 13px 14px 13px 16px;
  color: var(--text);
  font-size: 15px;
}
.recent-list button:hover { background: var(--hover); }
.recent-list button::after {
  content: "";
  width: 8px; height: 8px;
  border-right: 1.5px solid var(--faint); border-bottom: 1.5px solid var(--faint);
  transform: rotate(-45deg);
  justify-self: center;
}
.recent-list .rt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.recent-list .rs { color: var(--dim); font-size: 14px; }
.recent-list .rs.error { color: var(--red); }
.recent-list .rd { color: var(--faint); font-size: 14px; }

/* Piosenka ---------------------------------------------------------------- */
.song { padding-top: 30px; }
.song-head { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.title {
  flex: 1;
  min-width: 240px;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 2px 8px;
  margin-left: -8px;
  color: var(--text);
  transition: background 0.12s ease;
}
.title:hover { background: var(--raised); }
.title:focus { outline: none; background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.title:read-only:hover { background: transparent; }
.song-meta { color: var(--dim); white-space: nowrap; font-size: 15px; }
.song-meta b { color: var(--text); font-weight: 600; }
.song-meta i { display: inline-block; width: 18px; }
.song-meta .warn { color: var(--accent-ink); }

.song-where { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 8px; color: var(--dim); font-size: 14px; }
.song-where label { display: inline-flex; align-items: center; gap: 8px; }
.song-owner { color: var(--faint); }
.song-note { color: var(--faint); }
.song-last { color: var(--faint); }

.transport { display: flex; align-items: center; gap: 12px; margin-top: 26px; }
.play {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--text);
  color: var(--bg);
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: transform 0.08s ease;
}
.play:hover { transform: scale(1.04); }
.play:active { transform: scale(0.96); }
.play svg { width: 16px; height: 16px; fill: currentColor; }
.time { color: var(--dim); min-width: 38px; font-size: 14px; }
.time:last-of-type { text-align: right; }
.seek { flex: 1; appearance: none; height: 4px; background: color-mix(in srgb, var(--text) 14%, transparent); border-radius: 2px; margin: 0; cursor: pointer; }
.seek::-webkit-slider-thumb { appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.seek::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--text); }
.source { color: var(--faint); font-size: 13px; max-width: 30%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source[href]:hover { color: var(--accent-ink); }
.source:not([href]) { cursor: default; text-decoration: none; }

/* Ścieżka aranżacji: bloki fragmentów z nazwą w środku i kreskami taktów — bohater strony ------ */
.grid-wrap { position: relative; margin-top: 16px; }
.grid { display: flex; gap: 3px; height: 76px; }
.seg {
  position: relative;
  display: flex;
  min-width: 0;
  border-radius: 10px;
  background: color-mix(in srgb, var(--c) var(--seg-mix), var(--seg-base));
}
.seg-label {
  position: absolute;
  left: 10px; top: 8px;
  right: 8px;
  font-size: 13px;
  font-weight: 600;
  color: color-mix(in srgb, var(--c) var(--seg-ink-mix), var(--seg-ink-base));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.seg.narrow .seg-label { display: none; }
.cell {
  flex: 1 1 0;
  min-width: 3px;
  background: transparent;
  cursor: pointer;
  transition: background 0.12s ease;
}
.cell + .cell { border-left: 1px solid var(--tick); }
.cell.group { border-left-color: color-mix(in srgb, var(--tick) 100%, var(--text) 18%); }
.cell:first-child { border-radius: 10px 0 0 10px; }
.cell:not(:has(+ .cell)) { border-radius: 0 10px 10px 0; }
.cell:first-child:not(:has(+ .cell)) { border-radius: 10px; }
.cell:hover { background: color-mix(in srgb, var(--c) var(--seg-hover), var(--seg-base)); }
.cell.now { background: color-mix(in srgb, var(--c) var(--seg-now), var(--seg-base)); }
.cell.dead { background: repeating-linear-gradient(135deg, var(--raised) 0 4px, var(--surface) 4px 8px); cursor: default; }
.cut {
  position: absolute;
  top: -4px; bottom: -4px;
  width: 9px;
  transform: translateX(-50%);
  cursor: col-resize;
  z-index: 2;
}
.cut::after {
  content: "";
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  width: 2px;
  transform: translateX(-50%);
  background: var(--text);
  opacity: 0;
  transition: opacity 0.12s ease;
}
.cut:hover::after { opacity: 1; }
/* Uchwyt granicy między fragmentami: kreska w przerwie, w trakcie przeciągania etykieta z podziałem taktów. */
.handle {
  position: absolute;
  top: -6px; bottom: -6px;
  left: 0;
  width: 14px;
  transform: translateX(calc(-50% - 1.5px));
  cursor: ew-resize;
  z-index: 4;
  touch-action: none;
  border-radius: 4px;
}
.handle:focus-visible { outline-offset: -2px; }
.handle::after {
  content: "";
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  width: 3px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: var(--text);
  opacity: 0.28;
  transition: opacity 0.12s ease, background 0.12s ease;
}
.handle:hover::after, .handle:focus-visible::after, .handle.hl::after { opacity: 1; }
.handle.dragging::after { background: var(--accent); opacity: 1; box-shadow: 0 0 0 1px var(--bg); }
.handle::before {
  content: attr(data-tip);
  position: absolute;
  left: 50%; bottom: calc(100% + 8px);
  transform: translateX(-50%);
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}
.handle.dragging::before, .handle:focus-visible::before { opacity: 1; }
.grid.dragging { cursor: ew-resize; user-select: none; }
.grid.dragging .cell { cursor: ew-resize; }
.playhead {
  position: absolute;
  top: -6px;
  height: 88px;
  width: 2px;
  background: var(--text);
  box-shadow: 0 0 0 1px var(--bg);
  pointer-events: none;
  z-index: 3;
}
.playhead::before {
  content: "";
  position: absolute;
  top: -4px; left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top: 6px solid var(--text);
}
.seg.now .seg-label { color: color-mix(in srgb, var(--c) 30%, var(--seg-ink-base)); }
.grid-hint { color: var(--faint); font-size: 13px; max-width: 72ch; margin: 12px 0 0; }

/* Propozycja AI: cichy link, a potem szara wkładka bez ramki ------------------------ */
.ai-cta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 22px; color: var(--faint); font-size: 13px; }
.ai-cta .ghost { height: 32px; font-size: 13px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; }
.ai-cta .ghost::before { content: "✦"; font-size: 11px; color: var(--accent-ink); }
.proposal { margin-top: 24px; padding: 16px 18px 14px; border-radius: var(--radius-lg); background: var(--raised); }
.proposal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.proposal h2 { font-weight: 600; font-size: 15px; margin: 0; }
.proposal-state { color: var(--dim); font-size: 13px; }
.proposal-state.working::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); margin-right: 8px; vertical-align: 1px;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
.proposal-state.error { color: var(--red); }
.proposal-summary { color: var(--dim); font-size: 14px; max-width: 78ch; margin: 8px 0 0; }
.proposal-grid { height: 30px; margin-top: 12px; padding-bottom: 20px; position: relative; --seg-base: var(--surface); }
.proposal-grid .seg { border-radius: 6px; }
.proposal-grid .cell:first-child { border-radius: 6px 0 0 6px; }
.proposal-grid .cell:not(:has(+ .cell)) { border-radius: 0 6px 6px 0; }
.proposal-grid .seg-label { top: calc(100% + 5px); left: 2px; right: auto; max-width: 100%; font-weight: 500; font-size: 12px; color: var(--dim); }
.proposal-grid .cell { cursor: default; }
.proposal-grid .cell:hover { background: transparent; }
.proposal-grid .seg.changed { box-shadow: inset 0 -2px 0 var(--accent); }
.proposal-notes { list-style: none; margin: 10px 0 0; padding: 0; color: var(--dim); font-size: 13px; }
.proposal-notes li { padding: 2px 0; }
.proposal-notes b { color: var(--text); font-weight: 500; }
.proposal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.proposal-actions .primary, .proposal-actions .ghost { height: 32px; font-size: 13px; padding: 0 12px; }
.proposal-actions .primary { background: var(--accent-soft); color: var(--accent-ink); }
.proposal-actions .ghost { background: var(--surface); }
.proposal-grid-note { color: var(--accent-ink); font-size: 13px; margin: 8px 0 0; max-width: 78ch; }
.proposal-doubts { list-style: none; margin: 10px 0 0; padding: 0; color: var(--dim); font-size: 13px; }
.proposal-doubts li { padding: 2px 0 2px 14px; position: relative; }
.proposal-doubts li::before { content: "?"; position: absolute; left: 0; color: var(--accent-ink); font-weight: 600; }
.proposal-doubts li.head { padding-left: 0; color: var(--text); font-weight: 500; }
.proposal-doubts li.head::before, .proposal-doubts li.err::before { content: none; }
.proposal-doubts li.err { padding-left: 0; color: var(--red); }
.proposal-followup { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.proposal-followup input { flex: 1 1 280px; height: 34px; font-size: 13px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); }
.proposal-followup .ghost { height: 34px; font-size: 13px; padding: 0 14px; background: var(--surface); }
.ai-cta .ai-hint { flex: 1 1 260px; height: 32px; font-size: 13px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); }
.grid-tools { margin-top: 14px; font-size: 13px; color: var(--dim); }
.grid-tools summary { cursor: pointer; color: var(--dim); list-style: none; display: inline-flex; gap: 8px; align-items: baseline; }
.grid-tools summary::-webkit-details-marker { display: none; }
.grid-tools summary::before { content: "▸"; color: var(--faint); font-size: 11px; }
.grid-tools[open] summary::before { content: "▾"; }
.grid-tools .grid-current { color: var(--faint); }
.grid-warn { list-style: none; margin: 8px 0 0; padding: 0; color: var(--accent-ink); }
.grid-warn li { padding: 2px 0 2px 14px; position: relative; max-width: 78ch; }
.grid-warn li::before { content: "!"; position: absolute; left: 0; font-weight: 600; }
.grid-ops { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.grid-ops .ghost { height: 30px; font-size: 12.5px; padding: 0 10px; }
.grid-tools-hint { color: var(--faint); font-size: 12.5px; max-width: 78ch; margin: 8px 0 0; }
.lyrics { margin: 14px 0 0; padding: 0; list-style: none; color: var(--dim); font-size: 13px; columns: 2; column-gap: 32px; }
.lyrics li { break-inside: avoid; padding: 2px 0; }
.lyrics b { color: var(--faint); font-weight: 400; display: inline-block; min-width: 64px; }
@media (max-width: 760px) { .lyrics { columns: 1; } .proposal { padding: 14px; } }

/* Lista fragmentów: grupa jak w iOS ------------------------------------------------ */
.sections { margin-top: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.row { position: relative; scroll-margin: 16px 0 110px; }
.row + .row { border-top: 1px solid var(--line); }
/* Bieżący fragment nagrania: żółta krawędź i lekkie tło, numer taktu przy nazwie, pasek postępu na dole. */
.row.now { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.row.now .idx { color: var(--accent-ink); }
.row.now::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  height: 2px;
  width: calc(var(--p, 0) * 100%);
  background: var(--accent);
  pointer-events: none;
}
.name-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.name-cell .name { flex: 1; min-width: 0; font-weight: 500; }
.now-badge {
  display: none;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 5px 9px;
  white-space: nowrap;
}
.row.now .now-badge { display: inline-block; }
.row-main {
  display: grid;
  grid-template-columns: 26px 12px minmax(120px, 1fr) auto auto auto 52px auto;
  align-items: center;
  gap: 14px;
  padding: 8px 12px 8px 14px;
}
.idx { color: var(--faint); text-align: right; font-size: 13px; }
.chip { width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.row input[type="text"], .row input[type="number"], .row select {
  background: transparent;
  border: 0;
  border-radius: 7px;
  padding: 6px 6px;
  color: var(--text);
  min-width: 0;
  transition: background 0.12s ease;
}
.row input:hover, .row select:hover { background: var(--raised); }
.row input:focus, .row select:focus { outline: none; background: var(--raised); box-shadow: 0 0 0 3px var(--accent-soft); }
.row input[type="number"] { width: 58px; text-align: right; -moz-appearance: textfield; }
.row input.beats { width: 36px; }
.row input[type="number"]::-webkit-inner-spin-button { appearance: none; }
.row select { appearance: none; padding-right: 6px; cursor: pointer; }
.row select option { background: var(--surface); }
.field { display: inline-flex; align-items: baseline; gap: 3px; color: var(--dim); white-space: nowrap; font-size: 14px; }
.field .sep { color: var(--faint); }
/* Zakres taktów: początek wynika z poprzednich fragmentów, koniec to granica z następnym (pole + ‹ ›). */
.field.range { align-items: center; gap: 3px; }
.field.range .rng-lbl { color: var(--faint); }
.field.range .rng-start, .field.range .rng-end { color: var(--text); padding: 6px 0; }
.row .field.range .end { width: 42px; text-align: left; padding-left: 5px; }
.field.range .cnt { color: var(--faint); margin-left: 6px; }
.nudges { display: inline-flex; gap: 1px; margin-left: 2px; }
.nudge {
  width: 24px; height: 24px;
  padding: 0; border: 0; border-radius: 6px;
  background: transparent;
  color: var(--faint);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.nudge:hover:not(:disabled) { color: var(--text); background: var(--raised); }
.nudge:disabled { opacity: 0.3; cursor: default; }
.nudge svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dur { color: var(--faint); text-align: right; font-size: 14px; }
.actions { display: flex; gap: 2px; }
.icon {
  width: 30px; height: 30px;
  border: 0; border-radius: 8px;
  background: transparent;
  color: var(--faint);
  display: grid; place-items: center;
  transition: color 0.12s ease, background 0.12s ease;
}
.row:hover .icon { color: var(--dim); }
.icon:hover:not(:disabled), .row:hover .icon:hover:not(:disabled) { color: var(--text); background: var(--raised); }
.icon:disabled { opacity: 0.3; cursor: default; }
.icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.danger:hover { color: var(--red); }
.icon.on, .row:hover .icon.on { color: var(--accent-ink); background: var(--accent-soft); }

.row-more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 22px;
  padding: 2px 14px 14px 66px;
  color: var(--dim);
  font-size: 14px;
}
.row-more label { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.row-more input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }
.row-more input[type="text"] { min-width: 200px; }
.row-more .spacer { flex: 1; }
/* Długość fragmentu (zmienia sumę taktów) celowo schowana pod ⋯, z jawnym ostrzeżeniem. */
.len { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.row .len .bars { width: 44px; text-align: center; }
.len em { font-style: normal; color: var(--faint); font-size: 13px; margin-left: 6px; }
@media (pointer: coarse) {
  .nudge { width: 32px; height: 32px; }
  .handle { width: 22px; }
  .icon { color: var(--dim); }
}

.row-split {
  padding: 2px 14px 16px 66px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  color: var(--dim);
  font-size: 14px;
}
.split-strip { display: flex; height: 28px; flex: 1; min-width: 160px; max-width: 520px; position: relative; border-radius: 7px; background: color-mix(in srgb, var(--c) var(--seg-mix), var(--seg-base)); }
.split-strip .cell { cursor: default; }
.split-strip .cell:first-child { border-radius: 7px 0 0 7px; }
.split-strip .cell:not(:has(+ .cell)) { border-radius: 0 7px 7px 0; }
.split-strip .cell:hover { background: transparent; }
.split-strip .cell.left { background: color-mix(in srgb, var(--c) var(--seg-now), var(--seg-base)); }
.split-strip .cut::after { opacity: 0.25; }
.split-strip .cut.chosen::after { opacity: 1; background: var(--accent); }
.split-strip .cut:hover::after { opacity: 1; }
.split-words b { color: var(--text); font-weight: 600; }
.row-split .primary { height: 34px; padding: 0 16px; font-size: 14px; }
.row-split .ghost { height: 34px; font-size: 14px; }

.sections-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 14px; }
.foot-left { display: flex; gap: 8px; flex-wrap: wrap; }
.restore { color: var(--dim); font-size: 13px; }

/* Pasek eksportu: pływająca wyspa --------------------------------------------- */
.exportbar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(var(--maxw), calc(100% - 32px));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px 12px 10px 18px;
  border-radius: 22px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  backdrop-filter: blur(24px) saturate(1.5);
  box-shadow: var(--shadow);
  z-index: 8;
}
.exportbar > div { display: flex; align-items: center; gap: 12px; min-width: 0; }
.import-hint { display: none; }
.saved { color: var(--faint); font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved.warn { color: var(--accent-ink); }
/* Link do aplikacji (tylko telefon/tablet, pokazuje go app.js) — wygląda jak przycisk. */
a.app-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; white-space: nowrap; }
.exportbar .primary { height: 40px; }
.exportbar .ghost { height: 36px; }

.toast {
  position: fixed;
  left: 50%; bottom: 92px;
  transform: translateX(-50%);
  max-width: min(560px, calc(100% - 32px));
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  font-size: 14px;
  font-weight: 500;
  z-index: 10;
  animation: toast-in 0.18s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Blokada edycji: przełącznik jak w iOS ---------------------------------------- */
.switch { position: relative; display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; color: var(--dim); font-size: 14px; white-space: nowrap; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .knob {
  position: relative; width: 40px; height: 24px; flex: none;
  border-radius: 999px; background: var(--line-strong);
  transition: background 0.18s ease;
}
.switch .knob::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.35); transition: transform 0.18s ease;
}
.switch input:checked + .knob { background: var(--accent); }
.switch input:checked + .knob::after { transform: translateX(16px); }
.switch input:focus-visible + .knob { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:checked ~ .switch-text { color: var(--text); }
.lock-tag { display: inline-flex; align-items: center; gap: 5px; color: var(--accent-ink); }
.lock-tag svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.recent-list .rt .lock-tag { margin-right: 6px; vertical-align: -2px; }

/* Zablokowana rozpiska: pola wyglądają jak tekst, znikają przyciski edycji, siatka bez uchwytów. */
.song.locked .title, .song.locked .row input, .song.locked .row select { background: transparent !important; box-shadow: none !important; cursor: default; }
.song.locked .row select { opacity: 1; color: var(--text); }
.song.locked .row input[type="checkbox"] { opacity: 0.6; }
.song.locked .nudges, .song.locked .len .nudge, .song.locked .len em,
.song.locked .actions .icon:not(.act-listen):not(.act-more),
.song.locked .row-more .icon { display: none; }

dialog.confirm {
  background: var(--surface); color: var(--text);
  border: 0; border-radius: 20px;
  padding: 26px 28px; max-width: min(460px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}
dialog.confirm::backdrop { background: rgba(0,0,0,0.35); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
dialog.confirm h2 { font-weight: 700; font-size: 22px; letter-spacing: -0.015em; margin: 0 0 10px; }
dialog.confirm p { color: var(--dim); font-size: 14px; line-height: 1.5; margin: 0 0 16px; }
dialog.confirm .ack { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; margin-bottom: 20px; }
dialog.confirm .ack input { accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.confirm-actions .primary { height: 40px; padding: 0 18px; }
.confirm-actions .ghost { height: 40px; padding: 0 16px; }

/* Nagłówek: przestrzeń robocza i menu użytkownika --------------------------- */
select.workspace, .song-where select {
  height: 34px; padding: 0 28px 0 12px; max-width: 220px;
  background: var(--raised) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236E6E73' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center / 13px;
  border: 0; border-radius: 999px; color: var(--text);
  font-weight: 500; font-size: 14px;
  appearance: none; cursor: pointer; text-overflow: ellipsis;
}
select.workspace:hover, .song-where select:hover { background-color: color-mix(in srgb, var(--raised) 80%, var(--text) 8%); }
select.workspace option, .song-where select option { background: var(--surface); color: var(--text); font-weight: 400; }
.user-menu { position: relative; }
.user-btn { display: inline-flex; align-items: center; gap: 8px; max-width: 200px; padding: 0 12px 0 6px; }
.user-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn svg { width: 26px; height: 26px; flex: none; padding: 5px; border-radius: 50%; background: var(--surface); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 180px; z-index: 20;
  background: var(--surface); border-radius: 12px;
  box-shadow: var(--shadow-menu); padding: 6px; display: flex; flex-direction: column;
  animation: menu-in 0.14s ease-out;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.menu-item { background: none; border: 0; text-align: left; padding: 9px 12px; border-radius: 8px; color: var(--text); font-size: 14px; }
.menu-item:hover { background: var(--raised); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-item.quiet { color: var(--dim); font-size: 13px; }

/* Logowanie ---------------------------------------------------------------- */
.auth { display: flex; justify-content: center; padding: 48px 0 20px; }
.auth-box { width: min(420px, 100%); }
.auth-invite {
  margin: 0 0 18px; padding: 12px 16px; border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--text); font-size: 14px;
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form h2 { font-weight: 700; font-size: 28px; letter-spacing: -0.02em; margin: 0 0 4px; }
.auth-form h3 { font-weight: 600; font-size: 18px; margin: 18px 0 0; }
.auth-hint { color: var(--dim); font-size: 14px; margin: -6px 0 2px; line-height: 1.5; }
.auth-hint b { color: var(--text); font-weight: 600; }
.af { display: block; font-size: 14px; color: var(--dim); }
.af small { color: var(--faint); margin-left: 6px; }
.af input, .af select { display: block; width: 100%; margin-top: 6px; }
.af input {
  height: 44px; padding: 0 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); font-size: 16px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.af input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.af input.code { font-size: 26px; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; }
.auth-error { margin: 0; color: var(--red); font-size: 14px; }
.auth-form .primary { height: 46px; margin-top: 4px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 0; font-size: 14px; }
.auth-links .link:disabled { color: var(--faint); text-decoration: none; cursor: default; }
.auth-form.inline { max-width: 420px; margin-top: 20px; }
.auth-form.inline .ghost { align-self: flex-start; height: 40px; }

/* Google / Facebook */
.oauth { display: flex; flex-direction: column; gap: 10px; margin: 2px 0 4px; }
.oauth-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; height: 46px; padding: 0 16px;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-size: 15px; font-weight: 500; text-decoration: none; cursor: pointer;
  transition: background 0.12s ease, transform 0.08s ease, border-color 0.12s ease;
}
.oauth-btn:hover { background: var(--raised); }
.oauth-btn:active { transform: scale(0.99); }
.oauth-btn svg { width: 20px; height: 20px; flex: none; }
.oauth-btn.facebook { background: #1877f2; border-color: #1877f2; color: #fff; }
.oauth-btn.facebook:hover { background: #166fe0; }
.oauth-or { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 13px; margin: 2px 0 -2px; }
.oauth-or::before, .oauth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.lang-switch { margin: 28px 0 0; text-align: center; font-size: 13px; }
.lang-switch .link { color: var(--dim); font-weight: 500; }
.auth-foot { margin: 18px 0 0; text-align: center; font-size: 12.5px; line-height: 1.6; color: var(--faint); }
.auth-foot a { color: var(--dim); text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }

/* Konto: sposoby logowania */
.acc-h { font-weight: 600; font-size: 18px; margin: 26px 0 6px; }
.methods { list-style: none; margin: 14px 0 0; padding: 0; max-width: 560px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.methods li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.methods li:first-child { border-top: 0; }
.methods .m-ico { width: 22px; height: 22px; flex: none; color: var(--dim); }
.methods .m-ico svg { width: 22px; height: 22px; }
.methods .m-name { width: 84px; flex: none; font-size: 14px; color: var(--dim); }
.methods .m-val { flex: 1; min-width: 120px; font-size: 15px; word-break: break-all; }
.methods .m-val.none { color: var(--faint); }
.methods .m-val .badge { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--accent-soft); color: var(--accent-ink); }
.methods .m-acts { display: flex; gap: 14px; font-size: 14px; }
.methods .m-acts a { text-decoration: none; }

/* Strony: zespoły, konto --------------------------------------------------- */
.page { padding: 28px 0 0; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h2 { font-weight: 700; font-size: 30px; letter-spacing: -0.02em; margin: 0; }
.page .hint b { color: var(--text); font-weight: 600; }
.team-new { display: flex; gap: 8px; margin: 22px 0 8px; max-width: 520px; }
.team-new input {
  flex: 1; min-width: 0; height: 44px; padding: 0 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); font-size: 16px;
}
.team-new input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.team-card { margin-top: 18px; padding: 18px 20px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.team-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.team-head h3 { font-weight: 600; font-size: 20px; letter-spacing: -0.01em; margin: 0; }
.team-head .role { color: var(--faint); font-size: 13px; }
.team-head .spacer { flex: 1; }
.members { list-style: none; margin: 12px 0 0; padding: 0; }
.members li { display: flex; align-items: baseline; gap: 14px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.members li:first-child { border-top: 0; }
.members .mname { color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.members .mname em { font-style: normal; color: var(--faint); }
.members .mphone { color: var(--faint); }
.members .mrole { color: var(--faint); font-size: 13px; flex: 1; }
.invite { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.invite-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.invite-label { color: var(--dim); font-size: 14px; margin-right: 4px; }
.invite-url {
  flex: 1; min-width: 200px; height: 36px; padding: 0 12px; font-size: 13px;
  background: var(--raised); border: 0; border-radius: 999px; color: var(--text);
}
.invite-off { color: var(--faint); font-size: 14px; }
.invite .hint { font-size: 13px; margin-top: 8px; }
.team-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.ghost.danger:hover:not(:disabled), .link.danger { color: var(--red); }
.primary.danger { background: var(--red); color: #fff; }
.ask-input { margin: 6px 0 20px; }

.recent-list .ro { color: var(--faint); margin-left: 10px; font-size: 13px; font-weight: 400; }

/* Historia zmian ------------------------------------------------------------ */
.history { margin-top: 16px; padding: 16px 18px 12px; background: var(--raised); border-radius: var(--radius-lg); }
.history-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.history-head h2 { font-weight: 600; font-size: 15px; margin: 0; }
.history-head .hint { flex: 1; margin: 0; font-size: 13px; min-width: 200px; }
.history-head .ghost { background: var(--surface); height: 32px; font-size: 13px; }
.history-list { list-style: none; margin: 12px 0 0; padding: 0; }
.h-item { display: grid; grid-template-columns: 96px 150px 1fr auto; gap: 12px; align-items: baseline; padding: 8px 8px; border-top: 1px solid var(--line); font-size: 14px; }
.h-item.current { background: var(--surface); border-radius: 8px; border-top-color: transparent; }
.h-item.current + .h-item { border-top-color: transparent; }
.h-item.minor .h-what { color: var(--faint); }
.h-when { color: var(--faint); white-space: nowrap; }
.h-who { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-who em { font-style: normal; color: var(--faint); }
.h-what { color: var(--dim); min-width: 0; }
.h-item.current .h-what { color: var(--text); }
.h-tag { color: var(--accent-ink); background: var(--accent-soft); border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.h-empty { color: var(--faint); padding: 8px 0; }
@media (max-width: 760px) {
  .h-item { grid-template-columns: auto 1fr auto; }
  .h-what { grid-column: 1 / -1; }
}

/* Dokąd trafia nowa piosenka (pod polem linku) -------------------------------- */
.dest { display: inline-flex; align-items: center; gap: 10px; margin: 12px 0 0 8px; color: var(--dim); font-size: 14px; }
.dest select.workspace { height: 30px; font-size: 13px; }

/* Panel administratora (admin.js) ------------------------------------------- */
.admin-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 18px; }
.stat { padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.stat b { display: block; font-weight: 600; font-size: 24px; letter-spacing: -0.02em; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat span { color: var(--dim); font-size: 13px; }
.stat small { display: block; color: var(--faint); font-size: 12px; margin-top: 3px; line-height: 1.35; }
.stat.warn b { color: var(--accent-ink); }
.tabs { display: inline-flex; gap: 2px; margin-top: 22px; padding: 3px; background: var(--raised); border-radius: 999px; max-width: 100%; overflow-x: auto; }
.tab { background: none; border: 0; padding: 6px 14px; color: var(--dim); font-size: 14px; font-weight: 500; white-space: nowrap; border-radius: 999px; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.tab .count { color: var(--faint); font-size: 13px; margin-left: 6px; font-weight: 400; }
.admin-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 16px 0 12px; }
.admin-toolbar .search {
  flex: 1 1 220px; min-width: 0; height: 36px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; color: var(--text);
}
.admin-toolbar .search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.admin-toolbar select.workspace { height: 36px; }
.admin-toolbar .toolbar-hint { flex: 1 1 260px; margin: 0; font-size: 13px; }
.admin-toolbar .primary { height: 36px; padding: 0 16px; }
.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 500; color: var(--dim); font-size: 13px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--hover); }
.tbl td.num, .tbl th.num { text-align: right; white-space: nowrap; }
.tbl .nw { white-space: nowrap; }
.tbl .main { color: var(--text); font-weight: 500; }
.tbl a.main:hover { color: var(--accent-ink); text-decoration: none; }
.tbl .sub { display: block; color: var(--faint); font-size: 12px; margin-top: 2px; }
.tbl .off { color: var(--faint); font-style: italic; }
.tbl .acts { display: inline-flex; gap: 10px; flex-wrap: wrap; white-space: nowrap; align-items: baseline; }
.tbl .acts .link { font-size: 13px; }
.tbl .err { color: var(--red); display: block; font-size: 12px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.tbl .state.error { color: var(--red); }
.tbl .state.run { color: var(--accent-ink); }
.tbl tr.empty td { color: var(--faint); text-align: center; padding: 28px 10px; }
.lock-mini { width: 13px; height: 13px; fill: none; stroke: var(--accent-ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -1px; margin-right: 5px; }
.badge {
  display: inline-block; padding: 1px 8px; margin-left: 6px; border-radius: 999px; vertical-align: 1px;
  font-size: 12px; font-weight: 500; background: var(--raised); color: var(--dim);
}
.badge.admin { color: var(--accent-ink); background: var(--accent-soft); }
.badge.me { color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-t { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--raised); font-size: 12px; color: var(--dim); white-space: nowrap; }
.chip-t.owner { color: var(--text); }
.chip-m { display: inline-flex; align-items: center; gap: 3px; padding: 2px 3px 2px 10px; border-radius: 999px; background: var(--raised); font-size: 13px; white-space: nowrap; }
.chip-m.owner { background: var(--accent-soft); }
.chip-m .star { color: var(--accent-ink); margin-right: 3px; }
.chip-m button { border: 0; background: none; color: var(--faint); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; padding: 0; font-size: 13px; line-height: 1; }
.chip-m button:hover { color: var(--text); background: var(--surface); }
.chip-m button[data-act="owner"]:hover { color: var(--accent-ink); }
.chip-m button[data-act="remove"]:hover { color: var(--red); }
.chips .link { font-size: 13px; }
.pager { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; color: var(--faint); font-size: 14px; }
.pager span { margin-right: auto; }
.admin .hint { font-size: 13px; }

/* Dialog z formularzem (admin.js) */
dialog.form-dialog { max-width: min(520px, calc(100vw - 32px)); width: 100%; }
.fd-fields { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.fd-fields .af select {
  height: 44px; padding: 0 36px 0 14px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236E6E73' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 14px;
  border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); appearance: none; cursor: pointer;
}
.fd-fields .af select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fd-fields .af select option { background: var(--surface); }
.fd-fields .ack { margin: 0; align-items: flex-start; }
.fd-fields .ack input { margin-top: 1px; }
.fd-fields .ack small { display: block; color: var(--faint); font-size: 12px; }
.fd-radio { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.fd-radio legend { color: var(--dim); font-size: 14px; padding: 0; margin-bottom: 8px; }
.fd-radio label { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; }
.fd-radio input { accent-color: var(--accent); width: 18px; height: 18px; flex: none; margin: 1px 0 0; }
.fd-radio small { display: block; color: var(--faint); font-size: 12px; margin-top: 2px; }
dialog.form-dialog .fd-text { margin-bottom: 18px; }

/* Import z aplikacji Click Buddy (import.js) ---------------------------------- */
dialog.import-dialog { max-width: min(820px, calc(100vw - 24px)); width: 100%; }
.import-dialog textarea {
  display: block; width: 100%; min-height: 160px; resize: vertical; padding: 10px 12px;
  background: var(--raised); border: 1px solid transparent; border-radius: var(--radius); color: var(--text);
  font: 13px/1.45 ui-monospace, "SF Mono", Consolas, "Cascadia Mono", monospace;
}
.import-dialog textarea::placeholder { color: var(--faint); }
.import-dialog textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.imp-intake-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; color: var(--faint); font-size: 13px; }
.import-dialog .dest { margin: 0 0 12px; }
.import-dialog .tbl-wrap { max-height: min(52vh, 520px); overflow: auto; }
.imp-table th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.imp-table td.st { color: var(--dim); font-size: 13px; max-width: 300px; }
.imp-table td.st.new { color: var(--accent-ink); }
.imp-table td.st.warn { color: var(--accent-ink); }
.imp-table td.st.err { color: var(--red); }
.imp-table tr.skip .main { color: var(--dim); font-weight: 400; }
.imp-table select.workspace { height: 30px; max-width: 200px; font-size: 13px; }
.imp-table .off { white-space: nowrap; }
dialog.confirm p.imp-summary { color: var(--text); font-size: 15px; margin-bottom: 12px; }
.import-dialog .hint { font-size: 13px; margin-top: 10px; }
.import-dialog .auth-error { margin-top: 12px; }
.import-dialog .confirm-actions { margin-top: 16px; }
/* Piosenka bez nagrania (import z aplikacji): siatka tylko pokazuje podział, bez odsłuchu. */
.grid.mute .cell { cursor: default; }
.grid.mute .cell:hover { background: transparent; }
.song.noaudio .act-listen { display: none; }

/* Wąskie ekrany ----------------------------------------------------------- */
@media (max-width: 760px) {
  main { padding: 0 16px 160px; }
  .top { padding: 10px 16px 0; min-height: 52px; }
  .brand span { display: none; }
  .urlbar { padding: 5px; border-radius: 16px; }
  .urlbar input { padding: 0 8px; }
  .urlbar .file-btn { padding: 0 11px; }
  .urlbar .file-btn span { display: none; }
  .urlbar .primary { padding: 0 16px; }
  .dest { margin-left: 4px; }
  .title { font-size: 28px; }
  .song-meta { white-space: normal; font-size: 14px; }
  .song-meta i { width: 12px; }
  .row-main {
    grid-template-columns: 22px 12px 1fr auto;
    grid-template-areas:
      "idx chip name actions"
      ". . fields fields";
    gap: 6px 10px;
    padding: 10px 8px 10px 12px;
  }
  .idx { grid-area: idx; }
  .chip { grid-area: chip; }
  .name-cell { grid-area: name; }
  .actions { grid-area: actions; }
  .fields { grid-area: fields; display: flex; flex-wrap: wrap; gap: 4px 14px; }
  .dur { display: none; }
  .row-more, .row-split { padding-left: 12px; padding-right: 8px; }
  .exportbar { left: 0; right: 0; bottom: 0; transform: none; width: 100%; border-radius: 20px 20px 0 0; flex-wrap: wrap; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); gap: 10px; }
  .export-left { flex: 1 1 100%; gap: 10px; }
  .export-right { flex: 1 1 100%; }
  .export-right .primary, .export-right .ghost { flex: 1; }
  a.app-link { flex: 1 1 100%; order: -1; height: 46px; font-size: 16px; }
  .grid-hint { display: none; }
  .transport { flex-wrap: wrap; }
  .source { flex-basis: 100%; max-width: none; }
  .grid { gap: 2px; height: 60px; }
  .seg, .cell:first-child { border-radius: 8px 0 0 8px; }
  .seg { border-radius: 8px; }
  .cell:not(:has(+ .cell)) { border-radius: 0 8px 8px 0; }
  .seg-label { left: 8px; top: 6px; font-size: 12px; }
  .cell { min-width: 0; }
  .playhead { height: 72px; }
  .toast { bottom: 140px; }
  .top-right { gap: 6px; }
  .user-btn span { display: none; }
  .user-btn { padding: 0 5px; }
  .team-card { padding: 14px 14px 12px; }
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .stat b { font-size: 22px; }
  .tbl th, .tbl td { padding: 8px 8px; }
  dialog.confirm { padding: 22px 20px; border-radius: 18px; }
  dialog.import-dialog { padding: 18px 14px; }
  .imp-table th, .imp-table td { padding: 8px 6px; }
  .imp-table td:first-child { min-width: 120px; }
  .imp-table td.st { max-width: 170px; font-size: 12px; }
  .imp-table select.workspace { max-width: 122px; padding: 0 24px 0 8px; font-size: 12px; }
}
@media (min-width: 761px) {
  .fields { display: contents; }
  /* Wspólne kolumny dla wszystkich wierszy (subgrid): metrum, tempa i zakresy stoją w jednej linii. */
  .sections { display: grid; grid-template-columns: 26px 12px minmax(120px, 1fr) auto auto auto 52px auto; column-gap: 14px; }
  .row { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; column-gap: 14px; }
  .row-main { grid-column: 1 / -1; grid-template-columns: subgrid; column-gap: 14px; }
  .row-more, .row-split { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .bar-fill.indeterminate { width: 100%; opacity: 0.5; }
}
