/* ============================================================
   videolib — design system v3 «канон»
   Классический тёмный дашборд в традиции Jellyseerr/Sonarr/Cinephage.
   Семантика прогресса Sonarr 1:1.
   ============================================================ */

/* ============ ШРИФТЫ (локальные woff2, fontsource) ============ */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/inter-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/inter-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 800; font-display: swap;
  src: url("../fonts/inter-800-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/jetbrains-mono-400-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/jetbrains-mono-600-normal.woff2") format("woff2"); }

:root {
  /* фон и поверхности (Jellyseerr-семейство) */
  --bg: #111827;
  --bg2: #0b1020;
  --surface: #1f2937;
  --surface2: #273241;
  --surface3: #2f3b4c;
  --border: rgba(148, 163, 184, .14);
  --border2: rgba(148, 163, 184, .22);

  /* текст */
  --text: #f3f4f6;
  --text2: #cbd5e1;
  --text3: #94a3b8;
  --text4: #64748b;

  /* акценты */
  --accent: #4f46e5;          /* indigo-600 */
  --accent2: #6366f1;
  --accent3: #818cf8;
  --grad: linear-gradient(135deg, #6366f1, #8b5cf6);
  --grad-soft: linear-gradient(180deg, rgba(31,41,55,.0), rgba(79,70,229,.08));

  /* семантика статусов (Sonarr 1:1) */
  --purple: #7a43b6;   /* качается */
  --green: #00853d;    /* скачано */
  --red: #f05050;      /* missing / ошибка */
  --blue: #5d9cec;     /* ended */
  --amber: #ffa500;    /* warning */
  --star: #fbbf24;     /* рейтинг */

  /* типографика */
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, "SF Mono", Consolas, monospace;

  /* радиусы */
  --r1: 6px; --r2: 10px; --r3: 14px;

  /* тени */
  --sh1: 0 1px 2px rgba(0,0,0,.3);
  --sh2: 0 8px 24px rgba(0,0,0,.4);
  --sh-grad: 0 3px 12px rgba(79,70,229,.35);

  --sb-w: 240px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent3); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { display: block; }
::selection { background: rgba(99,102,241,.4); }

/* доступность: видимый клавиатурный фокус */
:focus-visible { outline: 2px solid var(--accent3); outline-offset: 2px; border-radius: 6px; }
.sb-nav button:focus-visible, .btn:focus-visible, .pcard:focus-visible,
.seg button:focus-visible, .cbtn:focus-visible, .tgl input:focus-visible + .tk,
a:focus-visible, .tbl button:focus-visible { outline: 2px solid var(--accent3); outline-offset: 2px; }
.sb-nav button.on:focus-visible { outline-color: #c7d2fe; }

/* скроллбары */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #4b5563; border-radius: 8px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: #6b7280; }

/* ============ КАРКАС ============ */
.app { display: flex; height: 100vh; }

/* ============ САЙДБАР ============ */
.sb {
  width: var(--sb-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #1f2937, #131928);
  border-right: 1px solid var(--border);
  padding: 14px 10px 12px;
  gap: 4px;
}
.sb-head { padding: 4px 12px 14px; }
.sb-head .logo {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: #fff;
}
.sb-ver { font: 10.5px/1.4 var(--mono); color: var(--text4); margin-top: 2px; }
.sb-nav { display: flex; flex-direction: column; gap: 2px; }
.sb-nav.sb-bottom { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--border); }
.sb-nav button {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 8.5px 12px;
  border-radius: var(--r2);
  color: var(--text3); font-size: 13.5px; font-weight: 500;
  text-align: left; transition: all .13s; position: relative;
}
.sb-nav button svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .8; }
.sb-nav button:hover { background: rgba(255,255,255,.05); color: var(--text2); }
.sb-nav button.on {
  background: var(--grad); color: #fff;
  box-shadow: var(--sh-grad); font-weight: 600;
}
.sb-nav button.on svg { opacity: 1; }
.sb-nav .cnt {
  margin-left: auto; font: 600 10.5px/1 var(--mono);
  background: rgba(255,255,255,.09); color: var(--text3);
  padding: 3px 7px; border-radius: 99px;
}
.sb-nav button.on .cnt { background: rgba(255,255,255,.22); color: #fff; }

/* ============ КОНТЕНТ ============ */
.main { flex: 1; overflow-y: auto; padding: 26px 30px 40px; }
.view { animation: viewIn .18s ease; max-width: 1500px; margin: 0 auto; }
@keyframes viewIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.view-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.view-sub { color: var(--text3); font-size: 13px; margin-top: 2px; }
.view-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ============ КНОПКИ ============ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: var(--r2);
  font-size: 13px; font-weight: 600;
  background: var(--surface2); color: var(--text2);
  border: 1px solid var(--border);
  transition: all .13s; white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { background: var(--surface3); color: var(--text); border-color: var(--border2); }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.primary:hover { background: var(--accent2); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface2); border-color: var(--border2); }
.btn.danger { background: rgba(240,80,80,.12); border-color: rgba(240,80,80,.35); color: #fca5a5; }
.btn.danger:hover { background: rgba(240,80,80,.22); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .spin { animation: rot 0.8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ============ СЕГМЕНТЫ / ЧИПЫ ============ */
.seg {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r2);
}
.seg button {
  padding: 5px 14px; border-radius: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--text3);
  transition: all .12s;
}
.seg button:hover { color: var(--text2); }
.seg button.on { background: var(--surface3); color: #fff; box-shadow: var(--sh1); }

.chk {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 12px; font-weight: 600; color: var(--text3);
  transition: all .12s; user-select: none;
}
.chk:hover { border-color: var(--border2); color: var(--text2); }
.chk.on { background: rgba(79,70,229,.18); border-color: rgba(99,102,241,.5); color: var(--accent3); }
.chk.tba { opacity: .45; cursor: default; }
.chk .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ============ ПОИСК ============ */
.searchbar {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 0 12px;
  width: 300px; transition: border-color .15s, box-shadow .15s;
}
.searchbar:focus-within { border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.searchbar svg { width: 15px; height: 15px; color: var(--text4); flex-shrink: 0; }
.searchbar input { flex: 1; background: none; border: 0; outline: 0; padding: 8px 0; font-size: 13.5px; color: var(--text); }
.searchbar input::placeholder { color: var(--text4); }

/* ============ KPI ============ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px; margin-bottom: 18px;
}
.kpi {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 14px 16px 13px;
  transition: transform .15s, border-color .15s;
}
.kpi::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--grad);
}
/* полоски разных оттенков (как в утверждённом скетче), семантика Sonarr:
   1 фильмы — бренд, 2 сериалы — ended blue, 3 загрузки — dl purple,
   4 missing — red, 5 диск — warn amber */
.kpi:nth-child(2)::before { background: var(--blue); }
.kpi:nth-child(3)::before { background: var(--purple); }
.kpi:nth-child(4)::before { background: var(--red); }
.kpi:nth-child(5)::before { background: var(--amber); }
.kpi.warn::before { background: var(--amber); }
.kpi.err::before { background: var(--red); }
.kpi:hover { transform: translateY(-2px); border-color: var(--border2); }
.kpi .l { font-size: 11.5px; font-weight: 600; color: var(--text3); letter-spacing: .02em; }
.kpi .v { font: 700 26px/1.15 var(--mono); margin-top: 6px; color: var(--text); }
.kpi .v small { font-size: 14px; color: var(--text3); font-weight: 600; }
.kpi .sub { font-size: 11.5px; color: var(--text4); margin-top: 3px; }
.kpi .sub.ok { color: var(--green); }
.kpi .sub.warn { color: var(--amber); }
.kpi .sub.err { color: var(--red); }
.kpi .ic { position: absolute; right: 12px; top: 12px; width: 20px; height: 20px; color: var(--text4); opacity: .7; }
.kpi.warn .v { color: var(--amber); }
.kpi.err .v { color: var(--red); }

/* ============ КАРТОЧКИ ============ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 16px;
}
.card h3 {
  font-size: 13.5px; font-weight: 700; margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.card h3 .more { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--accent3); }

/* постер-карточка (Jellyseerr TitleCard) */
.pcard {
  position: relative; flex-shrink: 0;
  width: 150px; border-radius: var(--r2); overflow: hidden;
  background: var(--surface2); border: 1px solid var(--border);
  cursor: pointer; transition: transform .18s, border-color .18s, box-shadow .18s;
}
.pcard:hover { transform: translateY(-3px) scale(1.02); border-color: var(--border2); box-shadow: var(--sh2); z-index: 2; }
.pcard .poster { aspect-ratio: 2/3; width: 100%; object-fit: cover; display: block; background: var(--surface2); }
.pcard .ph { aspect-ratio: 2/3; width: 100%; display: flex; align-items: center; justify-content: center; color: var(--text4); background: linear-gradient(160deg, #232f42, #1a2434); }
.pcard .ph svg { width: 34px; height: 34px; opacity: .5; }
.pcard .rate {
  position: absolute; top: 6px; right: 6px;
  display: inline-flex; align-items: center; gap: 3px;
  background: rgba(0,0,0,.72); backdrop-filter: blur(4px);
  color: var(--star); font: 700 11px/1 var(--mono);
  padding: 3.5px 6px; border-radius: 6px;
}
.pcard .rate svg { width: 10px; height: 10px; fill: var(--star); }
.pcard .badge { position: absolute; top: 6px; left: 6px; }
.pcard .t {
  padding: 7px 9px 8px; font-size: 11.5px; font-weight: 600; line-height: 1.3;
  color: var(--text2); overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 30px;
}
.pcard .y { font: 10.5px var(--mono); color: var(--text4); padding: 0 9px 8px; }
.pcard .ovl {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(11,16,32,.72); opacity: 0; transition: opacity .15s;
}
.pcard:hover .ovl { opacity: 1; }
.pcard .ovl .btn { padding: 6px 12px; font-size: 12px; }

/* ============ КАРУСЕЛИ (Jellyseerr MediaSlider) ============ */
.sec-h { display: flex; align-items: baseline; gap: 10px; margin: 22px 0 10px; }
.sec-h h2 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.sec-h .cnt { font: 600 11px var(--mono); color: var(--text4); }
.sec-h .more { margin-left: auto; font-size: 12px; color: var(--accent3); cursor: pointer; }
.carousel { position: relative; }
.carousel .track {
  display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 12px;
  scroll-snap-type: x mandatory;
}
.carousel .track::-webkit-scrollbar { height: 8px; }
.carousel .track::-webkit-scrollbar-thumb { border-width: 1px; }
.carousel .pcard { scroll-snap-align: start; }
.carousel .cbtn {
  position: absolute; top: 40%; transform: translateY(-50%); z-index: 5;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(15,23,42,.85); border: 1px solid var(--border2);
  color: var(--text2); display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s;
}
.carousel:hover .cbtn { opacity: 1; }
@media (pointer: coarse) { .carousel .cbtn { opacity: 1; } }
.carousel .cbtn:hover { background: var(--surface3); color: #fff; }
.carousel .cbtn.l { left: -6px; } .carousel .cbtn.r { right: -6px; }

/* ============ СЕТКИ ============ */
.pgrid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
@media (max-width: 560px) { .pgrid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; } }

/* ============ ТАБЛИЦЫ ============ */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r2); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .06em;
  color: var(--text4); padding: 10px 14px; border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,.15); white-space: nowrap;
}
.tbl td { padding: 9px 14px; border-bottom: 1px solid rgba(148,163,184,.07); vertical-align: middle; color: var(--text2); }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: rgba(255,255,255,.035); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { font-family: var(--mono); font-size: 12.5px; }
.tbl .r { text-align: right; }
.tbl .c { text-align: center; }
.tbl .sub { color: var(--text4); font-size: 11.5px; }

/* ============ ПРОГРЕСС-БАРЫ (семантика Sonarr) ============ */
.pbar { height: 5px; border-radius: 99px; background: rgba(148,163,184,.15); overflow: hidden; min-width: 80px; }
.pbar .fill {
  height: 100%; border-radius: 99px;
  transform-origin: left center;
  transition: transform .4s ease;
}
.pbar.dl .fill { background: var(--purple); }
.pbar.ok .fill { background: var(--green); }
.pbar.miss .fill { background: var(--red); }
.pbar.end .fill { background: var(--blue); }
.pbar.warn .fill { background: var(--amber); }
.pbar.lg { height: 8px; }
.pbar.sm { height: 5px; min-width: 50px; }
.prow {
  display: flex; align-items: center; gap: 10px;
}
.prow .pt { font: 600 12px var(--mono); color: var(--text2); white-space: nowrap; min-width: 64px; text-align: right; }
.prow .ps { font: 11px var(--mono); color: var(--text4); white-space: nowrap; }

/* ============ БЕЙДЖИ ============ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font: 600 10.5px/1 var(--mono);
  padding: 3.5px 7px; border-radius: 6px;
  background: var(--surface2); color: var(--text3); border: 1px solid var(--border);
  white-space: nowrap;
}
.badge.wanted { background: rgba(79,70,229,.15); border-color: rgba(99,102,241,.4); color: var(--accent3); }
.badge.dl { background: rgba(122,67,182,.18); border-color: rgba(122,67,182,.5); color: #c4a5e8; }
.badge.up { background: rgba(0,133,61,.16); border-color: rgba(0,133,61,.5); color: #6ee7a0; }
.badge.err { background: rgba(240,80,80,.14); border-color: rgba(240,80,80,.45); color: #fca5a5; }
.badge.ok { background: rgba(0,133,61,.14); border-color: rgba(0,133,61,.4); color: #86efac; }
.badge.miss { background: rgba(240,80,80,.12); border-color: rgba(240,80,80,.35); color: #f87171; }
.badge.end { background: rgba(93,156,236,.14); border-color: rgba(93,156,236,.4); color: #93c5fd; }
.badge.warn { background: rgba(255,165,0,.12); border-color: rgba(255,165,0,.4); color: #fcd34d; }
.badge.ghost { background: transparent; border-color: var(--border); color: var(--text4); }

/* статус-точка */
.sdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sdot.dl { background: var(--purple); box-shadow: 0 0 6px rgba(122,67,182,.7); }
.sdot.ok { background: var(--green); }
.sdot.miss { background: var(--red); }
.sdot.end { background: var(--blue); }
.sdot.warn { background: var(--amber); }
.sdot.off { background: var(--text4); }

/* ============ МОДАЛКИ ============ */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.m-back { position: absolute; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(3px); }
.modal-card {
  position: relative; z-index: 1;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--r3); box-shadow: var(--sh2);
  width: 560px; max-width: 100%; max-height: 88vh;
  display: flex; flex-direction: column;
  animation: modalIn .16s ease;
}
.modal-card.m-wide { width: 900px; }
.modal-card.m-sm { width: 420px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.m-x {
  position: absolute; top: 10px; right: 10px; z-index: 5;
  width: 30px; height: 30px; border-radius: 50%;
  color: var(--text3); font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.35); transition: all .12s;
}
.m-x:hover { background: rgba(0,0,0,.6); color: #fff; }
.modal-body { overflow-y: auto; padding: 0; }
.m-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.m-text { color: var(--text3); font-size: 13.5px; }
.m-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* детальная карточка тайтла (hero) */
.d-hero { position: relative; border-radius: var(--r3) var(--r3) 0 0; overflow: hidden; min-height: 220px; }
.d-hero .bg { position: absolute; inset: 0; background-size: cover; background-position: center 25%; filter: blur(0); }
.d-hero .scrim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(17,24,39,.35), rgba(17,24,39,.92) 78%, var(--surface)); }
.d-hero .in { position: relative; z-index: 1; display: flex; gap: 18px; padding: 24px; align-items: flex-end; }
.d-hero .poster { width: 130px; border-radius: var(--r2); box-shadow: var(--sh2); border: 1px solid var(--border2); }
.d-hero h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.d-hero .orig { color: var(--text3); font-size: 13px; margin-top: 2px; }
.d-hero .facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.d-hero .tagline { color: var(--text3); font-style: italic; margin-top: 8px; font-size: 13px; }
.d-body { padding: 18px 24px 24px; }
.d-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.d-overview { color: var(--text2); font-size: 13.5px; line-height: 1.6; margin-top: 12px; max-height: 120px; overflow-y: auto; }
.d-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.d-meta .m { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r1); padding: 8px 12px; }
.d-meta .m .k { font: 600 10px var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--text4); }
.d-meta .m .val { font-size: 13px; font-weight: 600; margin-top: 2px; color: var(--text2); }
.d-trailer { margin-top: 14px; }
.d-trailer iframe { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: var(--r2); background: #000; }
.d-recs { margin-top: 18px; }

/* пикер сезонов */
.pick-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.pick-head .poster { width: 44px; border-radius: 6px; }
.pick-head h3 { font-size: 15px; font-weight: 700; }
.pick-head .sub { font-size: 12px; color: var(--text3); }
.pick-body { padding: 14px 20px; }
.wq-acts { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.wq-season { border: 1px solid var(--border); border-radius: var(--r2); margin-bottom: 10px; overflow: hidden; background: var(--surface2); }
.wq-season > .wq-sh {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer;
  user-select: none; transition: background .1s;
}
.wq-season > .wq-sh:hover { background: rgba(255,255,255,.03); }
.wq-season > .wq-sh .cb {
  width: 17px; height: 17px; border-radius: 5px; border: 2px solid var(--text4);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-size: 10px; color: transparent; transition: all .12s;
}
.wq-season.on > .wq-sh .cb { background: var(--accent); border-color: var(--accent); color: #fff; }
.wq-season.partial > .wq-sh .cb { background: rgba(99,102,241,.35); border-color: var(--accent2); color: #fff; }
.wq-season > .wq-sh .sn { font-weight: 700; font-size: 13.5px; }
.wq-season > .wq-sh .sm { color: var(--text4); font-size: 12px; margin-left: auto; }
.wq-season .wq-eps { display: none; flex-wrap: wrap; gap: 6px; padding: 4px 14px 12px; }
.wq-season.on .wq-eps, .wq-season.partial .wq-eps { display: flex; }
.wq-ep { padding: 3.5px 9px; border-radius: 99px; border: 1px solid var(--border); font: 600 11.5px var(--mono); color: var(--text3); transition: all .12s; }
.wq-ep:hover { border-color: var(--border2); }
.wq-ep.on { background: rgba(79,70,229,.2); border-color: var(--accent2); color: var(--accent3); }
.wq-ep.tba { opacity: .4; text-decoration: line-through; cursor: default; }
.wq-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px 16px; border-top: 1px solid var(--border); }

/* сезоны в карточке библиотеки */
.season-block { border: 1px solid var(--border); border-radius: var(--r2); margin-bottom: 10px; overflow: hidden; background: var(--surface2); }
.season-block .sh { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; user-select: none; }
.season-block .sh:hover { background: rgba(255,255,255,.03); }
.season-block .sh .chev { margin-left: auto; color: var(--text4); transition: transform .15s; width: 14px; height: 14px; }
.season-block.open .sh .chev { transform: rotate(90deg); }
.season-block .eps { display: none; border-top: 1px solid var(--border); }
.season-block.open .eps { display: block; }
.ep-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 14px; font-size: 13px;
  border-bottom: 1px solid rgba(148,163,184,.06);
}
.ep-row:last-child { border-bottom: 0; }
.ep-row .en { font: 600 12px var(--mono); color: var(--text4); width: 34px; flex-shrink: 0; }
.ep-row .et { flex: 1; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ep-row .ed { font: 11.5px var(--mono); color: var(--text4); flex-shrink: 0; }
.ep-row .st { flex-shrink: 0; display: flex; gap: 4px; align-items: center; }
.ep-row.unaired .et { color: var(--text4); }

/* ============ ФОРМЫ (Jellyseerr settings) ============ */
.set-wrap { display: grid; grid-template-columns: 200px 1fr; gap: 22px; align-items: start; }
@media (max-width: 900px) { .set-wrap { grid-template-columns: 1fr; } }
.set-cats { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; }
@media (max-width: 900px) { .set-cats { flex-direction: row; overflow-x: auto; position: static; } }
.set-cats button {
  text-align: left; padding: 9px 13px; border-radius: var(--r2);
  color: var(--text3); font-size: 13.5px; font-weight: 600;
  display: flex; align-items: center; gap: 9px; transition: all .12s; white-space: nowrap;
}
.set-cats button svg { width: 16px; height: 16px; opacity: .75; }
.set-cats button:hover { color: var(--text2); background: rgba(255,255,255,.04); }
.set-cats button.on { background: var(--surface); color: #fff; border: 1px solid var(--border); }
.set-body { display: flex; flex-direction: column; gap: 14px; }
.set-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r2); padding: 18px; }
.set-card h3 { font-size: 14.5px; font-weight: 700; margin-bottom: 4px; }
.set-card .desc { color: var(--text3); font-size: 12.5px; margin-bottom: 14px; }
/* строка настройки: label слева, значение + [Изменить] справа */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid rgba(148,163,184,.07); }
.set-row:last-child { border-bottom: 0; }
.set-row .sr-l { min-width: 0; }
.set-row .fl { font-size: 13px; font-weight: 600; color: var(--text2); }
.set-row .fh { font-size: 12px; color: var(--text4); margin-top: 2px; }
.set-row .sr-r { display: flex; align-items: center; gap: 10px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.set-row .sr-v { font-family: var(--mono); font-size: 12.5px; color: var(--text); background: var(--bg2); border: 1px solid var(--border2); border-radius: var(--r1); padding: 5px 10px; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-row .sr-empty { color: var(--text4); }
@media (max-width: 700px) {
  .set-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .set-row .sr-r { justify-content: space-between; }
  .set-row .sr-v { max-width: none; }
}
.field { display: grid; grid-template-columns: 230px 1fr; gap: 10px 18px; padding: 11px 0; border-bottom: 1px solid rgba(148,163,184,.07); align-items: center; }
.field:last-child { border-bottom: 0; }
@media (max-width: 700px) { .field { grid-template-columns: 1fr; gap: 4px; } }
.field .fl { font-size: 13px; font-weight: 600; color: var(--text2); }
.field .fh { font-size: 12px; color: var(--text4); margin-top: 2px; }
.field .fc { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.inp {
  width: 100%; padding: 8px 12px;
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--r1); font-size: 13.5px; color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.inp:focus { border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.inp::placeholder { color: var(--text4); }
select.inp { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394a3b8' fill='none' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 30px; }
textarea.inp { resize: vertical; min-height: 70px; font-family: var(--mono); font-size: 12.5px; }

/* тумблер */
.tgl { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.tgl input { opacity: 0; width: 0; height: 0; }
.tgl .tk {
  position: absolute; inset: 0; border-radius: 99px;
  background: var(--surface3); border: 1px solid var(--border2); transition: all .18s;
}
.tgl .tk::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #cbd5e1; transition: all .18s;
}
.tgl input:checked + .tk { background: var(--accent); border-color: var(--accent); }
.tgl input:checked + .tk::after { transform: translateX(18px); background: #fff; }

/* ============ ТОСТЫ ============ */
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--r1); padding: 10px 14px;
  font-size: 13px; color: var(--text2);
  box-shadow: var(--sh2); max-width: 340px;
  animation: toastIn .18s ease;
}
.toast::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.toast.ok::before { background: var(--green); }
.toast.err::before { background: var(--red); }
.toast.warn::before { background: var(--amber); }
@keyframes toastIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.toast.out { opacity: 0; transform: translateX(16px); transition: all .3s; }

/* ============ СКЕЛЕТОНЫ ============ */
.skel { position: relative; overflow: hidden; background: var(--surface2); border-radius: var(--r1); }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.skel-card { aspect-ratio: 2/3; border-radius: var(--r2); }
.skel-line { height: 12px; margin-bottom: 8px; }
.skel-line.w60 { width: 60%; } .skel-line.w80 { width: 80%; }

/* ============ ПУСТЫЕ СОСТОЯНИЯ ============ */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 48px 20px; text-align: center; color: var(--text4);
}
.empty svg { width: 42px; height: 42px; opacity: .35; }
.empty .t { font-size: 15px; font-weight: 600; color: var(--text3); }
.empty .s { font-size: 12.5px; max-width: 380px; }

/* ============ ГЛАВНАЯ ============ */
.home-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 1100px) { .home-cols { grid-template-columns: 1fr; } }
.hlist { display: flex; flex-direction: column; }
.hitem { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--r1); transition: background .1s; }
.hitem:hover { background: rgba(255,255,255,.04); cursor: pointer; }
.hitem .poster { width: 38px; height: 57px; object-fit: cover; border-radius: 5px; flex-shrink: 0; background: var(--surface2); }
.hitem .ph { width: 38px; height: 57px; border-radius: 5px; background: var(--surface2); flex-shrink: 0; }
.hitem .tt { flex: 1; min-width: 0; }
.hitem .tt .t1 { font-size: 13px; font-weight: 600; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hitem .tt .t2 { font-size: 11.5px; color: var(--text4); }
.hitem .date { font: 600 12px var(--mono); color: var(--accent3); flex-shrink: 0; }
.hitem .date.soon { color: var(--amber); }
.hitem .sz { font: 11.5px var(--mono); color: var(--text4); flex-shrink: 0; }

/* статус движка */
.eng-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 12px 16px; margin-bottom: 14px;
}
.eng-row .tt { flex: 1; }
.eng-row .tt .t1 { font-weight: 700; font-size: 13.5px; }
.eng-row .tt .t2 { font-size: 12px; color: var(--text3); }
.eng-row .spin { width: 16px; height: 16px; }

/* ============ МОНИТОРИНГ ============ */
.tr-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.tr-strip .kpi::before { background: var(--green); }
.tr-strip .kpi.dl::before { background: var(--purple); }
.tr-tools { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.tr-name { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--text2); }
.tbl .act { display: flex; gap: 4px; justify-content: flex-end; }
.tbl .act button {
  width: 26px; height: 26px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text4); transition: all .12s;
}
.tbl .act button:hover { background: var(--surface3); color: var(--text2); }
.tbl .act button.del:hover { background: rgba(240,80,80,.18); color: #fca5a5; }
.tbl .act svg { width: 14px; height: 14px; }

/* ============ МОБИЛЬНАЯ НАВИГАЦИЯ ============ */
.mnav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 80;
  background: rgba(17,24,39,.94); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.mnav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 2px; border-radius: 9px; color: var(--text4);
  font-size: 9.5px; font-weight: 600; transition: all .12s;
}
.mnav button svg { width: 20px; height: 20px; }
.mnav button.on { color: var(--accent3); }
.mnav button.on svg { filter: drop-shadow(0 0 6px rgba(99,102,241,.55)); }

/* ============ RESPONSIVE ============ */
@media (max-width: 992px) {
  .sb { display: none; }
  .main { padding: 20px 16px 90px; }
  .mnav { display: flex; }
  .searchbar { width: 100%; }
  .view-head { align-items: flex-start; flex-direction: column; }
  .view-actions { width: 100%; }
  .modal-card { max-height: 92vh; }
  .d-hero .in { flex-direction: column; align-items: flex-start; }
  .d-hero .poster { width: 110px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============ ЭКРАН ВХОДА ============ */
.login[hidden] { display: none; }
.login {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(99,102,241,.14), transparent 60%),
              radial-gradient(800px 400px at 85% 110%, rgba(139,92,246,.08), transparent 55%),
              var(--bg2);
  padding: 20px;
}
.login::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(148,163,184,.04) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(148,163,184,.04) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(600px 400px at 50% 30%, #000, transparent 75%);
  -webkit-mask-image: radial-gradient(600px 400px at 50% 30%, #000, transparent 75%);
  pointer-events: none;
}
.login-card {
  position: relative;
  width: 400px; max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r3);
  box-shadow: 0 24px 64px rgba(0,0,0,.5), 0 4px 16px rgba(0,0,0,.35);
  padding: 34px 32px 24px;
  animation: login-in .22s ease-out;
}
@keyframes login-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.login-card.shake { animation: login-shake .34s ease; }
@keyframes login-shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}
.login-brand { display: flex; align-items: center; gap: 13px; }
.login-logo {
  width: 46px; height: 46px; border-radius: 12px; flex: none;
  background: var(--grad);
  box-shadow: var(--sh-grad);
  color: #fff; font-family: var(--mono); font-weight: 600; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: -1px;
}
.login-title { font-size: 19px; font-weight: 800; letter-spacing: -.2px; color: var(--text); }
.login-ver { font-family: var(--mono); font-size: 11px; color: var(--text4); margin-top: 2px; }
.login-sub { margin: 20px 0 16px; font-size: 13px; color: var(--text3); }
.login-label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 7px; }
.login-inp { width: 100%; font-family: var(--mono); font-size: 14px; letter-spacing: .4px; }
.login-btn { width: 100%; margin-top: 18px; height: 42px; font-size: 14px; font-weight: 600; }
.login-spin {
  display: inline-block; width: 15px; height: 15px; vertical-align: -3px; margin-left: 8px;
  border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%;
  animation: rot .8s linear infinite;
}
.login-err {
  margin-top: 12px; font-size: 12.5px; color: var(--red);
  background: rgba(240,80,80,.1); border: 1px solid rgba(240,80,80,.3);
  border-radius: var(--r1); padding: 8px 11px;
}
.login-foot { margin-top: 22px; text-align: center; font-family: var(--mono); font-size: 10.5px; color: var(--text4); letter-spacing: .3px; }
@media (max-width: 480px) {
  .login-card { padding: 28px 22px 20px; }
  .login { padding: 14px; }
}

/* кнопка «Выйти» в сайдбаре */
.sb-nav .sb-logout { color: var(--text4); }
.sb-nav .sb-logout:hover { color: var(--red); background: rgba(240,80,80,.08); }
