:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #17202a;
  --muted: #64707d;
  --line: #dde2e7;
  --accent: #1e7bd8;
  --accent-text: #ffffff;
  --ok: #1d9a5b;
  --warn: #c98a0a;
  --bad: #d23b3b;
  --bar: #e4e8ec;
  --chip: #e8ecf0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1720;
    --card: #18222d;
    --text: #e6ebf0;
    --muted: #8d99a6;
    --line: #26323f;
    --accent: #4c9ff0;
    --accent-text: #08121c;
    --ok: #3cc47e;
    --warn: #e0a83a;
    --bad: #ef6262;
    --bar: #26323f;
    --chip: #222e3a;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2 { margin: 0; }

.btn {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  white-space: nowrap;
}
a.btn { display: inline-block; text-decoration: none; color: inherit; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn {
  border: 0; background: transparent; font-size: 20px; width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
  filter: grayscale(1); opacity: .55;
}
.icon-btn[aria-pressed="true"] { filter: none; opacity: 1; background: var(--chip); }
#menu-btn { filter: none; opacity: 1; font-weight: 700; }
input[type=text], input[type=search], input[type=password], input[type=url], textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
.muted { color: var(--muted); }
.error { color: var(--bad); min-height: 1.4em; margin: 0; }

/* login */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-box { width: 100%; max-width: 320px; display: grid; gap: 14px; text-align: center; }
.login-logo { justify-self: center; border-radius: 18px; }

/* layout */
.app { min-height: 100%; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand { font-size: 18px; flex: 1; white-space: nowrap; }
.brand-ver { font-size: 12px; font-weight: 400; color: var(--muted); opacity: .75; margin-left: 2px; }
.sys {
  display: flex; flex-direction: column; align-items: flex-end; font-size: 11px; line-height: 1.35;
  color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.sys .hot { color: var(--warn); }
/* phones: the load on its own thin row under the name and the speeds */
html:not(.wide) .top { flex-wrap: wrap; row-gap: 2px; }
html:not(.wide) .sys { order: 10; flex: 1 0 100%; flex-direction: row; justify-content: flex-start; gap: 4px; }
html:not(.wide) .sys > span + span::before { content: '· '; }
.rates { white-space: nowrap; }
.menu-about summary { list-style: none; }
.menu-about summary::-webkit-details-marker { display: none; }
.menu-about summary::after { content: ' ▸'; color: var(--muted); }
.menu-about[open] summary::after { content: ' ▾'; }
@media (max-width: 360px) { .brand-ver { display: none; } }
.rates { display: flex; flex-direction: column; align-items: flex-end; font-size: 12px; font-variant-numeric: tabular-nums; }
.rate.down { color: var(--ok); }
.rate.up { color: var(--accent); }
.menu {
  position: absolute; right: 12px; top: calc(100% + 4px);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px; min-width: 220px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
.menu-info { margin: 4px 8px 8px; font-size: 13px; color: var(--muted); white-space: pre-line; }
.menu-row { display: flex; align-items: center; gap: 10px; padding: 8px; font-size: 14px; }
.menu-row select { width: auto; flex: 1; padding: 6px 8px; }
.menu-row input[type=checkbox] { width: 18px; height: 18px; }
.menu-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 8px; border-radius: 8px; cursor: pointer; }
.menu-item:hover { background: var(--chip); }

main { flex: 1; width: 100%; max-width: 860px; margin: 0 auto; padding: 12px 12px calc(84px + env(safe-area-inset-bottom)); }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: center;
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  text-decoration: none;
  flex: 1; max-width: 200px; border: 0; background: none; padding: 8px 0 10px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: var(--muted);
}
.tab-icon { font-size: 20px; line-height: 1.2; }
.tab.on { color: var(--accent); font-weight: 600; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 0; background: var(--chip); border-radius: 999px; padding: 6px 12px; white-space: nowrap; cursor: pointer; font-size: 14px;
}
.chip b { font-weight: 600; opacity: .7; margin-left: 2px; }
.chip.on { background: var(--accent); color: var(--accent-text); }

/* torrent list */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.list > .item { min-width: 0; }
.item {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow);
}
.item-head { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.item-name { flex: 1; font-weight: 600; overflow-wrap: anywhere; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--chip); color: var(--muted); white-space: nowrap; }
.badge.dl { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.badge.seed { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.badge.err { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.badge.wait { color: var(--warn); }
.bar { height: 6px; background: var(--bar); border-radius: 3px; overflow: hidden; margin: 8px 0 6px; }
.bar > i { display: block; height: 100%; width: 0; background: var(--ok); border-radius: 3px; transition: width .4s; }
.bar.paused > i { background: var(--muted); }
.bar.seed > i { background: var(--accent); }
.bar.err > i { background: var(--bad); }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.item-error { color: var(--bad); font-size: 13px; margin-top: 4px; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.actions .btn { padding: 8px 12px; font-size: 14px; }
.actions .where { width: 100%; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.empty, .status { color: var(--muted); text-align: center; margin: 24px 0; }
.status { margin: 8px 0; }
.free { color: var(--muted); text-align: center; font-size: 13px; margin-top: 16px; }

/* search */
.search-bar { display: flex; gap: 8px; margin-bottom: 10px; }
.search-box { position: relative; flex: 1; min-width: 0; }
.search-bar select { width: auto; flex: 0 0 auto; max-width: 48%; }
.search-box input { padding-right: 40px; }
.search-box input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
.search-clear {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--chip); color: var(--muted);
  font-size: 14px; line-height: 1; cursor: pointer;
}
.search-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.search-tools select { width: auto; flex-shrink: 0; }
.recent { margin: 6px 0 10px; }
.recent-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.recent-list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.recent-list li { display: flex; align-items: center; border-top: 1px solid var(--line); }
.recent-list li:first-child { border-top: 0; }
.recent-q {
  flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; border: 0; background: none; color: inherit;
  text-align: left; padding: 11px 12px; cursor: pointer; font-size: 15px;
}
.recent-q span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-q .recent-cat { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.recent-q:hover { background: var(--chip); }
.recent-del { flex-shrink: 0; width: 40px; height: 40px; border: 0; background: none; color: var(--muted); font-size: 14px; cursor: pointer; border-radius: 50%; margin-right: 4px; }
.recent-del:hover { background: var(--chip); color: var(--bad); }
.rfilter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.rfilter .search-box { flex: 1 1 100%; }
.rfilter select { width: auto; flex: 1 1 40%; min-width: 0; max-width: 100%; }
.compact .recent-q { padding: 7px 10px; font-size: 14px; }
.compact .recent-del { width: 32px; height: 32px; }
.folder-pick { display: flex; align-items: center; gap: 8px; flex: 1; font-size: 14px; color: var(--muted); }
.folder-pick input { flex: 1; min-width: 0; }
.result { display: flex; gap: 10px; align-items: center; }
.result .body { flex: 1; min-width: 0; }
.result .item-name { font-weight: 500; }
.seeds { color: var(--ok); font-weight: 600; }
.add-btn {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--accent-text); font-size: 24px; line-height: 1; cursor: pointer;
}
.add-btn:disabled { background: var(--chip); color: var(--muted); }
.add-btn.done { background: var(--ok); }

/* add */
.add-form { display: grid; gap: 12px; }
.add-form textarea { resize: vertical; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.file-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.file-btn { display: inline-block; }
.check { display: flex; gap: 8px; align-items: center; }

.item-check { width: 20px; height: 20px; margin: 1px 0 0; flex: 0 0 auto; }
.item.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.sel-bar {
  position: sticky; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 4; display: flex; flex-wrap: wrap;
  align-items: center; gap: 6px; margin-top: 10px; padding: 10px; background: var(--card);
  border: 1px solid var(--accent); border-radius: 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}
.sel-count { font-weight: 600; flex: 1; }
.sel-actions { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; }
.sel-actions .btn { flex: 1; }

/* files of a torrent */
.files { margin-top: 8px; display: grid; gap: 6px; }
.files:empty { display: none; }
.file { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); }
.file-info { flex: 1; min-width: 160px; }
.file-name { font-size: 14px; overflow-wrap: anywhere; }
.file-size { font-size: 12px; }
.file-size { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.file-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.file-tags .badge { font-size: 10px; padding: 0 6px; }
.file-tags .badge.site-twitch, .file-tags .badge.site-youtube { padding: 0 5px; border-width: 1px; }
.badge.tag-res { color: var(--accent); font-weight: 600; }
.file-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.file-check { width: 18px; height: 18px; flex: 0 0 auto; margin: 0; }
.arch-bar { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; padding-top: 8px; border-top: 1px solid var(--line); }
.arch-go:disabled { opacity: .5; cursor: default; }
.arch-item { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
/* phones: the six buttons of an archived video on one row (from ~360px wide) */
html:not(.wide) .arch-item .file-btns { gap: 4px; }
html:not(.wide) .arch-item .file-btns .btn.small { padding: 6px 6px; }
.btn.small { padding: 6px 10px; font-size: 13px; }

/* share dialog */
.share-hours { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.share-hours select { width: auto; flex: 1; }
.share-help { font-size: 13px; }
#share-url { font-size: 13px; margin-top: 8px; }
.share-until { font-size: 13px; color: var(--warn); }

/* public watch page */
.watch { max-width: 1000px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 12px) 12px 24px; }
.watch-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.watch-head img { border-radius: 8px; }
.watch-title { font-size: 16px; overflow-wrap: anywhere; }
.watch video { display: block; width: 100%; max-height: 75vh; background: #000; border-radius: 10px; }
.watch-note { font-size: 14px; color: var(--muted); }
.watch-until { font-size: 13px; color: var(--warn); }
.watch-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* video player */
.player { border: 0; padding: 0; background: #000; color: #fff; width: min(100vw, 1100px); max-width: 100vw; max-height: 100vh; border-radius: 12px; }
.player::backdrop { background: rgba(0, 0, 0, .85); }
.player-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; }
.player-title { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-close { filter: none; opacity: 1; color: #fff; }
.player video { display: block; width: 100%; max-height: calc(100vh - 150px); background: #000; }
.player-note { margin: 8px 14px 0; font-size: 13px; color: #ccc; }
.player-note:empty { display: none; }
.player-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 10px 14px 14px; }
.player-actions .btn, .player-resume .btn { background: #222; border-color: #444; color: #fff; }

/* rss */
.rss-top { display: flex; gap: 6px; align-items: flex-start; }
.rss-feeds { flex: 1; min-width: 0; }
.rec-live { font-size: 13px; color: var(--bad); font-variant-numeric: tabular-nums; margin-top: 4px; }
.tv-limited .tv-play { opacity: .6; }
.tv-broken .tv-play { opacity: .35; }
.badge.tv-native { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--text); }
.chip-err { box-shadow: inset 0 0 0 1px var(--bad); }
.rss-feeds .chip { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.rss-feeds .chip.dragging { outline: 2px dashed var(--accent); outline-offset: 1px; opacity: .85; cursor: grabbing; }
.rss-feeds.sorting { scroll-behavior: auto; }
.rss-pins[hidden] { display: none; }
.rss-pins .chip { font-size: 13px; }
.chip.chip-empty { opacity: .45; }
.feed-pins { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.feed-pins label { white-space: nowrap; color: var(--muted); }
.feed-pins input { flex: 1; min-width: 180px; padding: 6px 8px; font-size: 13px; }
.rss-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; }
.rss-tools .check { flex: 1; }
.rss-item { display: flex; gap: 10px; align-items: flex-start; }
.rss-item input[type=checkbox] { width: 20px; height: 20px; margin-top: 2px; flex: 0 0 auto; }
.rss-item .body { flex: 1; min-width: 0; cursor: pointer; }
.rss-item .item-name { font-weight: 500; }
.rss-done { opacity: .6; }
.rss-bar {
  position: sticky; bottom: calc(70px + env(safe-area-inset-bottom)); display: flex; gap: 8px; align-items: center;
  flex-wrap: wrap; padding: 10px; margin-top: 10px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
}
.dialog.rss-dialog { width: min(96vw, 920px); max-width: 96vw; }
.rss-dialog-head { display: flex; align-items: center; justify-content: space-between; }
.rss-dialog-head .icon-btn { filter: none; opacity: 1; }
.rss-feed-list { display: grid; gap: 8px; margin: 10px 0; max-height: 60vh; overflow: auto; }
.feed-row { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: grid; gap: 6px; }
.feed-url { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.feed-err { font-size: 12px; color: var(--bad); }
.feed-when { font-size: 12px; }
.feed-controls { display: flex; gap: 6px; flex-wrap: wrap; }
.feed-controls select { width: auto; padding: 6px 8px; font-size: 13px; }
.rss-add-form { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.rss-add-form h3 { margin: 0; font-size: 15px; }
.rss-add-form select { width: auto; }
.tab { max-width: 130px; font-size: 11px; }

/* settings */
.settings-form { display: grid; gap: 12px; }
.set-section { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.set-title { font-size: 15px; margin-bottom: 6px; }
.settings-intro { margin: 4px 2px 12px; }
.settings-intro h2 { font-size: 18px; }
.settings-intro p { margin: 4px 0 0; font-size: 13px; }
.tv-settings-intro { margin-top: 24px; }
.tv-settings p { margin: 0; }
.tv-settings .set-row:first-child { border-top: 0; padding-top: 0; }
.tv-settings .set-hint { margin-top: 6px; }
.set-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.set-title + .set-row { border-top: 0; }
.set-label { flex: 1; min-width: 150px; font-size: 14px; }
.set-row input[type=number], .set-row input[type=time], .set-row select { width: 130px; flex: 0 0 auto; }
.set-row input[type=text] { flex: 1 1 220px; }
.set-bool input { width: 20px; height: 20px; margin: 0; flex: 0 0 auto; }
.set-unit { font-size: 13px; color: var(--muted); }
.set-hint { width: 100%; font-size: 12px; color: var(--muted); }
.set-value { font-variant-numeric: tabular-nums; color: var(--muted); }
.set-days { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.set-day { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.set-off { opacity: .45; }
.settings-bar {
  position: sticky; bottom: calc(70px + env(safe-area-inset-bottom)); display: flex; justify-content: flex-end; gap: 8px;
  padding: 10px 0; background: var(--bg);
}
.tab { max-width: 160px; }

/* dialog + toast */
.dialog { border: 0; border-radius: 16px; padding: 20px; background: var(--card); color: var(--text); width: min(92vw, 380px); }
.dialog::backdrop { background: rgba(0, 0, 0, .45); }
.remove-name { overflow-wrap: anywhere; color: var(--muted); }
.dialog-actions { display: grid; gap: 8px; margin-top: 16px; }
.toast {
  position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; max-width: 90vw;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 20; font-size: 14px;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast[popover] { inset: auto auto calc(80px + env(safe-area-inset-bottom)) 50%; margin: 0; border: 0; overflow: visible; }
.toast.bad { background: var(--bad); color: #fff; }

@media (min-width: 700px) {
  .top { padding-left: 20px; padding-right: 20px; }
  main { padding-top: 20px; }
}

/* ---------- table headers (computer layout only) ---------- */
.thead { display: none; }
.meta > span:empty { display: none; }
/* compact phone layout (one-line meta): the squeezed tag box wrapped its tags into a tall column, the whole line
   grew and stretched the "Diretta Twitch" frame of a live recording into a big oval. Badges keep their own size. */
.meta > .badge { flex: 0 0 auto; align-self: center; }
.compact .meta:not(.item.open .meta) > .file-tags { flex: 0 0 auto; flex-wrap: nowrap; }
.item { cursor: default; }
#torrents .item { cursor: pointer; }
/* Torrent names on one line (cut with …) in every layout; the full name shows when the row is open. */
#torrents .item-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#torrents .item.open .item-name { white-space: normal; overflow-wrap: anywhere; }

/* ---------- compact density (both layouts) ---------- */
.compact .list { gap: 4px; }
.compact .item { padding: 6px 10px; border-radius: 9px; }
.compact .item-name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compact .item.open .item-name { white-space: normal; overflow-wrap: anywhere; }
.compact .item-head { align-items: center; }
.compact .item-check { width: 18px; height: 18px; margin: 0; }
.compact .badge { font-size: 10px; padding: 1px 7px; }
.compact .bar { height: 3px; margin: 5px 0 4px; }
.compact .meta { font-size: 12px; gap: 2px 10px; }
.compact .meta { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; }
.compact .item.open .meta { flex-wrap: wrap; white-space: normal; }
.compact:not(.wide) .r-cat, .compact:not(.wide) .r-leech { display: none; }
.compact .result { gap: 8px; }
.compact .add-btn { width: 34px; height: 34px; font-size: 20px; }
.compact .chip { padding: 4px 10px; font-size: 13px; }
.compact .chips { padding-bottom: 8px; }
.compact .set-section { padding: 8px 12px; }
.compact .set-row { padding: 5px 0; }
.compact .tab { padding: 5px 0 7px; }
.compact .tab-icon { font-size: 18px; }

/* ---------- computer layout: sidebar, full width, table rows ---------- */
.wide .top { height: 56px; padding: 0 20px; }
.wide .brand { flex: 0 0 auto; width: 170px; }
.wide .rates { flex: 0 0 auto; flex-direction: row; justify-content: flex-end; gap: 16px; font-size: 13px; }
.wide .sys { flex: 1; flex-direction: row; justify-content: flex-end; gap: 14px; font-size: 12px; margin-right: 8px; }
.wide .tabs {
  top: 56px; bottom: 0; right: auto; width: 190px; flex-direction: column; justify-content: flex-start; gap: 2px;
  padding: 12px 10px; border-top: 0; border-right: 1px solid var(--line); background: var(--bg);
}
.wide .tab {
  flex: 0 0 auto; max-width: none; flex-direction: row; gap: 10px; padding: 9px 12px; border-radius: 8px;
  font-size: 14px; color: var(--text);
}
.wide .tab:hover { background: var(--chip); }
.wide .tab.on { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.wide .tab-icon { width: 34px; font-size: 17px; text-align: center; }
.wide main { max-width: none; width: auto; margin: 0 0 0 190px; padding: 18px 24px 24px; container: main / inline-size; }
.wide .sel-bar, .wide .rss-bar, .wide .settings-bar { bottom: 12px; }
.wide .sel-actions { width: auto; }
.wide .sel-actions .btn { flex: 0 0 auto; }
.wide .toast { bottom: 24px; left: calc(50% + 95px); }
.wide .add-form { max-width: 720px; }
.wide .search-bar, .wide .search-tools, .wide .recent, .wide .rfilter { max-width: 900px; }
.wide .rfilter .search-box { flex: 1 1 220px; }
.wide .rfilter select { flex: 0 0 auto; }
.wide #settings-form-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 12px; align-items: start; }
.wide .empty { text-align: left; }

/* the table: one card, rows separated by lines, sticky header */
.wide .table { background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.wide .table:has(.list:empty) { display: none; }
.wide .table .list { gap: 0; }
.wide .table .item { border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.wide .table .item:last-child { border-radius: 0 0 10px 10px; }
.wide .table .item:hover { background: color-mix(in srgb, var(--chip) 55%, transparent); }
.wide .table .item.selected { box-shadow: none; background: color-mix(in srgb, var(--accent) 10%, transparent); }
.wide .thead {
  display: grid; position: sticky; top: 56px; z-index: 3; background: var(--card); border-radius: 10px 10px 0 0;
  font-size: 12px; font-weight: 600; color: var(--muted); align-items: center;
}
.wide .thead > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wide .sortable { cursor: pointer; }
.wide .sortable:hover, .wide .sortable.on { color: var(--accent); }
.wide .sortable.on::after { content: ' ▾'; }
.wide .thead, .wide .table .item {
  grid-template-columns: var(--cols); grid-template-areas: var(--areas); column-gap: 14px; padding: 8px 14px;
}
.wide.compact .thead, .wide.compact .table .item { padding-top: 4px; padding-bottom: 4px; }
.wide.compact .table .item { font-size: 13px; }
.wide .table .item { display: grid; align-items: center; }
.wide .table .item-head, .wide .table .meta, .wide .table .result .body { display: contents; }
.wide .table .item-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.wide .table .item.open .item-name { white-space: normal; overflow-wrap: anywhere; }
.wide .table .meta > span, .wide .table .meta > span:empty { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wide .table .item-error, .wide .table .actions, .wide .table .files { grid-column: 1 / -1; }
.wide .table .item-error:empty { display: none; }
.wide .table .actions { margin-left: 38px; }
.wide .table .files { margin-left: 38px; margin-bottom: 4px; }

/* downloads table */
.wide #view-list {
  --cols: 18px minmax(0, 1fr) 110px 46px 72px 84px 84px 80px 46px 48px 126px;
  --areas: "ck name bar pct size down up eta peers ratio st";
}
.h-ck, .item-check { grid-area: ck; }
.wide .h-ck { display: flex; }
.wide .item .item-name, .h-name { grid-area: name; }
.wide .item .bar { grid-area: bar; margin: 0; }
.h-bar { grid-column: bar-start / pct-end; }
.m-pct { grid-area: pct; } .m-size, .h-size { grid-area: size; } .m-down, .h-down { grid-area: down; }
.m-up, .h-up { grid-area: up; } .m-eta, .h-eta { grid-area: eta; } .m-peers, .h-peers { grid-area: peers; }
.m-ratio, .h-ratio { grid-area: ratio; } .wide .item .badge, .h-st { grid-area: st; }
.wide .item .badge { justify-self: start; }
.wide .m-down { color: var(--ok); }
.wide .m-up { color: var(--accent); }
.wide .m-pct, .wide .m-size, .wide .m-down, .wide .m-up, .wide .m-peers, .wide .m-ratio,
.wide .h-pct, .wide .h-size, .wide .h-down, .wide .h-up, .wide .h-peers, .wide .h-ratio { text-align: right; }
.wide #sel-bar { margin-top: 10px; }

/* search results table */
.wide #view-search {
  --cols: minmax(0, 1fr) 76px 64px 64px 150px 104px 110px 32px;
  --areas: "name size seeds leech site date cat add";
}
.r-size, .h-size { grid-area: size; } .seeds, .h-seeds { grid-area: seeds; } .r-leech, .h-leech { grid-area: leech; }
.r-site, .h-site { grid-area: site; } .r-date, .h-date { grid-area: date; } .r-cat, .h-cat { grid-area: cat; }
.add-btn, .h-add { grid-area: add; }
.wide .r-size, .wide .seeds, .wide .r-leech, .wide #results-head .h-size, .wide .h-seeds, .wide .h-leech { text-align: right; }
.wide .table .add-btn { width: 30px; height: 30px; font-size: 18px; }

/* narrower windows: drop the less useful columns */
@container main (max-width: 980px) {
  .wide #view-list {
    --cols: 18px minmax(0, 1fr) 90px 44px 70px 80px 80px 74px 112px;
    --areas: "ck name bar pct size down up eta st";
  }
  #view-list .m-peers, #view-list .m-ratio, .h-peers, .h-ratio { display: none !important; }
  .wide #view-search {
    --cols: minmax(0, 1fr) 76px 60px 120px 100px 32px;
    --areas: "name size seeds site date add";
  }
  #view-search .r-leech, #view-search .r-cat, .h-leech, .h-cat { display: none !important; }
}

/* rss on the computer layout: one line per item */
.wide .rss-item { align-items: center; }
.wide .rss-item input[type=checkbox] { margin-top: 0; }
.wide .rss-item .body { display: flex; align-items: center; gap: 14px; }
.wide .rss-item .item-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wide .rss-item .meta { flex: 0 0 auto; flex-wrap: nowrap; }
.wide.compact .rss-item { padding-top: 5px; padding-bottom: 5px; }
.files-loading { font-size: 13px; margin: 4px 0; }

/* ---------- TV ---------- */
#view-tv .search-bar .btn { flex: 0 0 auto; }
.tv-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.tv-ch { position: relative; }
.tv-play {
  width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); cursor: pointer;
}
.tv-play:hover { border-color: var(--accent); }
.tv-logo { width: 100%; height: 48px; display: grid; place-items: center; }
.tv-logo img { max-width: 70%; max-height: 48px; object-fit: contain; }
.tv-initials {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--chip);
  color: var(--muted); font-weight: 700; font-size: 16px;
}
.tv-name { font-size: 13px; font-weight: 600; text-align: center; line-height: 1.25; overflow-wrap: anywhere; }
.tv-badges { display: flex; gap: 4px; min-height: 0; }
.tv-badges .badge { font-size: 10px; padding: 0 6px; }
.tv-badges:empty { display: none; }
.tv-fav {
  position: absolute; top: 2px; right: 2px; width: 30px; height: 30px; border: 0; background: none; cursor: pointer;
  font-size: 17px; color: var(--muted); line-height: 1;
}
.tv-fav.on { color: var(--warn); }
/* ★ Preferiti: ⠿ at the bottom of each card drags it to another place */
.tv-sortable .tv-play { padding-bottom: 26px; }
.tv-handle {
  position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%); padding: 0 14px; font-size: 18px; line-height: 22px;
  color: var(--muted); cursor: grab; touch-action: none; user-select: none;
}
.tv-ch.dragging { opacity: .6; outline: 2px dashed var(--accent); border-radius: 12px; }
.tv-empty { grid-column: 1 / -1; }
.tv-source { font-size: 12px; text-align: center; margin-top: 18px; }
.tv-player video { max-height: calc(100vh - 300px); min-height: 180px; }
.tv-embed { display: block; width: 100%; aspect-ratio: 16 / 9; max-height: calc(100vh - 300px); border: 0; background: #000; }
.tv-player .player-head .icon-btn { font-size: 22px; }
#tv-fav-btn[aria-pressed="true"] { color: var(--warn); background: none; }
.wide .tv-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.wide .tv-logo { height: 60px; }
.wide .tv-logo img { max-height: 60px; }
.compact .tv-grid { gap: 5px; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
.compact .tv-play { padding: 6px 4px 5px; gap: 3px; border-radius: 9px; }
.compact .tv-logo { height: 34px; }
.compact .tv-logo img { max-height: 34px; }
.compact .tv-initials { width: 34px; height: 34px; font-size: 13px; }
.compact .tv-name { font-size: 12px; }
.wide.compact .tv-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.tab { max-width: 140px; }
.wide .tv-logo img { max-width: 74%; }

/* TV guide */
.tv-now { width: 100%; display: grid; gap: 3px; min-height: 0; }
.tv-now:empty { display: none; }
.tv-now-title { font-size: 11px; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-now-bar { display: block; height: 3px; background: var(--bar); border-radius: 2px; overflow: hidden; }
.tv-now-bar > i { display: block; height: 100%; background: var(--accent); }
.tv-epg { padding: 4px 14px 0; display: grid; gap: 8px; color: #ddd; }
.tv-prog { display: grid; gap: 3px; font-size: 13px; }
.tv-prog-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #9aa; }
.tv-prog-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tv-prog-time { font-variant-numeric: tabular-nums; color: #aab; flex: 0 0 auto; }
.tv-prog-title { font-weight: 600; color: #fff; }
.tv-prog-head .badge { background: #2a2f36; color: #bbb; }
.tv-prog-sub { color: #ccc; font-style: italic; }
.tv-prog-desc { color: #bbb; font-size: 12px; line-height: 1.4; }
.tv-prog-now .tv-now-bar { background: #333; margin-top: 2px; }
.tv-prog-next .tv-prog-desc { display: none; }
.tv-prog-past { opacity: .5; }
.compact .tv-now-title { font-size: 10px; }

/* schedule (player and grid dialog) */
.tv-cal {
  position: absolute; top: 2px; left: 2px; width: 30px; height: 30px; border: 0; background: none; cursor: pointer;
  font-size: 15px; line-height: 1; opacity: .75;
}
.tv-cal:hover { opacity: 1; }
.tv-guide-btn { justify-self: start; }
.tv-player .tv-guide-btn { background: #1f2a36; border-color: #2e3d4d; color: #cfe6ff; }
.tv-sched { display: grid; gap: 6px; }
.tv-sched-days { padding-bottom: 4px; }
.tv-sched-list { max-height: 50vh; overflow: auto; display: grid; align-content: start; border-top: 1px solid var(--line); }
.tv-sched-row { border-bottom: 1px solid var(--line); }
.tv-sched-head {
  width: 100%; display: flex; gap: 10px; align-items: baseline; padding: 8px 4px; border: 0; background: none;
  color: inherit; text-align: left; cursor: default; font-size: 14px;
}
.tv-sched-row.has-more .tv-sched-head { cursor: pointer; }
.tv-sched-title { flex: 1; min-width: 0; font-weight: 500; }
.tv-sched-head .badge { flex: 0 0 auto; }
.tv-sched-row.now { background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 6px; }
.tv-sched-row.now .tv-sched-title { font-weight: 700; }
.tv-sched-row.past { opacity: .5; }
.tv-sched-row.has-more .tv-sched-title::after { content: ' ›'; color: var(--muted); }
.tv-sched-row.open .tv-sched-title::after { content: ' ⌄'; }
.tv-sched-more { padding: 0 4px 10px 52px; display: grid; gap: 4px; font-size: 13px; }
.tv-sched-more .tv-prog-desc { color: var(--muted); }
.tv-sched .tv-prog-time { font-variant-numeric: tabular-nums; color: var(--muted); flex: 0 0 auto; min-width: 42px; }
/* the player is dark: its own colours for the schedule */
.tv-player { --line: #2a2f36; --muted: #99a3ad; --chip: #222a33; --accent: #4c9ff0; --accent-text: #08121c; }
.tv-player .tv-sched-list { max-height: 42vh; }
.tv-player .chip { color: #ddd; }
.tv-player .chip.on { color: var(--accent-text); }
.tv-guide-dialog { width: min(96vw, 560px); }
.tv-guide-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tv-guide-head h2 { flex: 1; font-size: 18px; }
.tv-guide-head .icon-btn { filter: none; opacity: 1; }
.tv-guide-logo .tv-logo { width: 56px; height: 36px; }
.tv-guide-logo .tv-logo img { max-width: 100%; max-height: 36px; }
.tv-guide-logo .tv-initials { width: 36px; height: 36px; font-size: 13px; }

/* TV recordings */
.tv-mode { padding-bottom: 12px; }
.tv-mode .chip { font-weight: 600; }
.rec-dot { color: var(--bad); font-size: 12px; flex: 0 0 auto; }
.rec-btn { background: color-mix(in srgb, var(--bad) 14%, var(--card)); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); color: var(--bad); font-weight: 600; }
.tv-player .rec-btn { background: #3a1d1f; border-color: #6b2b2f; color: #ff8a8a; }
.rec-doubt { opacity: .65; border-style: dashed; }
.tv-sched-more .btn { justify-self: start; margin-top: 4px; }
.tv-player #tv-rec-btn { color: #ff8a8a; }
.rec-usage { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.rec-settings { margin-bottom: 12px; font-size: 14px; }
.rec-settings summary { cursor: pointer; color: var(--accent); }
.rec-settings-form { display: grid; gap: 8px; padding: 10px 0; max-width: 420px; }
.rec-settings-form label { display: flex; align-items: center; gap: 8px; }
.rec-settings-form input { width: 90px; padding: 6px 8px; }
.rec-settings-form .btn { justify-self: start; }
.rec-help { font-size: 12px; margin: 0; }
.rec-tabs { margin-top: 10px; padding-bottom: 6px; }
#rec-live:empty { display: none; }
.rec-group { list-style: none; font-size: 13px; font-weight: 700; color: var(--muted); margin-top: 8px; }
.yt-queue { list-style: none; }
.yt-backup { margin-top: 16px; align-items: center; gap: 6px; flex-wrap: wrap; }
.yt-backup select { width: auto; max-width: 100%; }
.yt-selbar { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 2px 4px; }
.yt-qitem .item-head .file-check { margin-right: 8px; }
.yt-qhandle { cursor: grab; touch-action: none; user-select: none; font-size: 18px; padding: 2px 8px; color: var(--muted); }
.yt-qitem.dragging { opacity: .6; outline: 2px dashed var(--accent); }
.rec-item .item-head { cursor: default; }
.rec-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
/* Dirette auto on computers: the buttons on the right of the two lines, not under them */
.wide .auto-live { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; align-items: center; }
.wide .auto-live > * { grid-column: 1; }
.wide .auto-live > .rec-actions { grid-column: 2; grid-row: 1 / span 4; margin: 0; flex-wrap: nowrap; }
.rec-kept { color: var(--warn); }
.rec-recording { border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
.wide #tv-rec .rec-list { max-width: 980px; }

.feed-rename { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.feed-rename input { flex: 1 1 200px; min-width: 0; padding: 6px 10px; }
@media (min-width: 700px) {
  .feed-row { grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 14px; }
  .feed-controls { justify-content: flex-end; }
  .rss-add-form { grid-template-columns: 1fr 2fr; align-items: center; }
  .rss-add-form h3, .rss-add-form .folder-pick, .rss-add-form button { grid-column: 1 / -1; }
  .rss-add-form button { justify-self: start; }
}
/* phones: app shell. The document itself never scrolls, only <main> does: iOS (Home screen app) could leave a
   page that does not scroll shifted after the keyboard closed, and the fixed dock then floated above the bottom. */
html:not(.wide), html:not(.wide) body { overflow: hidden; overscroll-behavior: none; }
html:not(.wide) .app { height: 100%; min-height: 0; }
/* iPhone Home screen app: iOS makes 100% shorter than the screen (the dock stood a bit above the bottom); the large
   viewport unit is the whole screen there (no browser bars in an installed app, so nothing can hide under it) */
html.standalone:not(.wide), html.standalone:not(.wide) body, html.standalone:not(.wide) .app { height: 100lvh; }
html:not(.wide) main {
  flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch;
  padding-bottom: 0;
}
html:not(.wide) .view { padding-bottom: 16px; }
/* the dock is the last row of the shell, not on top of the content: the bars stick right above it */
html:not(.wide) .tabs { position: static; flex: 0 0 auto; }
html:not(.wide) .sel-bar, html:not(.wide) .rss-bar { bottom: 8px; }
html:not(.wide) .settings-bar { bottom: 0; }

/* phones: the bottom dock hides while typing (the keyboard would push it up or make it float) */
.typing .tabs { display: none; }
.typing main { padding-bottom: 0; }
.typing .sel-bar, .typing .rss-bar, .typing .settings-bar { bottom: 0; }

/* service logs (Settings) */
.log-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.log-dialog { width: min(96vw, 1100px); max-width: 96vw; padding: 14px; }
.log-head { display: flex; align-items: center; gap: 8px; }
.log-head h2 { flex: 1; font-size: 17px; margin: 0; }
.log-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.log-tools select { width: auto; flex: 1 1 120px; min-width: 0; }
.log-tools .search-box { flex: 1 1 100%; order: 3; }
.wide .log-tools .search-box { flex: 2 1 160px; order: 0; }
.logs-intro { margin-top: 22px; }
.log-tools .search-box input { padding-right: 12px; }
.log-body {
  height: 65vh; overflow: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.log-line { white-space: pre-wrap; overflow-wrap: anywhere; padding: 1px 0; }
.log-line .log-t { color: var(--muted); margin-right: 8px; }
.log-line .log-u { color: var(--accent); margin-right: 8px; }
.log-line.p-err { color: var(--bad); }
.log-line.p-warn { color: var(--warn); }

/* RSS history (keep items N days) */
.feed-keep { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.feed-keep .check { margin: 0; white-space: nowrap; }
.feed-keep-days { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.feed-keep-days[hidden] { display: none; }
.feed-keep-days input { width: 72px; padding: 6px 8px; }

/* TV → Film / Serie */
.picks-list .pick { display: grid; gap: 6px; }
.pick .meta .badge { text-transform: none; }
.pick-desc { font-size: 13px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.pick-desc.open { display: block; -webkit-line-clamp: unset; }
.pick-air { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding-top: 6px; }
.pick-air-info { flex: 1; min-width: 0; display: grid; gap: 2px; }
.pick-when { font-size: 14px; overflow-wrap: anywhere; }
.pick-sub { font-style: italic; }
.pick-air .btn { flex-shrink: 0; }
.pick > .btn.ghost { justify-self: start; }
.rec-badge { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.pick-rules { display: flex; flex-wrap: wrap; gap: 6px; }
.btn.rule-on { border-color: var(--ok, #2e9e5b); }
.rec-rule-note { font-size: 13px; }
@media (max-width: 480px) {
  .tv-mode { gap: 4px; }
  .tv-mode .chip { padding: 6px 9px; font-size: 13px; }
}

/* search: quality badges, sites that do not answer */
.q-badges { display: inline-flex; flex-wrap: wrap; gap: 3px; vertical-align: 1px; }
.q-badge { font-size: 10.5px; font-weight: 600; line-height: 1.5; padding: 0 5px; border-radius: 4px; background: var(--chip); color: var(--muted); white-space: nowrap; }
.q-badge.q-ita { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.q-badge.q-bad { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.search-sites { color: var(--warn); font-size: 13px; text-align: center; margin: 0 0 8px; }
.wide .search-sites { max-width: 900px; }
.sites-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.site-ok { color: var(--ok); }
.site-bad { color: var(--warn); }
/* computer table: title on one line (cut with …), quality badges on a second line */
.wide .table .result .item-name { white-space: normal; overflow: visible; }
.wide .table .result .r-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wide .table .result .q-badges { display: flex; margin-top: 2px; }

/* TV → YT */
.yt-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -4px 0 10px; }
.yt-actions[hidden], .yt-actions [hidden] { display: none; }
.yt-quality { display: flex; align-items: center; gap: 6px; font-size: 14px; }
#yt-jobs-tools { margin-bottom: 10px; }
/* channels on the left of the lives (Juri): open, the list with "‹" to close it; closed, a thin strip with only "›"
   to open it again. Phones: a small "› Canali" button above the lives, the drop-down when open. */
.yt-chnav[hidden], .yt-chnav [hidden] { display: none !important; }
.yt-chtoggle { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: inherit;
  font: inherit; font-size: 14px; padding: 4px 8px; border-radius: 8px; cursor: pointer; margin-bottom: 8px; }
.yt-chtoggle:hover { background: var(--chip); }
.yt-chtoggle-arrow { font-size: 18px; line-height: 1; font-weight: 700; }
.yt-chsel { width: 100%; margin-bottom: 10px; }
.yt-chlist { display: none; }
html.wide .yt-body.has-nav { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; align-items: start; }
html.wide .yt-body.has-nav.ch-closed { grid-template-columns: 22px minmax(0, 1fr); gap: 12px; }
html.wide .yt-chsel { display: none; }
html.wide .yt-chnav { position: sticky; top: 8px; }
html.wide .yt-chlist { display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - 160px); overflow-y: auto; }
html.wide .yt-chtoggle { width: 100%; justify-content: space-between; flex-direction: row-reverse; }
/* closed on computers: the strip, as tall as the lives next to it */
html.wide .ch-closed .yt-chnav { align-self: stretch; position: static; }
html.wide .ch-closed .yt-chtoggle { height: 100%; min-height: 120px; width: 22px; padding: 0; margin: 0;
  justify-content: center; align-items: flex-start; padding-top: 10px; background: var(--chip); border-radius: 6px; }
html.wide .ch-closed .yt-chtoggle:hover { filter: brightness(.95); }
html.wide .ch-closed .yt-chtoggle-label { display: none; }
.yt-ch { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 7px 10px; border: 0;
  border-radius: 8px; background: none; color: inherit; font: inherit; font-size: 14px; cursor: pointer; }
.yt-ch:hover { background: var(--chip); }
.yt-ch.on { background: var(--chip); font-weight: 600; }
.yt-ch-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yt-ch-auto { color: var(--bad); font-size: 11px; }
.yt-chfind { display: none; }
html.wide .yt-chfind { display: block; margin-bottom: 6px; }
html.wide .yt-chfind input { width: 100%; }
.yt-openmode { display: none; }
html.wide .yt-openmode { display: flex; flex-direction: column; gap: 4px; font-size: 13px; opacity: .85; margin-top: 12px;
  padding: 10px 10px 0; border-top: 1px solid var(--line); }
.yt-ch-none { font-size: 13px; padding: 6px 10px; }
.yt-more { list-style: none; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 0;
  text-align: center; }
.yt-quality select { width: auto; max-width: 220px; }
/* lives and videos as cards: as many per row as fit (lives ≥ 300px, videos ≥ 220px; 2 videos per row on phones) */
#yt-lives { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; padding: 0; }
#yt-lives .yt-card-body { padding: 6px 8px 8px; gap: 3px; }
#yt-lives .yt-card-title { -webkit-line-clamp: 1; font-size: 13px; }
#yt-lives .yt-card-ch { font-size: 14px; }
#yt-lives .rec-actions .btn { padding: 3px 8px; font-size: 13px; }
.yt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.yt-grid > .empty, .yt-grid > .yt-more { grid-column: 1 / -1; }
.yt-card { list-style: none; display: flex; flex-direction: column; min-width: 0; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.yt-pic { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--chip); }
.yt-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yt-pic img.none { visibility: hidden; }
.yt-dur { position: absolute; right: 6px; bottom: 6px; background: rgba(0, 0, 0, .78); color: #fff; font-size: 12px;
  font-weight: 600; padding: 1px 5px; border-radius: 4px; }
.yt-live-badge { position: absolute; left: 8px; top: 8px; font-size: 12px; font-weight: 700; padding: 2px 8px;
  border-radius: 10px; border: 1px solid color-mix(in srgb, var(--bad) 40%, var(--line));
  background: color-mix(in srgb, var(--bad) 14%, var(--card)); color: var(--bad); }  /* looks like the ⏺ Rec button (Juri) */
.yt-card-body { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px 10px; flex: 1; }
.yt-card-head { display: flex; align-items: center; gap: 6px; }
.yt-card-ch { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yt-card-title { font-size: 14px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.yt-card-meta { font-size: 12px; }
.yt-card .rec-actions { margin-top: auto; padding-top: 4px; }
.yt-live-card .yt-card-title { font-weight: 500; }
.yt-auto { font-size: 14px; }
/* the chosen channel in the list: unfollow next to its name, a small line below (record automatically, ↗ Twitch) */
.yt-ch-sel { background: var(--chip); border-radius: 8px; padding-bottom: 6px; }
.yt-ch-row { display: flex; align-items: center; gap: 4px; padding-right: 4px; }
.yt-ch-row .yt-ch { flex: 1; min-width: 0; background: none; }
.yt-unfollow { flex: 0 0 auto; padding: 2px 8px; font-size: 12px; }
.yt-ch-more { display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; padding: 0 10px; font-size: 12px; }
.yt-ch-more .check { font-size: 12px; }
.yt-ch-more .btn { padding: 2px 8px; font-size: 12px; }
.yt-chsel-more { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 10px; }
.yt-chsel-more:empty { display: none; }
html.wide .yt-chsel-more { display: none; }
#yt-lives:empty { display: none; }
#yt-lives { margin-bottom: 10px; }
#yt-vpn { margin: 0 0 10px; }
html:not(.wide) .yt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
html:not(.wide) .yt-grid .yt-card-body { padding: 6px 8px 8px; }
html:not(.wide) .yt-grid .yt-card-title { font-size: 13px; }
html:not(.wide) .yt-grid .rec-actions .btn { width: 100%; justify-content: center; }
html:not(.wide) #yt-lives { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
html:not(.wide) #yt-lives .badge { display: none; }

/* a live in a floating window over the app (computers): drag by the bar, resize by the corner */
.yt-float { position: fixed; z-index: 900; right: 16px; bottom: 16px; width: 480px; height: 302px; display: flex;
  flex-direction: column; background: #000; border-radius: 10px; overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .45); border: 1px solid rgba(255, 255, 255, .12); }
.yt-float[style*="left"] { right: auto; bottom: auto; }
.yt-float[hidden] { display: none !important; }
.yt-float-bar { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; background: #1b1f24;
  color: #e8eaed; font-size: 13px; cursor: move; user-select: none; touch-action: none; }
.yt-float-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yt-float-btn { border: 0; background: none; color: #e8eaed; font: inherit; font-size: 15px; line-height: 1;
  padding: 5px 7px; border-radius: 6px; cursor: pointer; text-decoration: none; }
.yt-float-btn:hover { background: rgba(255, 255, 255, .14); }
.yt-float iframe { flex: 1; width: 100%; border: 0; display: block; background: #000; }
.yt-float.moving iframe { pointer-events: none; }
.yt-float iframe[hidden] { display: none; }
.yt-float-grip { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, rgba(255, 255, 255, .5) 50%, rgba(255, 255, 255, .5) 60%,
  transparent 60%, transparent 72%, rgba(255, 255, 255, .5) 72%, rgba(255, 255, 255, .5) 82%, transparent 82%); }

.tv-open { width: auto; }

/* One tab for Search and Add: "Add" is a button under the search bar (the Search tab stays lit on Add). */
/* under the search bar: Add (shortened) + RSS, which sits right under Cerca with the same width and colour (Juri) */
.search-row2 { display: flex; gap: 8px; margin: -2px 0 10px; }
.wide .search-row2 { max-width: 900px; }
a.btn.search-add { flex: 1; min-width: 0; display: block; text-align: center; text-decoration: none; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.search-go { flex: 0 0 96px; width: 96px; text-align: center; }
a.btn.search-rss { display: block; text-decoration: none; }
.tab-icon { white-space: nowrap; }
.tab-icon .ico-search { display: inline-block; transform: scale(1.7); }  /* the magnifier alone (Juri 27/11: no ＋), a bit bigger */
.tab-icon .ico-rss { display: inline-block; transform: scale(1.45); }
/* Computer sidebar: the double Search/Add icon only a little bigger than the others (Juri). */
.wide .tab-icon:has(.ico-search) { font-size: 14px; letter-spacing: -1px; }
.wide .tab-icon .ico-search { transform: scale(1.45); }
/* Streams: site names framed in the site's colour (Juri). */
:root { --twitch: #9146ff; --youtube: #ff0033; }
.badge.site-twitch, .badge.site-youtube { background: transparent; border: 1.5px solid; padding: 1px 7px; color: var(--text); }
.badge.site-twitch, .btn.site-twitch { border-color: var(--twitch); }
.badge.site-youtube, .btn.site-youtube { border-color: var(--youtube); }
.btn.site-twitch, .btn.site-youtube { border-width: 1.5px; }
.yt-video .rec-actions { align-items: center; }
.yt-video .rec-actions .badge[class*='site-'] { margin-left: auto; }

/* free-space warning (header link + banner) and Settings → Disk space */
.sys-disk { color: inherit; text-decoration: none; }
.sys-disk:hover { text-decoration: underline; }
.disk-alert {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; padding: 8px 12px; font-size: 14px;
  background: color-mix(in srgb, var(--warn) 16%, var(--bg)); border-bottom: 1px solid var(--warn); color: var(--text);
}
.disk-alert[hidden] { display: none; }
.disk-alert span { flex: 1 1 auto; }
.disk-alert .icon-btn { padding: 2px 6px; }
.wide .disk-alert { margin-left: 190px; padding: 8px 24px; }
.disk-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--bar); }
.disk-seg { display: block; min-width: 2px; }
.disk-sum { margin: 8px 0 4px; font-size: 14px; }
.disk-low { color: var(--bad); }
.disk-parts { list-style: none; margin: 0; padding: 0; }
.disk-part { border-top: 1px solid var(--line); }
.disk-part:first-child { border-top: 0; }
.disk-head { display: flex; align-items: center; gap: 8px; padding: 7px 0; font-size: 14px; cursor: default; }
summary.disk-head { cursor: pointer; list-style: none; }
summary.disk-head::-webkit-details-marker { display: none; }
summary.disk-head .disk-name::after { content: ' ▸'; color: var(--muted); }
details[open] > summary.disk-head .disk-name::after { content: ' ▾'; }
.disk-name { flex: 1; min-width: 0; }
.disk-size { font-variant-numeric: tabular-nums; white-space: nowrap; }
.disk-pct { width: 48px; text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; }
.disk-dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.disk-top { list-style: none; margin: 0 0 8px 18px; padding: 0; font-size: 13px; }
.disk-top li { display: flex; gap: 10px; padding: 3px 0; }
.disk-top-name { flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--muted); }
.dp-torrents { background: #1e7bd8; }
.dp-incomplete { background: #7fb6ec; }
.dp-archive { background: #1d9a5b; }
.dp-streams { background: #9146ff; }
.dp-recordings { background: #d9822b; }
.dp-other { background: #8d99a6; }

/* Settings → copies of the app's data */
.bk-tools { gap: 6px; flex-wrap: wrap; }
.bk-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 360px; overflow-y: auto; }
.bk-row { display: flex; align-items: center; gap: 6px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.bk-row:first-child { border-top: 0; }
.bk-info { flex: 1; min-width: 0; }
.bk-sum { font-size: 12px; }
.bk-secs { display: grid; gap: 10px; margin-top: 8px; }
.bk-sec { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.bk-sec input { width: 18px; height: 18px; margin: 1px 0 0; flex: 0 0 auto; }
.bk-sec .bk-sum { display: block; }
.settings-intro[id] { scroll-margin-top: 70px; }
/* Settings tabs: one group at a time */
#view-settings > [data-stab][hidden] { display: none; }
#view-settings > .settings-intro { margin-top: 4px; }

/* where a video was left (watchMark in app.js) and the "resumed from" line in the player */
.watch-mark { display: flex; align-items: center; gap: 8px; margin-top: 3px; font-size: 12px; color: var(--muted); }
.watch-mark.seen { color: var(--ok); }
.watch-bar { width: 80px; height: 4px; border-radius: 2px; background: var(--bar); overflow: hidden; flex: 0 0 auto; }
.watch-bar > span { display: block; height: 100%; background: var(--accent); }
.player-resume { margin: 8px 14px 0; font-size: 13px; color: #ccc; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.player-resume[hidden] { display: none; }

/* search: the same release found several times = one row with "N copie" (the list opens under it) */
.result { flex-wrap: wrap; }
.r-copies {
  font: inherit; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--accent); background: transparent; color: var(--accent); vertical-align: 1px;
}
.r-copies.on { background: var(--accent); color: var(--accent-text); }
.r-copies-list { flex: 1 0 100%; list-style: none; margin: 0; padding: 6px 0 0; border-top: 1px dashed var(--line); font-size: 12px; }
.r-copies-list li { display: flex; flex-direction: column; padding: 3px 0; }
.r-copies-list li.best .r-copy-name { font-weight: 600; }
.r-copy-name { overflow-wrap: anywhere; }
.wide .table .result .r-copies-list { grid-column: 1 / -1; }
.q-badge.r-have { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.q-badge.r-have.done { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }

/* Settings → Notifiche (push.js) */
.push-status { margin: 0 0 8px; }
.push-events { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px 14px; margin-top: 10px; }
.push-events .push-h, .push-events .item-error { grid-column: 1 / -1; }
.push-h { font-size: 13px; color: var(--muted); margin: 12px 0 4px; font-weight: 600; }
.push-ev { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 14px; cursor: pointer; }
.push-ev input { width: 18px; height: 18px; flex: none; }
.rec-menu { position: fixed; z-index: 60; display: flex; flex-direction: column; align-items: stretch; gap: 6px;
  min-width: 170px; padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.rec-menu .btn { text-align: left; justify-content: flex-start; }
.rec-menu-h { font-size: 12px; margin: 0 2px 2px; }

/* TV → Palinsesto (epg.js): sticky channel column + sticky time ruler, programmes positioned by time */
#tv-guide-view { --epg-ch: 92px; --epg-row: 52px; }
.wide #tv-guide-view { --epg-ch: 150px; --epg-row: 56px; }
.epg-bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; margin: 6px 0; }
.epg-grid { position: relative; overflow: auto; max-height: calc(100vh - 230px); border: 1px solid var(--line);
  border-radius: 12px; background: var(--card); overscroll-behavior: contain; }
html:not(.wide) .epg-grid { max-height: calc(100vh - 290px); }
.epg-inner { position: relative; }
.epg-row { display: flex; height: var(--epg-row); border-bottom: 1px solid var(--line); }
.epg-ch { position: sticky; left: 0; z-index: 2; flex: none; width: var(--epg-ch); display: flex; align-items: center;
  gap: 6px; padding: 4px 6px; background: var(--card); border: 0; border-right: 1px solid var(--line); color: var(--text);
  font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.epg-ch .tv-logo { width: 34px; height: 34px; flex: none; }
.epg-ch-name { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
html:not(.wide) .epg-ch-name { display: none; }
html:not(.wide) .epg-ch { justify-content: center; }
.epg-line { position: relative; flex: none; }
.epg-ruler { position: sticky; top: 0; z-index: 3; height: 28px; background: var(--card); }
.epg-corner { z-index: 4; font-weight: 600; font-size: 11px; cursor: default; }
.epg-tick { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line); padding: 6px 0 0 4px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.epg-tick.half { border-left-style: dashed; opacity: .6; }
.epg-txt { display: flex; flex-direction: column; min-width: 0; box-sizing: border-box; }
.epg-prog { position: absolute; top: 3px; bottom: 3px; display: flex; flex-direction: column; justify-content: center; overflow: hidden;
  padding: 2px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit;
  text-align: left; cursor: pointer; }
.epg-prog:hover { border-color: var(--accent); }
.epg-prog.on { background: color-mix(in srgb, var(--accent) 14%, var(--card)); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.epg-prog.past { opacity: .5; }
.epg-prog.film { box-shadow: inset 3px 0 0 #b07cff; }
.epg-prog.rec-set { border: 1.5px dashed var(--bad, #d33); }
.epg-prog.rec-now { border: 1.5px solid var(--bad, #d33); }
.epg-time { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.epg-title { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.epg-sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.epg-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad, #d33); z-index: 1; pointer-events: none; }
.epg-dialog { max-width: 520px; width: calc(100vw - 32px); position: relative; }
.epg-close { position: absolute; top: 8px; right: 8px; }
.epg-d-head { display: flex; align-items: center; gap: 8px; margin-right: 36px; }
.epg-d-head .tv-logo { width: 36px; height: 36px; }
.epg-d-ch { font-weight: 600; }
.epg-d-when { margin-top: 10px; color: var(--muted); font-size: 13px; }
.epg-d-title { margin: 4px 0; }
.epg-d-sub { color: var(--muted); margin-bottom: 6px; }
.epg-d-desc { line-height: 1.45; white-space: pre-line; }

/* TV → Film / Serie, "Tabella" view (picks.js) */
.picks-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 6px 16px; }
.picks-view { flex: none; }
.picks-table-box { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.picks-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.picks-table th { position: sticky; top: 0; background: var(--card); text-align: left; border-bottom: 1px solid var(--line); padding: 0; }
.th-sort { width: 100%; padding: 9px 10px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 12.5px;
  font-weight: 600; text-align: left; cursor: pointer; white-space: nowrap; }
.th-sort:hover { color: var(--text); }
.picks-table td { padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; }
.pick-tr { cursor: pointer; }
.pick-tr:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.pick-tr.open td { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.picks-table .c-n, .picks-table .c-mins { white-space: nowrap; text-align: right; }
.picks-table .c-next { white-space: nowrap; }
.picks-table .c-rec { white-space: nowrap; color: var(--bad); font-weight: 600; }
.picks-table .c-genre { color: var(--muted); }
.picks-table .c-title b { font-weight: 600; }
.c-title-ch { display: none; font-size: 12px; }
.pick-detail td { border-top: 0; padding: 0 10px 10px; }
.pick-detail-box { display: grid; gap: 6px; padding: 8px 10px; border-left: 3px solid var(--accent); }
html:not(.wide) .picks-table .c-genre, html:not(.wide) .picks-table .c-ch, html:not(.wide) .picks-table .c-mins { display: none; }
html:not(.wide) .picks-table .c-title { width: 100%; }
html:not(.wide) .c-title-ch { display: block; }
html:not(.wide) .picks-table { font-size: 13.5px; }
html:not(.wide) .picks-table td, html:not(.wide) .th-sort { padding-left: 7px; padding-right: 7px; }
.picks-table .c-every { white-space: nowrap; }
.picks-table .c-every .btn { padding: 3px 8px; font-size: 12px; margin: 0 4px 2px 0; }
html:not(.wide) .picks-table .c-every { white-space: normal; }
html:not(.wide) .picks-table .c-every .btn { display: block; padding: 2px 6px; font-size: 11.5px; white-space: nowrap; }
html:not(.wide) .picks-table .c-next, html:not(.wide) .picks-table .c-n, html:not(.wide) .picks-table .c-rec { display: none; }
html:not(.wide) .picks-table .c-every { width: 1%; }
html:not(.wide) .pick-detail-box { max-width: calc(100vw - 60px); }

/* Settings → Controlli dirette (yt.js renderChecks) */
.checks-q { max-width: 420px; margin-bottom: 10px; }
.checks-group { border-top: 1px solid var(--line); }
.checks-group:first-child { border-top: 0; }
.checks-head { display: flex; align-items: center; gap: 10px; padding: 10px 0; cursor: pointer; flex-wrap: wrap; }
.checks-n { flex: 1; color: var(--muted); font-size: 13px; }
.checks-sel { width: auto; max-width: 200px; }
.checks-rows { list-style: none; margin: 0 0 10px; padding: 0; }
.checks-row { display: flex; align-items: center; gap: 10px; padding: 6px 0 6px 14px; border-top: 1px dashed var(--line); }
.checks-info { flex: 1; min-width: 0; }
.checks-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checks-meta { font-size: 12px; }

/* ⏱ live checks running late (header) and the line on Settings → Controlli dirette */
.sys-lag { color: inherit; text-decoration: none; }
.sys-lag.warn, .checks-lag.warn { color: #d98200; }
.sys-lag.hot, .checks-lag.hot { color: var(--bad); }
.checks-lag { margin: 0 0 10px; font-size: 13px; }

/* TV → Registrazioni: checkbox before the title (several at once) */
.rec-item .item-head .file-check { margin-right: 8px; }

/* Computers: header numbers in fixed slots (Juri 26/11/2026: nothing moves when a value changes or RAM / Swap take
   turns). Equal-width digits; slots sized for the longest value ("RAM 1.1/2.0 GB", "Disco 362 GB", "↓ 10.0 MB/s"). */
.sys, .rates { font-variant-numeric: tabular-nums; }
.wide .sys-sep { display: none; }
/* widths measured in the browser for the longest values ("CPU 100%" 63px, "RAM 63.9/64.0 GB" 107, "Disco 1888 GB" 86,
   "↓ 10.0 MB/s" 76), 10px between slots (Juri: wider ones were too far apart) */
.wide .sys { gap: 10px; margin-right: 10px; }
.wide #sys-a, .wide #sys-b { display: flex; align-items: center; gap: 10px; }
.wide .sys-cpu { display: inline-block; width: 64px; }
.wide .sys-mem { display: inline-block; width: 108px; }
.wide .sys-disk { display: inline-block; width: 86px; }
.wide .rates { gap: 10px; }
.wide .rate { display: inline-block; width: 78px; text-align: left; }

/* the clock in the middle of the header: computers only */
.clock { display: none; }
.wide .clock { display: block; flex: 1; text-align: center; font-size: 13px; color: var(--muted); white-space: nowrap;
  font-variant-numeric: tabular-nums; }
.wide .sys { flex: 0 0 auto; }
html:not(.wide) .sys-lagslot:empty { display: none; }
.wide .sys-lagslot { display: inline-block; width: 16ch; text-align: right; }

/* Streams → ♪ Musica (music.js) */
#tv-music .search-box { margin: 8px 0; }
.music-filters .chips { margin-bottom: 4px; }
.music-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.wide .music-list { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 6px 12px; }
.music-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: var(--card);
  cursor: pointer; min-width: 0; }
.music-row:hover { background: var(--chip); }
.music-row.playing { outline: 2px solid var(--accent); }
.music-row.dragging { opacity: .6; outline: 2px dashed var(--accent); }
.music-handle { padding: 2px 2px 2px 0; margin-right: -4px; }
.music-pic { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 6px; background: var(--chip); overflow: hidden; }
.music-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.music-body { flex: 1; min-width: 0; }
.music-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-sub { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-acts { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.music-star { font-size: 18px; }
/* the player: a row above the dock on phones, a small fixed card bottom right on computers */
.mp { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--card); border-top: 1px solid var(--line, rgba(127,127,127,.25)); }
.mp[hidden] { display: none; }
.wide .mp { position: fixed; right: 16px; bottom: 16px; width: 520px; max-width: calc(100vw - 32px); border-radius: 12px;
  border: 1px solid var(--line, rgba(127,127,127,.25)); box-shadow: 0 6px 24px rgba(0,0,0,.25); z-index: 50; }
.mp-pic { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 6px; overflow: hidden; background: var(--chip); }
.mp-pic[hidden], .mp-frame:empty { display: none; }
.mp-pic img { width: 100%; height: 100%; object-fit: cover; }
.mp-frame { flex: 0 0 auto; }
.mp-yt { width: 160px; height: 90px; border: 0; border-radius: 6px; display: block; }
html:not(.wide) .mp-yt { width: 112px; height: 63px; }
.mp-info { flex: 1; min-width: 0; }
.mp-title { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-sub, .mp-note { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-note { color: var(--bad); }
#mp-audio { height: 32px; width: 200px; flex: 0 1 200px; }
html:not(.wide) #mp-audio { width: 130px; flex-basis: 130px; }
.wide.mp-on main { padding-bottom: 110px; }

/* Download → "Altri in corso": recordings and Streams downloads going on (app.js renderOthers) */
.others { list-style: none; margin: 0 0 12px; padding: 8px 10px; border-radius: 10px; background: var(--card); display: grid; gap: 4px; }
.others-head { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.others-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 2px; cursor: pointer; border-radius: 6px; position: relative; }
.others-row:hover { background: var(--chip); }
.others-kind { width: 16px; text-align: center; }
.others-name { flex: 1 1 200px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.others-info { font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.others-bar { position: absolute; left: 26px; right: 2px; bottom: 0; height: 2px; background: var(--chip); border-radius: 1px; overflow: hidden; }
.others-bar i { display: block; height: 100%; background: var(--accent); }
.badge.site-tv { border-color: var(--accent); }
.badge.site-radio, .badge.site-audius { border-color: #c9a227; }

/* server checks ("Controlli", watch.py) on top of the Download page + their dialog */
.watch-list { margin-bottom: 10px; }
.watch-row { flex-wrap: nowrap; }
.watch-dot { width: 16px; text-align: center; color: var(--muted); }
.watch-row.found .watch-dot { color: var(--ok); }
.watch-row.found { background: color-mix(in srgb, var(--ok) 12%, transparent); }
.watch-row.ended { opacity: .6; }
/* Kimsufi SSD + HDD available (the server Juri would buy at once): loud red row, item and state */
.watch-row.top { background: color-mix(in srgb, var(--bad) 20%, transparent); outline: 2px solid var(--bad); font-weight: 700; }
.watch-row.top .watch-sum { color: var(--bad); }
.watch-state.top { color: var(--bad); font-size: 17px; }
.watch-item.top { border-left: 5px solid var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--card)); }
.watch-name { font-weight: 600; white-space: nowrap; }
.watch-sum { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.watch-dialog { width: min(720px, calc(100vw - 32px)); }
.watch-state { font-weight: 600; margin: 6px 0; }
.watch-state.found { color: var(--ok); }
.watch-err { color: var(--bad); font-size: 13px; }
.watch-items { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.watch-item { padding: 8px 10px; border-radius: 8px; background: var(--card); border-left: 3px solid var(--chip); }
.watch-item.ok { border-left-color: var(--ok); }
.watch-item.dim { opacity: .55; }
.watch-more { padding: 8px 10px; border-radius: 8px; background: var(--card); border-left: 3px solid var(--chip); }
.watch-more summary { cursor: pointer; }
.watch-more .watch-items { margin: 8px 0 0; }
.watch-more .watch-item { background: color-mix(in srgb, var(--chip) 25%, var(--card)); }
.watch-item-top { display: flex; justify-content: space-between; gap: 8px; }
.watch-val { font-variant-numeric: tabular-nums; font-weight: 600; }
.watch-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.watch-tags .badge.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.watch-h { font-size: 14px; margin: 12px 0 4px; }
.watch-hist { margin: 0; padding-left: 18px; font-size: 13px; }
p.small, div.small { font-size: 12px; }
.watch-info p { margin: 4px 0; }
.watch-info .btn { margin-top: 6px; display: inline-block; }
.watch-list { grid-template-columns: minmax(0, 1fr); }
.watch-row { min-width: 0; }
.watch-link { font-weight: 700; color: inherit; }
.watch-item-top { align-items: baseline; }
.watch-item-top .watch-link, .watch-item-top b { flex: 1 1 auto; min-width: 0; }
.watch-x { padding: 0 4px; font-size: 13px; }
.watch-tags a.badge { text-decoration: none; }
.watch-ihist summary { cursor: pointer; margin-top: 4px; }
.watch-add { display: flex; gap: 6px; margin: 10px 0 4px; }
.watch-add input { flex: 1 1 auto; min-width: 0; }
.watch-tags .badge.bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.watch-tag { display: inline-flex; align-items: center; gap: 1px; }
.watch-tags .badge.off { opacity: .55; }
.watch-part { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 2px 4px; }
.watch-part:hover { color: var(--bad); }
/* Download → 📁 File */
.files-tools { display: grid; gap: 8px; margin-bottom: 10px; }
.files-chips { margin: 0; }
.files-q { width: 100%; max-width: 420px; }
.file-sub { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.files-more { list-style: none; text-align: center; padding: 8px; }
.files-link { list-style: none; padding: 10px 0 4px; }
/* "Altri in corso": never wider than the screen (long titles cut with …); on phones the info goes on a second line */
.others { grid-template-columns: minmax(0, 1fr); }
.others-row { min-width: 0; }
html:not(.wide) .others-name { flex: 1 1 0; }
html:not(.wide) .others-info { flex-basis: 100%; padding-left: 24px; }
html:not(.wide) .watch-row .others-info { flex-basis: auto; padding-left: 0; }
.files-head { list-style: none; margin-top: 6px; }
.files-sec { width: 100%; display: flex; align-items: baseline; gap: 10px; padding: 10px 12px; border: 1px solid var(--line, var(--chip));
  border-radius: 10px; background: var(--card); color: inherit; font: inherit; cursor: pointer; text-align: left; flex-wrap: wrap; }
.files-sec .muted { font-size: 13px; }
.files-arrow { width: 12px; color: var(--muted); }
.files-stats { list-style: none; font-size: 13px; padding: 2px 2px 6px; }
/* Video players as floating windows on computers (app.js openPlayerDialog): drag by the bar, resize by the corner */
.player.floating { position: fixed; margin: 0; inset: auto; z-index: 60; resize: both; overflow: hidden; max-width: none;
  max-height: none; min-width: 320px; min-height: 220px; box-shadow: 0 12px 40px rgba(0, 0, 0, .5); }
.player.floating[open] { display: flex; flex-direction: column; }
.player.floating .player-head { cursor: move; user-select: none; }
.player.floating video { flex: 1 1 auto; min-height: 0; max-height: none; height: 100%; object-fit: contain; }
.player.floating .tv-epg { max-height: 30%; overflow: auto; }
/* the audio player: draggable on computers (music.js), and as a small window of its own (Document PiP) */
.wide .mp { cursor: grab; touch-action: none; }
.wide .mp.dragging { cursor: grabbing; opacity: .9; }
.wide .mp audio, .wide .mp button { cursor: auto; }
body.mp-pipwin { margin: 0; background: var(--card); }
body.mp-pipwin .mp { position: static; width: auto; max-width: none; border: 0; border-radius: 0; box-shadow: none; height: 100vh; }
/* minimized: a small bar at the bottom left (title, buttons); the video keeps playing out of sight */
.player.floating.minimized { width: 300px !important; height: auto !important; min-height: 0; resize: none; top: auto; }
.player.floating.minimized > :not(.player-head) { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.player.floating.minimized .player-head { cursor: pointer; }
/* bottom-left resize corner of the floating video windows (the native one is bottom-right) */
.float-grip-left { display: none; }
.player.floating .float-grip-left { display: block; position: absolute; left: 0; bottom: 0; width: 16px; height: 16px; cursor: nesw-resize;
  z-index: 2; background: linear-gradient(225deg, transparent 50%, rgba(255, 255, 255, .45) 50%, rgba(255, 255, 255, .45) 58%,
  transparent 58%, transparent 70%, rgba(255, 255, 255, .45) 70%, rgba(255, 255, 255, .45) 78%, transparent 78%); }
.player.floating.minimized .float-grip-left { display: none; }
.player.floating { position: fixed; }
/* Streams windows: second resize corner (bottom left), minimized = a bar at the bottom left (yt.js) */
.yt-float-grip-left { right: auto; left: 0; cursor: nesw-resize;
  background: linear-gradient(225deg, transparent 50%, rgba(255, 255, 255, .5) 50%, rgba(255, 255, 255, .5) 60%,
  transparent 60%, transparent 72%, rgba(255, 255, 255, .5) 72%, rgba(255, 255, 255, .5) 82%, transparent 82%); }
.yt-float.minimized { width: 300px !important; height: auto !important; top: auto !important; }
.yt-float.minimized > :not(.yt-float-bar) { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.yt-float.minimized .yt-float-bar { cursor: pointer; }
/* Streams → wc (wc.js): categories on the left (computers) / folded on top (phones), videos on the right */
.wc-body { display: block; }
html.wide .wc-body { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: start; }
/* the bar on the left closes into a thin strip "›" like Streams' channel list (computers; closed when the app opens) */
html.wide .wc-body.ch-closed { grid-template-columns: 22px minmax(0, 1fr); gap: 12px; }
html.wide .wc-body.ch-closed .wc-nav { align-self: stretch; position: static; }
html.wide .ch-closed .wc-navbody { display: none; }
html:not(.wide) #wc-navtoggle { display: none; }
html.wide .wc-nav { position: sticky; top: 8px; }
.wc-catbox > summary { cursor: pointer; font-weight: 600; padding: 6px 2px; }
.wc-catbox input { width: 100%; margin: 6px 0; }
.wc-catlist { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow-y: auto; }
html.wide .wc-catlist { max-height: calc(100vh - 130px); }
.wc-other { margin: 6px 0; }
.wc-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.wc-tools input { flex: 1 1 150px; max-width: 260px; min-width: 0; }
.wc-res .wc-long { margin-right: 10px; }
.wc-res { margin: 0; }
.wc-q { left: 6px; right: auto; }
.rec-actions .btn.busy { opacity: .6; pointer-events: none; }
.wc-kind { margin: 0 0 8px; }
.wc-card .rec-actions { flex-wrap: nowrap; }
