/* ============ Torrents — minimal ============
   One column, hairlines instead of boxes, colour only where it says something. */

.tp { width: 100%; max-width: 880px; margin: 0 auto; display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }

/* head: tabs on the left, speed and settings on the right */
.tp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tp-tabs { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: 10px; }
.tp-tab {
  appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13.5px; font-weight: 500;
  height: 30px; padding: 0 14px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.tp-tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tp-tab-count:empty { display: none; }
.tp-tab-count { font-size: 11.5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--on-accent); display: inline-grid; place-items: center; }
.tp-head-end { display: flex; align-items: center; gap: 6px; }
.tp-speed { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tp-speed span { display: inline-flex; align-items: center; gap: 4px; }
.tp-speed .icon { opacity: 0.7; }

.tp-body { display: grid; gap: 14px; }

/* the add field */
.tp-add {
  display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tp-add:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tp-add-icon { color: var(--muted); display: inline-flex; }
.tp-add-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 14.5px; height: 36px; }
.tp-add-input::placeholder { color: var(--muted); }
.tp-add-file { color: var(--muted); }
.tp-add-status:empty { display: none; }
.tp-add-status { font-size: 12.5px; color: var(--muted); margin: -6px 0 0 16px; }
.tp-dropping .tp-add { border-color: var(--accent); border-style: dashed; background: var(--accent-soft); }

/* filters: words, not buttons */
.tp-filters { display: flex; gap: 4px; flex-wrap: wrap; }
.tp-filter {
  appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px;
  height: 28px; padding: 0 10px; border-radius: 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.tp-filter span { font-size: 11.5px; opacity: 0.8; font-variant-numeric: tabular-nums; }
.tp-filter:hover { color: var(--text); background: var(--surface-3); }
.tp-filter.on { color: var(--text); background: var(--surface-3); font-weight: 500; }
.tp-filter.attention span { color: var(--danger); opacity: 1; }

/* the list */
.tp-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.tp-list:empty { display: none; }
.tp-row + .tp-row, .tp-simple-row + .tp-simple-row, .tp-hint + .tp-simple-row { border-top: 1px solid var(--border); }
.tp-row-top { display: flex; align-items: center; gap: 4px; padding-right: 8px; }
.tp-row-main {
  appearance: none; border: 0; background: transparent; text-align: left; font: inherit; color: inherit; cursor: pointer;
  flex: 1; min-width: 0; padding: 13px 8px 13px 16px; display: grid; gap: 4px;
}
.tp-row-main:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 10px; }
.tp-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-meta { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 8px; }
.tp-meta.danger, .tp-row[data-tone="danger"] .tp-meta { color: var(--danger); white-space: normal; }
.tp-row[data-tone="warning"] .tp-meta { color: var(--warning); }
.tp-row[data-tone="success"] .tp-meta { color: var(--success); }
.tp-bar { height: 3px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin-top: 4px; }
.tp-bar span { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.6s ease; }
.tp-row[data-tone="muted"] .tp-bar span { background: var(--muted); opacity: 0.5; }
.tp-row[data-tone="warning"] .tp-bar span { background: var(--warning); }
.tp-row[data-tone="danger"] .tp-bar span { background: var(--danger); }
.tp-row-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.tp-row-actions .switch { margin-right: 6px; }
.tp-row:hover, .tp-row.open { background: var(--surface-2); }
.tp-primary .icon { color: var(--text-2); }
.tp-row[data-tone="danger"] .tp-primary .icon, .tp-row[data-tone="accent"] .tp-primary .icon { color: var(--accent); }

/* a row's details */
.tp-detail { padding: 0 16px 16px; display: grid; gap: 14px; }
.tp-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 20px; font-size: 12.5px; }
.tp-fact { display: grid; gap: 2px; min-width: 0; }
.tp-fact > span:last-child, .tp-fact .tp-link { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-fact-toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; }
.tp-link { appearance: none; border: 0; background: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-align: left; }
.tp-link:hover { text-decoration: underline; }
.tp-files { max-height: 340px; overflow: auto; border-top: 1px solid var(--border); padding-top: 8px; }
.tp-file-list { list-style: none; margin: 0; padding: 0; display: grid; }
.tp-file { display: flex; align-items: center; gap: 10px; padding: 5px 2px; font-size: 13px; cursor: pointer; min-width: 0; }
.tp-file input { flex: none; accent-color: var(--accent); width: 15px; height: 15px; }
.tp-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-file-size, .tp-file-pct { flex: none; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tp-file-pct { width: 36px; text-align: right; }
.tp-file-all { font-weight: 500; border-bottom: 1px solid var(--border); margin-bottom: 4px; padding-bottom: 8px; }
.tp-file-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* empty */
.tp-empty { text-align: center; padding: 56px 20px; display: grid; justify-items: center; gap: 8px; }
.tp-empty p { margin: 0; }
.tp-empty-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 6px; }
.tp-empty-title { font-weight: 600; font-size: 15px; }
.tp-empty .btn { margin-top: 8px; }

/* sheets and forms */
.tp-sheet { gap: 16px; }
.tp-sheet-parts { display: grid; gap: 12px; max-height: 52vh; overflow: auto; }
.tp-part { position: relative; display: grid; gap: 4px; padding: 12px 14px; background: var(--surface-2); border-radius: 12px; }
.tp-part-name { font-weight: 500; font-size: 14px; overflow-wrap: anywhere; padding-right: 28px; }
.tp-part-files { margin-top: 6px; max-height: 260px; overflow: auto; }
.tp-part-files:empty { display: none; }
.tp-part-remove { position: absolute; top: 8px; right: 8px; }
.tp-form { display: grid; gap: 14px; }
.tp-field { display: grid; gap: 6px; }
.tp-label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.tp-place { display: grid; gap: 8px; }
.tp-select { appearance: auto; }
.tp-select.small { height: 28px; font-size: 12.5px; padding: 0 8px; width: auto; }
.tp-range { display: flex; align-items: center; gap: 8px; }
.tp-range .input { width: 100px; }
.tp-setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 13.5px; cursor: pointer; }
.tp-setting .input { width: 120px; }
.tp-settings { display: grid; gap: 14px; }
.tp-cats-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; font-size: 13.5px; border-top: 1px solid var(--border); padding-top: 14px; }
.tp-cats { display: grid; gap: 8px; }
.tp-cats:empty { display: none; }
.tp-cat { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: 8px; align-items: center; }
.tp-choice-list { display: grid; gap: 4px; }
.tp-choice { appearance: none; border: 1px solid transparent; background: var(--surface-2); color: var(--text); font: inherit; text-align: left; padding: 10px 12px; border-radius: 10px; cursor: pointer; display: grid; gap: 2px; }
.tp-choice:hover { border-color: var(--border-strong); }
.tp-choice.on { border-color: var(--accent); background: var(--accent-soft); }
.tp-more summary { cursor: pointer; font-size: 13px; color: var(--muted); list-style: none; }
.tp-more summary::before { content: '›'; display: inline-block; width: 14px; transition: transform 0.15s; }
.tp-more[open] summary::before { transform: rotate(90deg); }
.tp-more[open] { display: grid; gap: 14px; }
.tp-preview { display: grid; gap: 8px; padding: 12px 14px; background: var(--surface-2); border-radius: 12px; }
.tp-preview p { margin: 0; }
.tp-preview-list { margin: 0; padding: 0 0 0 16px; font-size: 12.5px; display: grid; gap: 3px; }
.tp-preview-list li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* feeds */
.tp-section { display: grid; gap: 10px; }
.tp-section + .tp-section { margin-top: 10px; }
.tp-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.tp-section-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.tp-section-head p { margin: 2px 0 0; }
.tp-simple-row { display: flex; align-items: center; gap: 4px; padding-right: 8px; }
.tp-simple-row.off .tp-name, .tp-simple-row.off .tp-meta { opacity: 0.5; }
.tp-simple-row.dim .tp-name { color: var(--muted); }
.tp-simple-main {
  appearance: none; border: 0; background: transparent; text-align: left; font: inherit; color: inherit;
  flex: 1; min-width: 0; padding: 12px 8px 12px 16px; display: grid; gap: 4px;
}
button.tp-simple-main { cursor: pointer; }
button.tp-simple-main:hover .tp-name { color: var(--accent); }
.tp-hint { padding: 16px; font-size: 13px; color: var(--muted); }
.tp-chip { font-size: 11.5px; padding: 1px 7px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); font-family: var(--mono); flex: none; }
.tp-badge { font-size: 11px; font-weight: 500; padding: 1px 7px; border-radius: 6px; flex: none; }
.tp-badge.accent { background: var(--accent-soft); color: var(--accent); }
.tp-badge.success { background: var(--success-soft); color: var(--success); }
.tp-items { max-height: 70vh; overflow: auto; }

@media (max-width: 640px) {
  .tp { gap: 14px; }
  .tp-speed { display: none; }
  .tp-add-file span { display: none; }
  .tp-row-main { padding-left: 14px; }
  .tp-facts { grid-template-columns: 1fr 1fr; }
  .tp-cat { grid-template-columns: 1fr; }
  .tp-section-head { align-items: flex-start; flex-direction: column; }
}

/* folders: torrents saving into the same folder (a show's seasons, a season's episodes), grouped */
.tp-group-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tp-group-title .tp-name { min-width: 0; }
.tp-group-chevron { display: inline-block; width: 12px; color: var(--muted); font-size: 16px; line-height: 1; transition: transform 0.15s; flex: none; }
.tp-group.expanded .tp-group-chevron { transform: rotate(90deg); }
.tp-group-icon { color: var(--accent); display: inline-flex; flex: none; }
.tp-group-list { list-style: none; margin: 0; padding: 0 0 0 18px; display: none; border-top: 1px solid var(--border); }
.tp-group.expanded .tp-group-list { display: block; }
.tp-row + .tp-group, .tp-group + .tp-row, .tp-group + .tp-group { border-top: 1px solid var(--border); }
.tp-group:hover { background: transparent; }
.tp-group > .tp-row-top:hover { background: var(--surface-2); }
.tp-group[data-tone="success"] > .tp-row-top .tp-meta { color: var(--success); }
.tp-group[data-tone="danger"] > .tp-row-top .tp-meta { color: var(--danger); }
.tp-group[data-tone="muted"] > .tp-row-top .tp-bar span { background: var(--muted); opacity: 0.5; }

/* filters and the Clear finished button above the list */
.tp-list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tp-list-head .tp-filters { flex: 1; min-width: 0; }
.tp-clear-done { flex: none; }
