:root {
  color-scheme: dark;
  --bg: #090b10;
  --sidebar: #0d1017;
  --panel: #121720;
  --panel-2: #171d28;
  --panel-3: #1d2431;
  --border: #252d3a;
  --border-soft: #1c2330;
  --text: #f4f7fb;
  --muted: #8f9aac;
  --muted-2: #7b879a;
  --accent: #7c5cff;
  --accent-2: #9d87ff;
  --accent-soft: rgba(124, 92, 255, .14);
  --cyan: #40c9ff;
  --ok: #4fd18b;
  --warn: #f5b84b;
  --err: #ff6874;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 20px 55px rgba(0, 0, 0, .24);
  --sidebar-w: 252px;
  --on-accent: #fff;
  --body-glow: rgba(124, 92, 255, .09);
  --sidebar-glass: rgba(13, 16, 23, .96);
  --mobile-header: rgba(13, 16, 23, .94);
  --link-hover: #baaaff;
  --code-bg: rgba(255, 255, 255, .035);
  --code-text: #c9d2e3;
  --hover-bg: rgba(255, 255, 255, .035);
  --icon-bg: rgba(255, 255, 255, .045);
  --icon-text: #aab4c4;
  --text-strong: #e7ecf4;
  --text-soft: #dfe5ee;
  --card-bg: linear-gradient(145deg, rgba(23, 29, 40, .76), rgba(18, 23, 32, .96));
  --stat-bg: linear-gradient(145deg, rgba(24, 30, 41, .9), rgba(16, 20, 28, .92));
  --subtle-bg: rgba(9, 11, 16, .28);
  --inset-bg: rgba(9, 11, 16, .24);
  --path-bg: rgba(0, 0, 0, .16);
  --storage-bg: rgba(18, 23, 32, .72);
  --input-bg: #0e1219;
  --placeholder: #566173;
  --readonly: #cbd4e2;
  --ghost-text: #dbe2ed;
  --ghost-hover-border: #3b4658;
  --table-head: #171d28;
  --table-head-text: #7f8a9b;
  --row-hover: rgba(255, 255, 255, .025);
  --tag-bg: rgba(255, 255, 255, .025);
  --overlay: rgba(3, 5, 8, .78);
  --modal-bg: #11161f;
  --login-base: #090b10;
  --image-shadow: 0 5px 16px rgba(0, 0, 0, .32);
  --card-edge: rgba(255, 255, 255, .02);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fb;
  --sidebar: #ffffff;
  --panel: #ffffff;
  --panel-2: #f7f8fc;
  --panel-3: #edf0f6;
  --border: #d7ddea;
  --border-soft: #e7eaf1;
  --text: #172033;
  --muted: #566277;
  --muted-2: #68758a;
  --accent: #6748df;
  --accent-2: #593bc8;
  --accent-soft: rgba(103, 72, 223, .11);
  --cyan: #087c9f;
  --ok: #147a46;
  --warn: #8a5b00;
  --err: #bd2d3c;
  --shadow: 0 16px 42px rgba(31, 41, 55, .09);
  --body-glow: rgba(103, 72, 223, .075);
  --sidebar-glass: rgba(255, 255, 255, .96);
  --mobile-header: rgba(255, 255, 255, .95);
  --link-hover: #4628aa;
  --code-bg: rgba(23, 32, 51, .055);
  --code-text: #334155;
  --hover-bg: rgba(51, 65, 85, .06);
  --icon-bg: rgba(51, 65, 85, .07);
  --icon-text: #536176;
  --text-strong: #263247;
  --text-soft: #344054;
  --card-bg: linear-gradient(145deg, #ffffff, #fafbfe);
  --stat-bg: linear-gradient(145deg, #ffffff, #f8f9fd);
  --subtle-bg: rgba(103, 72, 223, .035);
  --inset-bg: rgba(51, 65, 85, .035);
  --path-bg: rgba(51, 65, 85, .055);
  --storage-bg: rgba(255, 255, 255, .78);
  --input-bg: #ffffff;
  --placeholder: #7a8699;
  --readonly: #475569;
  --ghost-text: #334155;
  --ghost-hover-border: #aeb8ca;
  --table-head: #f0f3f8;
  --table-head-text: #526076;
  --row-hover: rgba(103, 72, 223, .045);
  --tag-bg: rgba(51, 65, 85, .045);
  --overlay: rgba(15, 23, 42, .42);
  --modal-bg: #ffffff;
  --login-base: #f4f6fb;
  --image-shadow: 0 5px 16px rgba(31, 41, 55, .16);
  --card-edge: rgba(255, 255, 255, .8);
}

* { box-sizing: border-box; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link { position: fixed; top: 10px; left: 10px; z-index: 100; transform: translateY(-150%); border: 2px solid var(--cyan); border-radius: 8px; background: var(--modal-bg); color: var(--text); padding: 9px 13px; font-weight: 750; transition: transform .15s; }
.skip-link:focus { transform: translateY(0); }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 75% -10%, var(--body-glow), transparent 28rem),
    var(--bg);
  color: var(--text);
  font: 14px/1.55 Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--link-hover); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
code {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 2px 6px;
  font: 12px/1.4 "SFMono-Regular", Consolas, monospace;
}

/* Layout */
.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: var(--sidebar-w);
  flex-direction: column;
  border-right: 1px solid var(--border-soft);
  background: var(--sidebar-glass);
  padding: 18px 14px 12px;
  backdrop-filter: blur(18px);
  overflow-x: hidden;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 0 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .08em;
}
.brand:hover { color: var(--text); }
.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 10px;
  background: rgba(124, 92, 255, .12);
  box-shadow: 0 8px 24px rgba(124, 92, 255, .3);
  color: var(--on-accent);
}
.brand-mark img { display: block; width: 29px; height: 29px; object-fit: contain; }
.brand span { color: var(--accent-2); }
.brand-name span { margin-left: 3px; }

.nav-label {
  margin: 16px 12px 6px;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 39px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: .18s ease;
}
.nav a:hover {
  background: var(--hover-bg);
  color: var(--text);
}
.nav a.active {
  border-color: rgba(124, 92, 255, .24);
  background: linear-gradient(90deg, rgba(124, 92, 255, .18), rgba(124, 92, 255, .07));
  color: var(--on-accent);
}
.nav-icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 7px;
  background: var(--icon-bg);
  color: var(--icon-text);
  font-size: 11px;
  font-weight: 800;
}
.nav a.active .nav-icon { background: var(--accent); color: var(--on-accent); }
.nav-text { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-badge { display: grid; min-width: 22px; height: 22px; place-items: center; border: 1px solid rgba(79,209,139,.28); border-radius: 999px; background: rgba(79,209,139,.1); color: var(--ok); padding: 0 6px; font-size: 10px; font-weight: 800; }
.nav-badge[hidden] { display: none; }
.nav-action {
  display: flex;
  min-height: 39px;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
}
.nav-action:hover { border-color: rgba(255, 104, 116, .14); background: rgba(255, 104, 116, .07); color: #ff9099; transform: none; }
.nav-action:disabled { opacity: .45; }
.nav-danger .nav-icon { color: var(--err); }
.theme-toggle:hover { border-color: var(--border); background: var(--hover-bg); color: var(--text); }
.theme-toggle .nav-icon { color: var(--accent-2); }
.sidebar-system { margin-top: 14px; }
.sidebar-system > summary { display: flex; min-height: 42px; align-items: center; gap: 12px; border: 1px solid var(--border-soft); border-radius: 11px; background: var(--panel-2); color: var(--muted); padding: 0 12px; font-size: 13px; font-weight: 650; cursor: pointer; list-style: none; transition: .18s ease; }
.sidebar-system > summary::-webkit-details-marker { display: none; }
.sidebar-system > summary:hover { border-color: rgba(124, 92, 255, .3); background: var(--hover-bg); color: var(--text); }
.sidebar-system > summary.active { border-color: rgba(124, 92, 255, .3); background: var(--accent-soft); color: var(--accent-2); }
.sidebar-system > summary.active .nav-icon { background: var(--accent); color: #fff; }
.sidebar-system-chevron { flex: 0 0 auto; color: var(--muted-2); font-size: 16px; line-height: 1; transition: transform .18s ease; }
.sidebar-system[open] .sidebar-system-chevron { transform: rotate(180deg); }
.sidebar-system-panel { margin-top: 6px; border-left: 1px solid var(--border-soft); padding-left: 7px; }
.sidebar-system-danger { margin-top: 4px; border-top-color: var(--border-soft); }

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-soft);
  padding: 11px 7px 0;
}
.user-block { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--panel-3);
  color: var(--accent-2);
  font-weight: 700;
  text-transform: uppercase;
}
.user-meta { min-width: 0; flex: 1; }
.who { display: block; overflow: hidden; color: var(--text-soft); font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.user-role { color: var(--muted-2); font-size: 10px; }
.logout { color: var(--muted-2); font-size: 12px; }

.mobile-topbar { display: none; }
.main { min-width: 0; margin-left: var(--sidebar-w); }
.wrap { width: min(1480px, 100%); margin: 0 auto; padding: 34px 34px 64px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 25px; }
h1 { margin: 0 0 5px; font-size: clamp(24px, 2.4vw, 31px); line-height: 1.2; letter-spacing: -.035em; }
h2 { margin: 32px 0 13px; font-size: 16px; line-height: 1.3; letter-spacing: -.01em; }
h3 { letter-spacing: -.01em; }
.sub { max-width: 760px; margin: 0 0 24px; color: var(--muted); font-size: 13px; }
.page-heading .sub { margin: 0; }
.eyebrow { margin-bottom: 8px; color: var(--accent-2); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }

/* Cards and dashboard */
.card {
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  padding: 20px;
  box-shadow: 0 1px 0 var(--card-edge);
}
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat {
  position: relative;
  min-height: 116px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--stat-bg);
  padding: 18px;
}
.stat::after {
  position: absolute;
  right: -24px;
  bottom: -34px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--stat-color, var(--accent));
  content: "";
  filter: blur(34px);
  opacity: .12;
}
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  background: color-mix(in srgb, var(--stat-color, var(--accent)) 14%, transparent);
  color: var(--stat-color, var(--accent-2));
  font-size: 11px;
  font-weight: 800;
}
.stat .n { margin-top: 13px; font-size: 27px; font-weight: 750; line-height: 1; letter-spacing: -.04em; }
.stat .l { margin-top: 7px; color: var(--muted); font-size: 11px; font-weight: 600; }

.dashboard-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, .8fr); gap: 18px; margin-top: 20px; }
.dashboard-layout .card { margin: 0; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-head h2 { margin: 0 0 4px; font-size: 17px; }
.section-head p { margin: 0; color: var(--muted); font-size: 12px; }
.section-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.section-index { color: var(--muted-2); font: 700 11px/1 "SFMono-Regular", Consolas, monospace; }
.import-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.import-option { display: flex; min-width: 0; flex-direction: column; border: 1px solid var(--border-soft); border-radius: 12px; background: var(--subtle-bg); padding: 15px; }
.import-option label { color: var(--text-soft); font-weight: 650; }
.import-option .hint { min-height: 38px; margin: 2px 0 12px; color: var(--muted); font-size: 11px; }
.import-option button { align-self: flex-start; margin-top: 10px; }
.privacy-note { display: flex; align-items: flex-start; gap: 8px; margin: 15px 0 0; color: var(--muted-2); font-size: 11px; }
.privacy-dot { width: 6px; height: 6px; flex: 0 0 6px; margin-top: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px rgba(79, 209, 139, .6); }

.workflow { display: flex; flex-direction: column; }
.workflow-step { position: relative; display: grid; grid-template-columns: 28px 1fr auto; gap: 11px; align-items: center; min-height: 62px; padding: 9px 0; }
.workflow-step + .workflow-step { border-top: 1px solid var(--border-soft); }
.step-number { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid var(--border); border-radius: 9px; background: var(--panel-2); color: var(--accent-2); font-size: 11px; font-weight: 800; }
.workflow-step strong { display: block; color: var(--text-strong); font-size: 12px; }
.workflow-step small { display: block; margin-top: 1px; color: var(--muted-2); font-size: 10px; }
.step-arrow { color: var(--muted-2); }
.system-path { display: flex; align-items: center; gap: 9px; max-width: 430px; border: 1px solid var(--border); border-radius: 10px; background: var(--path-bg); padding: 8px 11px; color: var(--muted); font-size: 11px; }
.system-path code { overflow: hidden; border: 0; background: none; padding: 0; text-overflow: ellipsis; white-space: nowrap; }
.storage-card { display: grid; grid-template-columns: minmax(230px, auto) minmax(180px, 1fr) auto; align-items: center; gap: 18px; margin-top: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--storage-bg); padding: 13px 16px; }
.storage-copy { display: flex; align-items: center; gap: 11px; }
.storage-copy strong, .storage-copy small { display: block; }
.storage-copy small { color: var(--muted); font-size: 10px; }
.storage-icon { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; background: rgba(64, 201, 255, .11); color: var(--cyan); font-size: 10px; font-weight: 800; }
.storage-meter { height: 7px; overflow: hidden; border-radius: 99px; background: var(--panel-3); }
.storage-meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--cyan)); }
.storage-percent { color: var(--muted); font-size: 11px; white-space: nowrap; }

/* Dashboard operacional */
.dashboard-heading { align-items: center; }
.dashboard-heading-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.dashboard-heading-actions { display: flex; gap: 8px; }
.dashboard-viewers-link { align-items: center; gap: 8px; }
.dashboard-viewers-link .viewer-live-dot { width: 7px; height: 7px; box-shadow: 0 0 0 3px rgba(79,209,139,.1); }
.dashboard-viewers-link b { min-width: 18px; border-radius: 999px; background: rgba(79,209,139,.1); color: var(--ok); padding: 2px 5px; font-size: 9px; text-align: center; }
.dashboard-viewers-link b[hidden] { display: none; }
.dashboard-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.dashboard-kpi { position: relative; display: grid; min-width: 0; min-height: 126px; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: start; gap: 12px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--stat-bg); padding: 17px; color: var(--text); transition: border-color .16s, transform .16s; }
.dashboard-kpi::after { position: absolute; right: -26px; bottom: -40px; width: 100px; height: 100px; border-radius: 50%; background: var(--kpi-tone, var(--accent)); content: ""; filter: blur(38px); opacity: .13; }
.dashboard-kpi:hover { border-color: color-mix(in srgb, var(--kpi-tone, var(--accent)) 45%, var(--border)); color: var(--text); transform: translateY(-2px); }
.dashboard-kpi[data-tone="purple"] { --kpi-tone: var(--accent-2); }
.dashboard-kpi[data-tone="cyan"] { --kpi-tone: var(--cyan); }
.dashboard-kpi[data-tone="green"] { --kpi-tone: var(--ok); }
.dashboard-kpi[data-tone="red"] { --kpi-tone: var(--err); }
.dashboard-kpi[data-tone="neutral"] { --kpi-tone: var(--muted-2); }
.dashboard-kpi-icon { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 11px; background: color-mix(in srgb, var(--kpi-tone) 13%, transparent); color: var(--kpi-tone); font-size: 10px; font-weight: 850; }
.dashboard-kpi-copy { display: block; min-width: 0; }
.dashboard-kpi-copy small, .dashboard-kpi-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-kpi-copy small { color: var(--muted); font-size: 10px; font-weight: 700; }
.dashboard-kpi-copy strong { display: block; margin: 10px 0 5px; color: var(--text); font-size: 25px; line-height: 1; letter-spacing: -.04em; }
.dashboard-kpi-copy span { color: var(--muted-2); font-size: 10px; }
.dashboard-kpi-arrow { color: var(--muted-2); font-size: 15px; }

.dashboard-service-strip { display: grid; grid-template-columns: repeat(4, minmax(110px, auto)) minmax(200px, 1fr); align-items: center; gap: 0; margin: 13px 0 18px; border: 1px solid var(--border); border-radius: 11px; background: var(--storage-bg); padding: 10px 12px; }
.dashboard-service-strip > div { display: grid; min-width: 0; grid-template-columns: auto 1fr; align-items: center; gap: 2px 7px; padding: 0 12px; }
.dashboard-service-strip > div + div { border-left: 1px solid var(--border-soft); }
.dashboard-service-strip span { color: var(--muted-2); font-size: 9px; }
.dashboard-service-strip strong { grid-column: 2; color: var(--text-soft); font-size: 10px; }
.status-dot { width: 7px; height: 7px; grid-row: 1 / span 2; border-radius: 50%; }
.status-dot.ok { background: var(--ok); }
.status-dot.warn { background: var(--warn); }
.status-dot.bad { background: var(--err); }
.dashboard-service-strip .dashboard-service-path { display: flex; justify-content: flex-end; gap: 8px; }
.dashboard-service-path code { min-width: 0; overflow: hidden; border: 0; background: transparent; padding: 0; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }

.dashboard-control-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .72fr); gap: 18px; }
.dashboard-content-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .72fr); gap: 18px; margin-top: 18px; }
.dashboard-content-grid.dashboard-content-single { grid-template-columns: 1fr; }
.dashboard-control-grid .card, .dashboard-content-grid .card { margin: 0; }
.dashboard-section-head { margin-bottom: 17px; }
.dashboard-section-head h2 { margin-top: 2px; }
.section-kicker { color: var(--accent-2); font-size: 8px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }

.active-download-card { border: 1px solid var(--border-soft); border-radius: 12px; background: var(--inset-bg); padding: 14px; }
.active-download-head { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.active-download-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent-2); font-size: 9px; font-weight: 850; }
.active-download-head small, .active-download-head strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.active-download-head small { color: var(--muted-2); font-size: 9px; }
.active-download-head strong { color: var(--text-soft); font-size: 12px; }
.active-download-head b { color: var(--accent-2); font-size: 12px; }
.dashboard-progress { height: 7px; overflow: hidden; margin-top: 12px; border-radius: 999px; background: var(--panel-3); }
.dashboard-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--cyan)); }
.active-download-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 7px; color: var(--muted-2); font-size: 9px; }
.dashboard-idle-state { display: flex; min-height: 82px; align-items: center; gap: 12px; border: 1px solid var(--border-soft); border-radius: 12px; background: var(--inset-bg); padding: 14px; }
.dashboard-idle-icon { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); font-weight: 850; }
.dashboard-idle-state strong, .dashboard-idle-state small { display: block; }
.dashboard-idle-state strong { color: var(--text-soft); font-size: 12px; }
.dashboard-idle-state small { margin-top: 2px; color: var(--muted-2); font-size: 10px; }
.queue-distribution { margin-top: 16px; }
.queue-distribution-head { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 9px; }
.queue-distribution-head strong { color: var(--text-soft); }
.queue-segments { display: flex; height: 9px; overflow: hidden; margin-top: 8px; border-radius: 999px; background: var(--panel-3); }
.queue-segments i[data-status="done"], .queue-legend [data-status="done"] i { background: var(--ok); }
.queue-segments i[data-status="downloading"], .queue-legend [data-status="downloading"] i { background: var(--accent-2); }
.queue-segments i[data-status="queued"], .queue-legend [data-status="queued"] i { background: var(--warn); }
.queue-segments i[data-status="error"], .queue-legend [data-status="error"] i { background: var(--err); }
.queue-segments i[data-status="canceled"] { background: var(--muted-2); }
.queue-legend { display: flex; flex-wrap: wrap; gap: 7px 14px; margin-top: 10px; }
.queue-legend span { display: inline-flex; align-items: center; gap: 5px; color: var(--muted-2); font-size: 9px; }
.queue-legend span i { width: 6px; height: 6px; border-radius: 50%; }
.queue-legend span b { color: var(--text-soft); }

.alert-count { display: grid; min-width: 28px; height: 28px; place-items: center; border-radius: 9px; background: var(--panel-3); color: var(--muted); font-size: 10px; font-weight: 800; }
.dashboard-alert-list { display: grid; gap: 8px; }
.dashboard-alert { display: grid; grid-template-columns: 29px 1fr; gap: 10px; border: 1px solid var(--border-soft); border-radius: 10px; background: var(--inset-bg); padding: 11px; color: var(--text); }
.dashboard-alert:hover { border-color: var(--border); color: var(--text); }
.dashboard-alert > i { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 9px; background: color-mix(in srgb, var(--alert-tone) 12%, transparent); color: var(--alert-tone); font-style: normal; font-size: 11px; font-weight: 850; }
.dashboard-alert[data-tone="error"] { --alert-tone: var(--err); }
.dashboard-alert[data-tone="warning"] { --alert-tone: var(--warn); }
.dashboard-alert strong, .dashboard-alert small, .dashboard-alert b { display: block; }
.dashboard-alert strong { color: var(--text-soft); font-size: 10px; }
.dashboard-alert small { margin: 2px 0 4px; color: var(--muted-2); font-size: 9px; line-height: 1.4; }
.dashboard-alert b { color: var(--alert-tone); font-size: 8px; }
.dashboard-all-good { display: grid; min-height: 205px; place-content: center; justify-items: center; text-align: center; }
.dashboard-all-good span { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); font-size: 18px; }
.dashboard-all-good strong { margin-top: 10px; font-size: 12px; }
.dashboard-all-good small { color: var(--muted-2); font-size: 9px; }

.dashboard-activity-list { display: grid; }
.dashboard-activity { display: grid; min-width: 0; grid-template-columns: 34px minmax(0, 1fr) auto 78px; align-items: center; gap: 10px; border-bottom: 1px solid var(--border-soft); padding: 9px 0; color: var(--text); }
.dashboard-activity:first-child { padding-top: 0; }
.dashboard-activity:last-child { border-bottom: 0; padding-bottom: 0; }
.dashboard-activity:hover { color: var(--text); }
.activity-kind { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; background: var(--panel-3); color: var(--accent-2); font-size: 8px; font-weight: 850; }
.activity-copy { min-width: 0; }
.activity-copy strong, .activity-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-copy strong { color: var(--text-soft); font-size: 10px; }
.activity-copy small { color: var(--muted-2); font-size: 8px; }
.dashboard-activity time { color: var(--muted-2); font: 8px/1.2 "SFMono-Regular", Consolas, monospace; text-align: right; }
.dashboard-empty { display: grid; min-height: 220px; place-content: center; text-align: center; }
.dashboard-empty strong { font-size: 12px; }
.dashboard-empty span { color: var(--muted-2); font-size: 9px; }

.dashboard-action-list { display: grid; }
.dashboard-action-list a { display: grid; min-width: 0; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; border-bottom: 1px solid var(--border-soft); padding: 11px 0; color: var(--text); }
.dashboard-action-list a:first-child { padding-top: 0; }
.dashboard-action-list a:last-child { border-bottom: 0; padding-bottom: 0; }
.dashboard-action-list a > span { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 8px; background: var(--panel-3); color: var(--accent-2); font-size: 8px; font-weight: 850; }
.dashboard-action-list strong, .dashboard-action-list small { display: block; }
.dashboard-action-list strong { color: var(--text-soft); font-size: 10px; }
.dashboard-action-list small { color: var(--muted-2); font-size: 8px; }
.dashboard-action-list i { color: var(--muted-2); font-style: normal; }
.dashboard-import-card { margin-top: 18px; scroll-margin-top: 20px; }
.dashboard-import-modal { width: min(920px, 100%); max-height: min(760px, calc(100vh - 40px)); overflow-y: auto; }
.dashboard-import-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.dashboard-import-modal-head h2 { margin: 3px 0 4px; font-size: 21px; }
.dashboard-import-modal-head p { margin: 0; color: var(--muted); font-size: 11px; }
.dashboard-import-modal .privacy-chip { margin-bottom: 14px; }
.privacy-chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 999px; background: var(--subtle-bg); padding: 5px 9px; color: var(--muted); font-size: 9px; font-weight: 700; }
.privacy-chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.dashboard-import-options .import-option { position: relative; padding-top: 16px; }
.import-option-number { align-self: flex-start; margin-bottom: 10px; border-radius: 7px; background: var(--panel-3); color: var(--accent-2); padding: 4px 7px; font-size: 8px; font-weight: 850; }

/* SweetAlert2 integrado ao tema */
.swal2-container { z-index: 100 !important; }
.swal2-popup.naxx-swal { border: 1px solid var(--border); border-radius: 18px; background: var(--modal-bg); box-shadow: 0 28px 90px rgba(0, 0, 0, .38); color: var(--text); font-family: inherit; }
.naxx-swal .swal2-title { color: var(--text); font-size: 20px; letter-spacing: -.025em; }
.naxx-swal .swal2-html-container { color: var(--muted); font-size: 12px; line-height: 1.55; }
.naxx-swal .swal2-timer-progress-bar { background: var(--accent); }
.naxx-swal-actions { gap: 8px; }
.swal-confirm, .swal-cancel { min-height: 40px; border-radius: 9px; padding: 8px 14px; font-family: inherit; font-weight: 700; cursor: pointer; }
.swal-confirm { border: 1px solid transparent; background: linear-gradient(145deg, #896cff, #6747e8); color: #fff; }
.swal-confirm-danger { background: var(--err); }
.swal-cancel { border: 1px solid var(--border); background: var(--panel-2); color: var(--text-soft); }
.swal2-popup.naxx-toast { width: min(390px, calc(100vw - 24px)); border-radius: 12px; padding: 12px 14px; }
.naxx-toast .swal2-title { font-size: 12px; line-height: 1.45; text-align: left; }
.naxx-toast .swal2-icon { margin: 0 9px 0 0; }

/* Logs */
.logs-heading { align-items: center; }
.logs-live-status { display: inline-flex; align-items: center; gap: 8px; border: 1px solid color-mix(in srgb, var(--ok) 24%, var(--border)); border-radius: 999px; background: color-mix(in srgb, var(--ok) 7%, transparent); padding: 7px 11px; color: var(--ok); font-size: 10px; font-weight: 750; }
.logs-live-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px color-mix(in srgb, var(--ok) 70%, transparent); }
.logs-live-status.paused { border-color: color-mix(in srgb, var(--warn) 24%, var(--border)); background: color-mix(in srgb, var(--warn) 7%, transparent); color: var(--warn); }
.logs-live-status.paused i { background: var(--warn); box-shadow: none; }
.logs-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.logs-summary article { position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--stat-bg); padding: 16px; }
.logs-summary article::after { position: absolute; right: -20px; bottom: -25px; width: 70px; height: 70px; border-radius: 50%; background: var(--log-tone, var(--accent)); content: ""; filter: blur(28px); opacity: .15; }
.logs-summary article[data-log-tone="info"] { --log-tone: var(--cyan); }
.logs-summary article[data-log-tone="warning"] { --log-tone: var(--warn); }
.logs-summary article[data-log-tone="error"] { --log-tone: var(--err); }
.logs-summary span, .logs-summary small { display: block; color: var(--muted); font-size: 9px; }
.logs-summary strong { display: block; margin: 7px 0 4px; font-size: 23px; line-height: 1; }
.logs-panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.logs-toolbar { display: grid; grid-template-columns: 170px minmax(220px, 1fr) 110px auto; align-items: end; gap: 10px; border-bottom: 1px solid var(--border-soft); padding: 14px; }
.logs-toolbar label { margin: 0; }
.logs-actions { display: flex; justify-content: flex-end; gap: 7px; }
.logs-actions button { min-height: 40px; font-size: 10px; }
.logs-result-meta { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; color: var(--muted-2); font-size: 9px; }
.logs-list { display: grid; max-height: calc(100vh - 350px); min-height: 260px; overflow: auto; border-top: 1px solid var(--border-soft); background: var(--subtle-bg); }
.log-entry { display: grid; gap: 7px; border-bottom: 1px solid var(--border-soft); padding: 11px 14px; }
.log-entry:last-child { border-bottom: 0; }
.log-entry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 12px; color: var(--muted-2); font: 9px/1.3 "SFMono-Regular", Consolas, monospace; }
.log-level { min-width: 50px; border: 1px solid var(--border); border-radius: 999px; padding: 2px 6px; color: var(--muted); font: 800 8px/1.4 Inter, system-ui, sans-serif; text-align: center; text-transform: uppercase; }
.log-entry[data-level="info"] .log-level { border-color: color-mix(in srgb, var(--cyan) 28%, transparent); background: color-mix(in srgb, var(--cyan) 8%, transparent); color: var(--cyan); }
.log-entry[data-level="warning"] .log-level { border-color: color-mix(in srgb, var(--warn) 28%, transparent); background: color-mix(in srgb, var(--warn) 8%, transparent); color: var(--warn); }
.log-entry[data-level="error"] .log-level, .log-entry[data-level="critical"] .log-level { border-color: color-mix(in srgb, var(--err) 28%, transparent); background: color-mix(in srgb, var(--err) 8%, transparent); color: var(--err); }
.log-origin { color: var(--accent-2); }
.log-thread { margin-left: auto; }
.log-entry pre { margin: 0; overflow: visible; color: var(--text-soft); font: 10px/1.55 "SFMono-Regular", Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.logs-empty { display: grid; min-height: 260px; place-content: center; text-align: center; }
.logs-empty strong, .logs-empty span { display: block; }
.logs-empty strong { font-size: 12px; }
.logs-empty span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.maintenance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.maintenance-grid > div { border: 1px solid var(--border-soft); border-radius: 11px; background: var(--inset-bg); padding: 15px; }
.maintenance-grid p { margin: 5px 0 12px; font-size: 12px; }
.password-grid { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)) auto; align-items: end; gap: 10px; }
.password-action { padding-bottom: 1px; }
.production-check { border-color: rgba(245, 184, 75, .24); }
.production-check ul { display: grid; gap: 7px; margin: 0; padding-left: 20px; color: #e9c982; font-size: 12px; }
.token-note { margin: 12px 0 0; font-size: 12px; }

/* Disk selector */
.disk-selector { display: grid; gap: 8px; }
.disk-item { border: 1px solid var(--border); border-radius: 11px; background: var(--panel-2); transition: .18s; }
.disk-item:hover { border-color: var(--accent); }
.disk-item.selected { border-color: rgba(79, 209, 139, .3); background: rgba(79, 209, 139, .05); }
.disk-label { display: flex; align-items: center; gap: 12px; padding: 12px; cursor: pointer; }
.disk-checkbox { width: 18px; height: 18px; accent-color: var(--ok); cursor: pointer; }
.disk-info { flex: 1; min-width: 0; }
.disk-mount { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.disk-mount strong { font-size: 13px; color: var(--text-strong); }
.disk-stats { display: flex; align-items: center; gap: 10px; font-size: 11px; }
.disk-free { color: var(--ok); font-weight: 650; }
.disk-total { color: var(--muted); }
.disk-bar { flex: 1; height: 6px; overflow: hidden; border-radius: 999px; background: var(--panel-3); min-width: 80px; }
.disk-bar-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--cyan)); transition: width .3s; }

/* Forms and actions */
label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 650; }
input[type=text], input[type=password], input[type=url], input[type=number], input[type=file], input[type=search], select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--input-bg);
  color: var(--text);
  padding: 9px 11px;
  transition: border-color .18s, box-shadow .18s;
}
input::placeholder { color: var(--placeholder); }
input[readonly] { color: var(--readonly); cursor: text; }
input[type=file] { padding: 7px 9px; color: var(--muted); }
input[type=file]::file-selector-button { margin-right: 9px; border: 0; border-radius: 6px; background: var(--panel-3); color: var(--ghost-text); padding: 5px 9px; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 92, 255, .12); }
.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.row > * { flex: 1 1 180px; }
.row > .shrink { flex: 0 0 auto; }

button, .btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 9px;
  background: linear-gradient(145deg, #896cff, #6747e8);
  box-shadow: 0 7px 20px rgba(86, 57, 205, .17);
  color: var(--on-accent);
  padding: 8px 14px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .15s, border-color .15s, background .15s;
}
button:hover, .btn:hover { color: var(--on-accent); transform: translateY(-1px); }
button:active, .btn:active { transform: translateY(0); }
button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.btn-ghost { border-color: var(--border); background: var(--panel-2); box-shadow: none; color: var(--ghost-text); }
.btn-ghost:hover { border-color: var(--ghost-hover-border); background: var(--panel-3); color: var(--text); }
.btn-danger { border-color: rgba(255, 104, 116, .2); background: rgba(255, 104, 116, .11); box-shadow: none; color: #ff8e97; }
.btn-danger:hover { background: rgba(255, 104, 116, .18); color: #ffadb4; }
.btn-sm { min-height: 34px; border-radius: 7px; padding: 5px 9px; font-size: 11px; }

/* Tables */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; background: transparent; font-size: 12px; }
th, td { border-bottom: 1px solid var(--border-soft); padding: 11px 12px; text-align: left; vertical-align: middle; }
th { position: sticky; top: 0; z-index: 2; background: var(--table-head); color: var(--table-head-text); font-size: 9px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
th[scope="row"] { position: static; background: transparent; font-size: 12px; font-weight: 400; letter-spacing: 0; text-transform: none; }
tbody tr { transition: background .14s; }
tbody tr:hover { background: var(--row-hover); }
tbody tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; }
td img { display: block; box-shadow: var(--image-shadow); }
table input[type=text], table select { min-height: 34px; padding: 6px 8px; font-size: 12px; }

.tag { display: inline-flex; min-height: 23px; align-items: center; border: 1px solid var(--border); border-radius: 999px; background: var(--tag-bg); color: var(--muted); padding: 2px 8px; font-size: 10px; font-weight: 700; }
.tag.movie { border-color: rgba(64, 201, 255, .2); background: rgba(64, 201, 255, .08); color: #73d8ff; }
.tag.series { border-color: rgba(157, 135, 255, .24); background: rgba(157, 135, 255, .09); color: #b8a6ff; }
.tag.done { border-color: rgba(79, 209, 139, .22); background: rgba(79, 209, 139, .08); color: var(--ok); }
.tag.downloading { border-color: rgba(124, 92, 255, .25); background: var(--accent-soft); color: #b2a0ff; }
.tag.queued { border-color: rgba(245, 184, 75, .22); background: rgba(245, 184, 75, .08); color: var(--warn); }
.tag.error, .tag.canceled { border-color: rgba(255, 104, 116, .22); background: rgba(255, 104, 116, .08); color: var(--err); }

:root[data-theme="light"] .nav a.active {
  border-color: rgba(103, 72, 223, .22);
  background: linear-gradient(90deg, rgba(103, 72, 223, .15), rgba(103, 72, 223, .06));
  color: #3f249b;
}
:root[data-theme="light"] .nav a.active .nav-icon { color: #fff; }
:root[data-theme="light"] .btn-danger { color: #a92534; }
:root[data-theme="light"] .btn-danger:hover { color: #851e2a; }
:root[data-theme="light"] .tag.movie { color: #087292; }
:root[data-theme="light"] .tag.series,
:root[data-theme="light"] .tag.downloading { color: #5433b8; }
:root[data-theme="light"] .msg.ok { color: #116c3e; }
:root[data-theme="light"] .msg.bad { color: #a92534; }
:root[data-theme="light"] .btn-episodes,
:root[data-theme="light"] .media-actions .watch { color: #4c2cad; }
:root[data-theme="light"] .production-check ul { color: #704900; }

/* Feedback and helpers */
.msg { display: none; margin-bottom: 18px; border: 1px solid; border-radius: 11px; padding: 11px 13px; font-size: 12px; }
.msg.show { display: block; }
.msg.ok { border-color: rgba(79, 209, 139, .22); background: rgba(79, 209, 139, .07); color: #83e5af; }
.msg.bad { border-color: rgba(255, 104, 116, .23); background: rgba(255, 104, 116, .08); color: #ff9da5; }
.msg a { text-decoration: underline; }
.bar { min-width: 90px; height: 5px; overflow: hidden; border-radius: 999px; background: var(--panel-3); }
.bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--cyan)); transition: width .4s; }
.muted { color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0; }
.toolbar .muted { margin-left: auto; font-size: 11px; }
.downloads-commandbar { display: grid; grid-template-columns: minmax(390px, auto) auto minmax(300px, 1fr); align-items: end; gap: 14px; margin: 14px 0 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); padding: 13px 14px; box-shadow: 0 1px 0 var(--card-edge); }
.downloads-command-group { min-width: 0; }
.downloads-command-label { display: block; margin: 0 0 6px 2px; color: var(--muted-2); font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.downloads-queue-actions, .downloads-menu-actions, .downloads-view-actions { display: flex; align-items: center; gap: 7px; }
.downloads-queue-actions button { min-height: 38px; padding: 7px 11px; font-size: 11px; }
.downloads-menu-group { padding-left: 14px; border-left: 1px solid var(--border-soft); }
.downloads-menu-actions { position: relative; }
.downloads-action-menu { position: relative; }
.downloads-action-menu > summary { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; gap: 9px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel-2); color: var(--ghost-text); padding: 7px 11px; font-size: 11px; font-weight: 650; cursor: pointer; list-style: none; white-space: nowrap; transition: border-color .15s, background .15s; }
.downloads-action-menu > summary::-webkit-details-marker { display: none; }
.downloads-action-menu > summary:hover, .downloads-action-menu[open] > summary { border-color: var(--ghost-hover-border); background: var(--panel-3); color: var(--text); }
.downloads-action-menu > summary span { color: var(--accent-2); font-size: 14px; line-height: 1; transition: transform .15s; }
.downloads-action-menu[open] > summary span { transform: rotate(180deg); }
.downloads-action-popover { position: absolute; top: calc(100% + 7px); left: 0; z-index: 25; display: grid; width: 220px; gap: 6px; border: 1px solid var(--border); border-radius: 11px; background: var(--modal-bg); padding: 9px; box-shadow: 0 18px 45px rgba(0,0,0,.28); }
.downloads-action-menu:last-child .downloads-action-popover { right: 0; left: auto; }
.downloads-action-popover strong { padding: 4px 4px 3px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.downloads-action-popover .btn, .downloads-action-popover button { width: 100%; min-height: 36px; justify-content: flex-start; padding: 7px 10px; font-size: 10px; }
.downloads-view-group { justify-self: end; }
.downloads-view-actions { justify-content: flex-end; }
.downloads-view-actions > button { min-height: 38px; padding: 7px 11px; font-size: 11px; }
.downloads-limit-control { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.downloads-limit-control span { color: var(--muted); font-size: 10px; font-weight: 650; }
.downloads-limit-control select { width: auto; min-width: 72px; min-height: 38px; }
.downloads-pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 18px; }
.downloads-pagination .muted { min-width: 170px; text-align: center; }
.download-source-missing { display: inline-flex; min-height: 34px; align-items: center; border: 1px solid rgba(245, 184, 75, .2); border-radius: 7px; background: rgba(245, 184, 75, .07); color: var(--warn); padding: 5px 9px; font-size: 10px; font-weight: 700; }
.catalog-heading { margin-bottom: 17px; }
.catalog-heading .sub { max-width: 660px; }
.catalog-total { display: grid; min-width: 164px; grid-template-columns: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--stat-bg); padding: 13px 16px; text-align: right; box-shadow: 0 1px 0 var(--card-edge); }
.catalog-total strong { color: var(--text-strong); font-size: 25px; line-height: 1; letter-spacing: -.04em; }
.catalog-total span { margin-top: 5px; color: var(--muted); font-size: 10px; }
.catalog-overview { display: grid; grid-template-columns: repeat(7,minmax(105px,1fr)); gap: 8px; margin-bottom: 13px; }
.catalog-metric { display: flex; min-width: 0; min-height: 61px; flex-direction: column; justify-content: center; border: 1px solid var(--border); border-radius: 11px; background: var(--card-bg); padding: 10px 12px; color: var(--muted); box-shadow: 0 1px 0 var(--card-edge); transition: border-color .15s, transform .15s, background .15s; }
.catalog-metric:hover, .catalog-metric.active { border-color: var(--accent); background: var(--accent-soft); color: var(--text); transform: translateY(-1px); }
.catalog-metric span { overflow: hidden; font-size: 9px; font-weight: 750; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.catalog-metric strong { margin-top: 2px; color: var(--text-strong); font-size: 17px; line-height: 1.2; }
.catalog-metric.warning strong { color: var(--warn); }
.catalog-metric.danger strong { color: var(--err); }
.catalog-filter { display: grid; grid-template-columns: minmax(260px,2fr) 110px minmax(210px,1.35fr) 150px 175px 115px auto; align-items: end; gap: 10px; margin-bottom: 12px; padding: 15px; }
.catalog-filter label { margin-bottom: 5px; font-size: 9px; letter-spacing: .04em; text-transform: uppercase; }
.catalog-filter select, .catalog-filter input { min-height: 39px; font-size: 11px; }
.catalog-search-input { position: relative; }
.catalog-search-input > span { position: absolute; top: 50%; left: 11px; z-index: 1; color: var(--accent-2); font-size: 18px; transform: translateY(-53%); pointer-events: none; }
.catalog-search-input input { padding-left: 35px; }
.catalog-filter-actions { display: flex; gap: 7px; }
.catalog-filter-actions button, .catalog-filter-actions .btn { min-height: 39px; padding: 7px 11px; font-size: 11px; }
.catalog-result-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 13px 2px 9px; color: var(--muted); font-size: 10px; }
.catalog-result-line strong { color: var(--text-soft); font-size: 11px; }
.catalog-empty { display: grid; gap: 9px; place-items: center; }
.catalog-empty strong { color: var(--text-strong); font-size: 16px; }
.catalog-empty > span { max-width: 430px; text-align: center; }
.catalog-empty > div { display: flex; gap: 7px; margin-top: 6px; }
.catalog-bulkbar { position: sticky; top: 10px; z-index: 22; display: flex; align-items: center; gap: 12px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--mobile-header); padding: 9px 11px; box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.catalog-select-page { display: flex; min-height: 34px; align-items: center; gap: 8px; margin: 0; color: var(--text-soft); cursor: pointer; }
.catalog-select-page input { width: 18px; min-height: 18px; }
.catalog-bulkbar > strong { color: var(--accent-2); font-size: 10px; white-space: nowrap; }
.catalog-bulk-actions { display: flex; gap: 7px; margin-left: auto; }
.catalog-bulk-actions button { min-height: 35px; padding: 6px 10px; font-size: 10px; }
.catalog-table { min-width: 1140px; }
.catalog-select-heading { width: 42px; }
.catalog-select-heading input, .catalog-select input { width: 17px; min-height: 17px; }
.catalog-art-heading { width: 61px; }
.catalog-kind-heading { width: 76px; }
.catalog-episode-heading { width: 62px; }
.catalog-category-heading { width: 160px; }
.catalog-tmdb-heading { width: 145px; }
.catalog-destination-heading { width: 200px; }
.catalog-status-heading { width: 105px; }
.catalog-actions-heading { width: 290px; }
.catalog-thumb { position: relative; display: grid; width: 46px; height: 64px; overflow: hidden; place-items: center; border: 1px solid var(--border-soft); border-radius: 8px; background: linear-gradient(145deg, var(--panel-3), var(--accent-soft)); }
.catalog-thumb-fallback { color: var(--accent-2); font-size: 10px; font-weight: 850; letter-spacing: .06em; }
.catalog-thumb img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; background: var(--panel-2); object-fit: contain; box-shadow: none; }
.catalog-title-main { color: var(--text-strong); font-weight: 650; }
.catalog-title-raw { margin-top: 2px; font-size: 11px; }
.catalog-category { color: var(--muted); font-size: 12px; }
.catalog-destination { font-size: 11px; }
.catalog-destination code { display: inline-block; max-width: 190px; overflow: hidden; font-size: 9px; text-overflow: ellipsis; vertical-align: middle; white-space: nowrap; }
.catalog-tmdb input { min-width: 105px; }
.catalog-mobile-label { display: none; }
.catalog-pager { flex-wrap: wrap; }
.catalog-pager > span { min-width: 130px; color: var(--muted); font-size: 10px; text-align: center; }
.catalog-pager a[aria-disabled="true"] { opacity: .42; pointer-events: none; }
.modal-search-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: end; gap: 8px; margin: 14px 0 16px; }
.proxy-settings { margin: 14px 0 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); box-shadow: 0 1px 0 var(--card-edge); }
.proxy-settings > summary { display: flex; min-height: 50px; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 15px; color: var(--text-soft); font-size: 12px; font-weight: 750; cursor: pointer; list-style: none; }
.proxy-settings > summary::-webkit-details-marker { display: none; }
.proxy-settings > summary::after { color: var(--accent-2); content: "+"; font-size: 19px; line-height: 1; }
.proxy-settings[open] > summary { border-bottom: 1px solid var(--border-soft); }
.proxy-settings[open] > summary::after { content: "−"; }
.proxy-settings-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, .48fr); gap: 18px; padding: 16px; }
.proxy-toggle-row { display: flex; align-items: flex-start; gap: 10px; color: var(--text-soft); font-weight: 700; }
.proxy-toggle-row input { width: 18px; min-height: 18px; flex: 0 0 18px; margin-top: 2px; }
.proxy-toggle-row small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 500; }
.proxy-source-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.proxy-source { display: flex; min-height: 46px; align-items: center; gap: 8px; border: 1px solid var(--border-soft); border-radius: 9px; background: var(--subtle-bg); padding: 8px 10px; color: var(--text-soft); font-size: 11px; font-weight: 650; }
.proxy-source input { width: 16px; min-height: 16px; flex: 0 0 16px; }
.proxy-source a { margin-left: auto; font-size: 10px; }
.proxy-settings-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.proxy-status { border: 1px solid var(--border-soft); border-radius: 11px; background: var(--inset-bg); padding: 13px; }
.proxy-status-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.proxy-status dl { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; margin: 12px 0 0; font-size: 10px; }
.proxy-status dt { color: var(--muted); }
.proxy-status dd { margin: 0; color: var(--text-soft); font-weight: 700; text-align: right; }
.proxy-warning { margin: 11px 0 0; color: var(--warn); font-size: 10px; line-height: 1.45; }
.category-toolbar { margin-top: 0; }
.category-search { display: grid; gap: 5px; min-width: min(100%, 330px); color: var(--muted); font-size: 11px; font-weight: 650; }
.category-search input { min-height: 38px; }
.category-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.btn-episodes { min-width: 112px; justify-content: space-between; border-color: rgba(124, 92, 255, .28); background: rgba(124, 92, 255, .08); color: #c6bbff; }
.btn-episodes:hover { border-color: rgba(157, 135, 255, .5); background: rgba(124, 92, 255, .14); }
.btn-episodes i { margin-left: 8px; color: var(--accent-2); font-style: normal; font-size: 15px; line-height: 1; transition: transform .18s ease; }
.btn-episodes[aria-expanded="true"] i { transform: rotate(180deg); }
.eps-row td { background: rgba(124, 92, 255, .035); padding: 0; }
.episode-list { display: grid; gap: 1px; padding: 10px 14px 10px 24px; }
.episode-item { display: grid; grid-template-columns: 34px minmax(130px, 1fr) 110px auto; align-items: center; gap: 12px; border-bottom: 1px solid var(--border-soft); padding: 8px 0; }
.episode-item:last-child { border-bottom: 0; }
.episode-name { display: flex; min-width: 0; align-items: center; gap: 10px; }
.episode-name > .episode-title { overflow: hidden; color: var(--text-soft); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.media-compression-seal { display: inline-flex; max-width: 100%; align-items: center; gap: 5px; margin: 5px 0 0 7px; border: 1px solid rgba(47, 208, 127, .32); border-radius: 999px; background: rgba(47, 208, 127, .1); color: var(--ok); padding: 3px 7px 3px 4px; font-size: 9px; font-weight: 800; line-height: 1; vertical-align: middle; white-space: nowrap; }
.media-compression-seal.is-partial { border-color: rgba(64, 201, 255, .3); background: rgba(64, 201, 255, .08); color: var(--cyan); }
.media-compression-check { display: inline-grid; flex: 0 0 auto; width: 15px; height: 15px; overflow: visible !important; place-items: center; border-radius: 50%; background: currentColor; color: var(--panel); font-size: 9px !important; line-height: 1; }
.media-compression-seal > span:not(.media-compression-check) { overflow: hidden; color: inherit; font-size: inherit; text-overflow: ellipsis; }
.media-compression-seal .media-compression-saving { display: inline; margin: 0; color: inherit; font-size: 8px; font-weight: 700; opacity: .78; }
.episode-name .media-compression-seal { flex: 0 0 auto; margin: 0; }
.media-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.media-actions .watch { background: rgba(124, 92, 255, .16); border-color: rgba(157, 135, 255, .3); color: #d2c9ff; box-shadow: none; }
.player-modal { width: min(920px, 100%); }
.player-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.player-head h3 { margin: 0; font-size: 18px; }
.player-modal video { display: block; width: 100%; max-height: 70vh; border-radius: 12px; background: #000; aspect-ratio: 16 / 9; }
.player-status { min-height: 18px; margin: 7px 0 0; color: var(--muted); font-size: 10px; text-align: center; }
.player-status:empty { display: none; }
.player-status.error { color: var(--err); }
.player-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 13px; }
.category-create { max-width: 760px; }
.library-layout { display: flex; flex-direction: column; }
.library-layout > .compression-panel { order: 1; }
.library-layout > .library-command-center { order: 2; }
.library-layout > .library-bulkbar { order: 3; }
.library-layout > .library-movies-section { order: 4; }
.library-layout > .library-series-section { order: 5; }
.library-layout > .library-pagination { order: 6; }
.library-type-section { min-width: 0; }
.library-command-center { margin-bottom: 14px; padding: 14px; }
.library-command-main { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(220px, 290px) auto; align-items: end; gap: 10px; }
.library-filter-control { display: grid; gap: 5px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.library-command-actions { display: flex; align-items: center; gap: 10px; margin-top: 11px; border-top: 1px solid var(--border-soft); padding-top: 11px; }
.library-action-buttons { display: flex; flex-wrap: wrap; gap: 7px; }
.library-command-actions button, .library-command-actions .btn { min-height: 36px; padding: 7px 11px; font-size: 10px; }
.library-result-count { margin-left: auto; color: var(--muted-2); font-size: 10px; white-space: nowrap; }
.library-organizer { margin-top: 12px; border-top: 1px solid var(--border-soft); padding-top: 10px; }
.library-organizer > summary { display: flex; min-height: 44px; align-items: center; gap: 12px; border-radius: 10px; color: var(--text-soft); padding: 7px 10px; cursor: pointer; list-style: none; transition: background .15s; }
.library-organizer > summary::-webkit-details-marker { display: none; }
.library-organizer > summary:hover, .library-organizer[open] > summary { background: var(--hover-bg); }
.library-organizer > summary > span { display: grid; flex: 1; gap: 2px; }
.library-organizer > summary strong { font-size: 12px; }
.library-organizer > summary small { color: var(--muted-2); font-size: 9px; }
.library-organizer > summary > b { border-radius: 999px; background: var(--panel-3); color: var(--muted); padding: 4px 8px; font-size: 9px; }
.library-organizer > summary > i { color: var(--muted-2); font-size: 16px; font-style: normal; transition: transform .18s; }
.library-organizer[open] > summary > i { transform: rotate(180deg); }
.library-organizer-body { margin-top: 8px; border: 1px solid var(--border-soft); border-radius: 11px; background: var(--inset-bg); padding: 14px; }
.library-category-create { display: grid; max-width: 760px; grid-template-columns: minmax(240px, 1fr) auto; align-items: end; gap: 9px; }
.library-category-create > div { display: grid; gap: 5px; }
.library-page-size { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.library-page-size select { width: 76px; min-height: 36px; padding: 5px 9px; }
.library-search { display: flex; min-width: 0; align-items: center; gap: 7px; }
.library-search input[type="search"] { min-width: 210px; min-height: 40px; }
.library-search button, .library-search .btn { flex: 0 0 auto; }
.library-bulkbar { position: sticky; top: 10px; z-index: 22; display: grid; grid-template-columns: minmax(150px,1fr) minmax(160px,220px) auto auto auto; align-items: center; gap: 8px; margin: 0 0 15px; border: 1px solid var(--border); border-radius: 12px; background: var(--mobile-header); padding: 10px 12px; box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.library-bulkbar[hidden] { display: none; }
.library-select-page { display: flex; align-items: center; gap: 8px; color: var(--text-soft); font-size: 11px; font-weight: 650; white-space: nowrap; }
.library-select-page input, .library-card-select input { width: 17px; height: 17px; accent-color: var(--accent); }
.library-bulkbar > strong { color: var(--accent-2); font-size: 11px; }
.library-bulkbar select { min-height: 34px; padding: 5px 9px; font-size: 11px; }
.library-card-select { text-align: center; }
.library-pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 22px; border-top: 1px solid var(--border-soft); padding-top: 16px; }
.library-pagination .pager { margin: 0; }
.library-card-thumb { position: relative; display: grid; width: 40px; height: 58px; overflow: hidden; place-items: center; border: 1px solid var(--border-soft); border-radius: 7px; background: linear-gradient(145deg, var(--panel-3), var(--accent-soft)); color: var(--accent-2); font-size: 9px; font-weight: 850; }
.library-card-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; background: var(--panel-2); object-fit: cover; box-shadow: none; }
.library-mobile-label { display: none; }
.library-card-file { font-size: 11px; }
.compression-panel { padding: 0; }
.compression-panel > summary { display: flex; min-height: 62px; align-items: center; gap: 14px; padding: 13px 16px; cursor: pointer; list-style: none; }
.compression-panel > summary::-webkit-details-marker { display: none; }
.compression-panel-title { display: grid; min-width: 190px; flex: 1; gap: 3px; }
.compression-panel-title strong { color: var(--text-soft); font-size: 12px; }
.compression-panel-title small { color: var(--muted-2); font-size: 9px; }
.compression-panel-summary > i { color: var(--muted-2); font-size: 17px; font-style: normal; transition: transform .18s; }
.compression-panel[open] .compression-panel-summary > i { transform: rotate(180deg); }
.compression-panel-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(235px, auto); align-items: start; gap: 24px; border-top: 1px solid var(--border-soft); padding: 16px; }
.compression-main { min-width: 0; }
.compression-panel p { margin: 4px 0 0; font-size: 12px; }
.compression-side { display: grid; min-width: 235px; gap: 7px; }
.compression-side label { margin: 0; }
.compression-side select { min-height: 36px; }
.compression-side small { max-width: 290px; font-size: 10px; line-height: 1.4; }
.compression-estimate { margin-top: 5px; border: 1px solid rgba(64, 201, 255, .18); border-radius: 10px; background: rgba(64, 201, 255, .055); padding: 10px 11px; }
.compression-estimate > span { display: block; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.compression-estimate strong { display: block; margin-top: 3px; color: var(--cyan); font-size: 15px; font-variant-numeric: tabular-nums; }
.compression-estimate small { display: block; margin-top: 3px; }
.compression-summary { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.library-section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin: 24px 0 10px; }
.library-section-heading h2 { margin: 2px 0 0; }
.library-section-heading > span { border-radius: 999px; background: var(--panel-3); color: var(--muted); padding: 5px 9px; font-size: 9px; font-weight: 700; }
.compression-progress { margin-top: 14px; }
.compression-progress-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; color: var(--muted); font-size: 10px; }
.compression-progress-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compression-progress-head strong { flex: 0 0 auto; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.compression-track { position: relative; height: 10px; overflow: hidden; border: 1px solid var(--border-soft); border-radius: 999px; background: var(--panel-3); }
.compression-track i { position: relative; display: block; min-width: 0; height: 100%; overflow: hidden; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--cyan)); box-shadow: 0 0 16px rgba(124, 92, 255, .28); transition: width .45s ease; }
.compression-track i::after { position: absolute; inset: 0; background: linear-gradient(110deg, transparent 20%, rgba(255,255,255,.34) 48%, transparent 76%); content: ""; animation: compression-shine 1.7s linear infinite; transform: translateX(-100%); }
.compression-track.batch { height: 6px; }
.compression-track.batch i { background: linear-gradient(90deg, var(--ok), var(--cyan)); }
.compression-progress-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; margin-top: 6px; color: var(--muted-2); font-size: 10px; }
.compression-batch-head { margin-top: 12px; }
@keyframes compression-shine { to { transform: translateX(100%); } }
.compression-scope-modal { width: min(820px, 100%); }
.compression-scope-modal .sub { margin-bottom: 18px; }
.compression-scope-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.compression-scope-option { display: grid; min-height: 150px; align-content: start; justify-items: start; gap: 7px; border-color: var(--border); background: var(--panel-2); box-shadow: none; color: var(--text); padding: 15px; text-align: left; white-space: normal; }
.compression-scope-option:hover { border-color: var(--accent); background: var(--panel-3); color: var(--text); }
.compression-scope-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent-2); font-size: 11px; font-weight: 850; }
.compression-scope-option strong { font-size: 13px; }
.compression-scope-option small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.compression-scope-option[data-compression-scope="all"] { border-color: rgba(124, 92, 255, .3); background: var(--accent-soft); }
.compression-scope-option[data-compression-scope="category"] .compression-scope-icon { background: rgba(245,184,75,.1); color: var(--warn); }
.compression-category-picker { display: grid; grid-template-columns: minmax(220px,1fr) minmax(130px,.55fr) auto; align-items: end; gap: 10px; margin-top: 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--inset-bg); padding: 12px; }
.compression-category-picker[hidden] { display: none; }
.compression-category-summary { color: var(--muted); font-size: 10px; }
.compression-category-picker button { min-height: 40px; }
.compression-scope-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; border-top: 1px solid var(--border-soft); padding-top: 13px; }
.compression-scope-footer small { color: var(--muted); font-size: 10px; }
.saved { display: block; margin-top: 3px; color: var(--ok); font-size: 10px; font-weight: 700; }
.category-manager { margin-top: 16px; border-top: 1px solid var(--border-soft); padding-top: 13px; }
.category-manager summary { color: var(--muted); font-size: 11px; font-weight: 650; cursor: pointer; }
.category-manager-list { display: grid; gap: 8px; margin-top: 12px; }
.category-manager-row { display: grid; grid-template-columns: minmax(180px, 1fr) auto auto auto; align-items: center; gap: 8px; }
.category-manager-row input { min-height: 34px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: 20px; }
.empty { padding: 44px 18px !important; color: var(--muted); text-align: center; }

/* Viewers */
.viewer-total { display: grid; grid-template-columns: auto auto; align-items: center; gap: 1px 8px; min-width: 170px; border: 1px solid rgba(79,209,139,.22); border-radius: var(--radius); background: rgba(79,209,139,.06); padding: 12px 16px; }
.viewer-total .viewer-live-dot { grid-row: 1 / 3; }
.viewer-total strong { color: var(--ok); font-size: 24px; line-height: 1; }
.viewer-total > span:last-child { color: var(--muted); font-size: 10px; }
.viewer-heading-actions { display: flex; align-items: center; gap: 10px; }
.viewer-live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 5px rgba(79,209,139,.1); animation: viewer-pulse 1.8s ease-in-out infinite; }
@keyframes viewer-pulse { 50% { box-shadow: 0 0 0 8px rgba(79,209,139,0); } }
.viewers-summary { display: grid; grid-template-columns: auto 1fr auto 1fr; align-items: center; gap: 8px 14px; color: var(--muted); font-size: 11px; }
.viewers-summary strong { color: var(--text-soft); }
.viewers-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.viewer-card { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-bg); padding: 17px; box-shadow: 0 1px 0 var(--card-edge); }
.viewer-card-head { display: flex; align-items: center; gap: 10px; }
.viewer-device { margin-left: auto; color: var(--muted); font-size: 10px; }
.viewer-card h2 { margin: 17px 0 7px; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.viewer-meta { display: flex; flex-wrap: wrap; gap: 5px 12px; color: var(--muted-2); font-size: 10px; }
.viewer-progress { height: 6px; margin-top: 17px; overflow: hidden; border-radius: 999px; background: var(--panel-3); }
.viewer-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--accent),var(--cyan)); }
.viewer-progress-label { display: flex; justify-content: space-between; margin-top: 6px; color: var(--muted); font-size: 9px; }

/* Legibilidade no desktop */
@media (min-width: 781px) {
  body { font-size: 16px; }
  .nav a, .nav-action, .sidebar-system > summary { font-size: 15px; }
  .nav-label, .eyebrow, .section-kicker, .downloads-command-label { font-size: 12px; }
  .who, .logout { font-size: 13px; }
  .user-role { font-size: 12px; }
  .sub { font-size: 15px; line-height: 1.65; }
  label { font-size: 13px; }
  .section-head p, .import-option .hint, .hint, .muted, .privacy-note { font-size: 14px; }
  button, .btn, input, select, textarea { font-size: 14px; }
  .btn-sm { font-size: 13px; }
  table { font-size: 14px; }
  th { font-size: 12px; }
  td, th[scope="row"], table input[type=text], table select { font-size: 14px; }
  .tag, .library-result-count, .library-filter-control, .library-page-size { font-size: 12px; }
  .dashboard-kpi-copy small, .dashboard-kpi-copy span { font-size: 13px; }
  .active-download-head strong, .dashboard-idle-state strong { font-size: 14px; }
  .active-download-head small, .active-download-foot, .dashboard-idle-state small, .queue-distribution-head, .queue-legend span { font-size: 12px; }
  .dashboard-alert strong, .activity-copy strong { font-size: 13px; }
  .dashboard-alert small, .dashboard-alert b, .activity-copy small, .dashboard-activity time,
  .dashboard-all-good small, .dashboard-empty span { font-size: 12px; }
  .dashboard-all-good strong, .dashboard-empty strong { font-size: 14px; }
  .dashboard-import-modal-head p, .privacy-chip { font-size: 13px; }
  .logs-live-status, .logs-summary span, .logs-summary small, .logs-actions button,
  .logs-result-meta, .logs-empty span { font-size: 12px; }
  .logs-empty strong { font-size: 14px; }
  .downloads-queue-actions button, .downloads-action-menu > summary, .downloads-view-actions > button,
  .downloads-limit-control span, .download-source-missing { font-size: 13px; }
  .downloads-action-popover strong, .downloads-action-popover .btn,
  .downloads-action-popover button { font-size: 12px; }
  .catalog-total span, .catalog-metric span, .catalog-filter label, .catalog-result-line,
  .catalog-pager > span { font-size: 12px; }
  .catalog-filter select, .catalog-filter input, .catalog-filter-actions button,
  .catalog-filter-actions .btn, .catalog-result-line strong, .catalog-bulkbar > strong,
  .catalog-bulk-actions button, .catalog-title-raw, .catalog-category { font-size: 13px; }
  .catalog-destination, .catalog-destination code { font-size: 12px; }
  .proxy-settings > summary, .proxy-source { font-size: 13px; }
  .proxy-toggle-row small, .proxy-source a, .proxy-status dl, .proxy-warning { font-size: 12px; }
  .category-search, .episode-name > .episode-title, .library-card-file,
  .library-select-page, .library-bulkbar > strong, .library-bulkbar select { font-size: 13px; }
  .library-command-actions button, .library-command-actions .btn { font-size: 13px; }
  .compression-panel-title strong, .library-organizer > summary strong { font-size: 14px; }
  .compression-panel-title small, .library-organizer > summary small,
  .library-organizer > summary > b, .library-section-heading > span { font-size: 12px; }
  .compression-panel p, .compression-progress-head, .compression-progress-meta,
  .compression-side small, .compression-estimate > span, .compression-category-summary,
  .compression-scope-option small, .compression-scope-footer small, .saved { font-size: 12px; }
  .compression-scope-option strong, .category-manager summary { font-size: 14px; }
  .viewer-total > span:last-child, .viewers-summary, .viewer-device,
  .viewer-meta, .viewer-progress-label { font-size: 12px; }
}

/* Modal */
.modal-bg { position: fixed; inset: 0; z-index: 60; display: none; align-items: center; justify-content: center; background: var(--overlay); padding: 20px; backdrop-filter: blur(6px); }
.modal-bg.show { display: flex; }
.modal { width: 680px; max-width: 100%; max-height: 86vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--modal-bg); box-shadow: 0 30px 90px rgba(0,0,0,.28); padding: 23px; }
.modal h3 { margin: 0 0 4px; font-size: 18px; }
.choice { display: flex; width: 100%; min-height: 0; justify-content: flex-start; gap: 14px; margin-bottom: 9px; border: 1px solid var(--border); border-radius: 11px; background: var(--panel-2); box-shadow: none; color: var(--text); padding: 11px; text-align: left; white-space: normal; cursor: pointer; transition: .16s; }
.choice:hover { border-color: var(--accent); background: var(--panel-3); }
.choice:focus-visible { border-color: var(--cyan); outline: 2px solid var(--cyan); outline-offset: 2px; }
.choice img { width: 58px; height: 86px; flex: 0 0 auto; border-radius: 7px; object-fit: cover; }
.choice-poster-empty { width: 58px; height: 86px; flex: 0 0 auto; border: 1px solid var(--border-soft); border-radius: 7px; background: var(--panel-3); }
.choice-copy, .choice .t, .choice .o { display: block; }
.choice-copy { min-width: 0; }
.choice .t { font-weight: 700; }
.choice .o { margin-top: 4px; color: var(--muted); font-size: 11px; }

/* Login */
.login-page { display: grid; min-height: 100vh; place-items: center; overflow-x: hidden; padding: 24px; background: radial-gradient(circle at 16% 12%, rgba(124,92,255,.17), transparent 30rem), radial-gradient(circle at 90% 90%, rgba(64,201,255,.07), transparent 25rem), var(--login-base); }
.login-theme-toggle { position: fixed; top: 18px; right: 18px; z-index: 3; gap: 8px; border-color: var(--border); background: var(--mobile-header); backdrop-filter: blur(16px); }
.login-shell { display: grid; width: min(1040px,100%); min-height: min(690px,calc(100vh - 48px)); grid-template-columns: minmax(0,1.08fr) minmax(380px,.92fr); overflow: hidden; border: 1px solid var(--border); border-radius: 28px; background: var(--panel); box-shadow: 0 35px 110px rgba(0,0,0,.34); }
.login-showcase { position: relative; display: flex; overflow: hidden; flex-direction: column; background: radial-gradient(circle at 28% 24%, rgba(124,92,255,.24), transparent 20rem), linear-gradient(145deg,#10131d,#0b0d13 70%); padding: 42px; }
:root[data-theme="light"] .login-showcase { background: radial-gradient(circle at 28% 24%, rgba(124,92,255,.22), transparent 20rem), linear-gradient(145deg,#271c52,#13172a 75%); }
.login-showcase::after { position: absolute; right: -120px; bottom: -130px; width: 390px; height: 390px; border: 1px solid rgba(157,135,255,.18); border-radius: 50%; box-shadow: 0 0 0 55px rgba(124,92,255,.035),0 0 0 110px rgba(124,92,255,.025); content: ""; }
.login-showcase .brand { position: relative; z-index: 1; align-self: flex-start; padding: 0; color: #fff; }
.login-showcase-copy { position: relative; z-index: 1; margin: auto 0; }
.login-kicker { display: inline-flex; align-items: center; gap: 9px; color: #b9adff; font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.login-kicker i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 5px rgba(79,209,139,.1); }
.login-showcase h1 { margin: 20px 0 18px; color: #fff; font-size: clamp(40px,5vw,64px); line-height: .98; letter-spacing: -.055em; }
.login-showcase h1 span { color: #a995ff; }
.login-showcase-copy p { max-width: 480px; margin: 0; color: #9ba5b8; font-size: 14px; line-height: 1.7; }
.login-features { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; }
.login-features span { display: inline-flex; align-items: center; gap: 7px; border: 1px solid rgba(255,255,255,.08); border-radius: 999px; background: rgba(255,255,255,.035); color: #b9c2d1; padding: 7px 10px; font-size: 9px; }
.login-features b { color: #a995ff; font-size: 11px; }
.login-showcase-foot { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; margin: 20px 0 0; color: #69758b; font-size: 9px; }
.login-showcase-foot span { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.login-panel { display: grid; align-items: center; background: var(--panel); padding: clamp(30px,5vw,64px); }
.login-card { width: 100%; margin: 0; padding: 0; }
.login-card .eyebrow { margin-bottom: 12px; }
.login-card h2 { margin: 0 0 9px; font-size: 30px; line-height: 1.15; letter-spacing: -.035em; }
.login-card .sub { margin: 0 0 30px; }
.login-mobile-brand { display: none; }
.field { margin-bottom: 14px; }
.login-field { margin-bottom: 17px; }
.login-field > label { display: block; margin-bottom: 7px; }
.login-input { display: grid; grid-template-columns: 42px minmax(0,1fr); align-items: center; overflow: hidden; border: 1px solid var(--border); border-radius: 11px; background: var(--input-bg); transition: .16s ease; }
.login-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-input > span { display: grid; height: 24px; place-items: center; border-right: 1px solid var(--border-soft); color: var(--accent-2); font-size: 10px; font-weight: 800; }
.login-input input { min-height: 48px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.login-input input:focus { box-shadow: none; }
.login-submit { display: flex; width: 100%; min-height: 49px; align-items: center; justify-content: space-between; margin-top: 8px; padding: 0 18px; }
.login-foot { margin: 20px 0 0; color: var(--muted-2); font-size: 9px; text-align: center; }
.login-foot span { color: var(--ok); }

@media (max-width: 1500px) {
  .catalog-filter { grid-template-columns: 2fr 1fr 1.45fr 1.15fr; }
  .catalog-filter-actions { grid-column: 3 / 5; justify-content: flex-end; }
}

@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-layout { grid-template-columns: 1fr; }
  .dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-service-strip { grid-template-columns: repeat(4, minmax(100px, 1fr)); }
  .dashboard-service-strip .dashboard-service-path { grid-column: 1 / -1; justify-content: flex-start; margin-top: 10px; border-top: 1px solid var(--border-soft); border-left: 0; padding-top: 10px; }
  .logs-toolbar { grid-template-columns: 160px minmax(220px, 1fr) 100px; }
  .logs-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .storage-card { grid-template-columns: 1fr; gap: 10px; }
  .maintenance-grid { grid-template-columns: 1fr; }
  .password-grid { grid-template-columns: 1fr 1fr; }
  .downloads-commandbar { grid-template-columns: minmax(390px, 1fr) auto; }
  .downloads-view-group { grid-column: 1 / -1; width: 100%; justify-self: stretch; border-top: 1px solid var(--border-soft); padding-top: 11px; }
  .downloads-view-actions { justify-content: space-between; }
  .viewers-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .library-bulkbar { grid-template-columns: auto 1fr minmax(160px,1fr) auto; }
  .library-bulkbar #library-batch-compress, .library-bulkbar #library-batch-delete { grid-row: 2; }
  .library-bulkbar #library-batch-compress { grid-column: 3; }
  .library-bulkbar #library-batch-delete { grid-column: 4; }
  .library-command-main { grid-template-columns: minmax(0, 1fr) minmax(220px, .7fr); }
  .library-command-main .library-page-size { grid-column: 2; }
  .catalog-overview { grid-template-columns: repeat(4,minmax(105px,1fr)); }
  .catalog-filter { grid-template-columns: 2fr 1fr 1.5fr; }
  .catalog-filter-actions { grid-column: 2 / 4; justify-content: flex-end; }
  .compression-scope-options { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 780px) {
  :root { --sidebar-w: 0px; }
  .login-page { display: block; padding: 0; }
  .login-shell { width: 100%; min-height: 100vh; grid-template-columns: 1fr; border: 0; border-radius: 0; box-shadow: none; }
  .login-showcase { display: none; }
  .login-panel { min-height: 100vh; padding: 72px 24px 36px; }
  .login-mobile-brand { display: flex; justify-content: flex-start; margin-bottom: 46px; padding: 0; }
  .login-card h2 { font-size: 28px; }
  .login-theme-toggle { top: 14px; right: 14px; }
  .login-theme-toggle [data-theme-label] { display: none; }
  .sidebar { display: none; }
  .mobile-topbar { position: sticky; top: 0; z-index: 30; display: flex; min-height: 64px; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--border-soft); background: var(--mobile-header); padding: 9px 14px; backdrop-filter: blur(16px); }
  .mobile-topbar .brand { min-width: 0; flex: 1 1 auto; padding: 0; }
  .mobile-topbar .brand-name { display: inline; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-topbar-actions { display: flex; flex: 0 0 auto; gap: 7px; }
  .mobile-menu-toggle {
    display: grid;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    flex: 0 0 44px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--panel-2);
    box-shadow: none;
    color: var(--accent-2);
    padding: 0;
  }
  .mobile-menu-toggle:hover { background: var(--panel-3); color: var(--accent-2); transform: none; }
  .mobile-menu-toggle { color: var(--text); font-size: 20px; }
  .mobile-nav { position: absolute; inset: calc(100% + 1px) 10px auto; z-index: 40; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; max-height: calc(100vh - 82px); overflow-y: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--mobile-header); padding: 10px; box-shadow: 0 22px 60px rgba(0,0,0,.36); backdrop-filter: blur(20px); }
  .mobile-nav[hidden] { display: none; }
  .mobile-nav a, .mobile-nav button { display: flex; min-width: 0; min-height: 48px; align-items: center; justify-content: flex-start; gap: 9px; border: 1px solid transparent; border-radius: 9px; background: transparent; box-shadow: none; color: var(--muted); padding: 8px 10px; font-size: 12px; font-weight: 650; white-space: nowrap; }
  .mobile-nav a span, .mobile-nav button span { display: grid; width: 24px; height: 24px; flex: 0 0 24px; place-items: center; border-radius: 7px; background: var(--icon-bg); color: var(--icon-text); font-size: 10px; font-weight: 800; }
  .mobile-nav a.active { border-color: rgba(124, 92, 255, .24); background: var(--accent-soft); color: #c4b8ff; }
  .mobile-nav a.active span { background: var(--accent); color: #fff; }
  .mobile-system-menu { grid-column: 1 / -1; border: 1px solid var(--border-soft); border-radius: 10px; background: var(--inset-bg); overflow: hidden; }
  .mobile-system-menu > summary { display: flex; min-height: 48px; align-items: center; gap: 9px; color: var(--muted); padding: 8px 10px; font-size: 12px; font-weight: 650; cursor: pointer; list-style: none; }
  .mobile-system-menu > summary::-webkit-details-marker { display: none; }
  .mobile-system-menu > summary > span { display: grid; width: 24px; height: 24px; flex: 0 0 24px; place-items: center; border-radius: 7px; background: var(--icon-bg); color: var(--icon-text); font-size: 10px; }
  .mobile-system-menu > summary > b { flex: 1; font-weight: 650; }
  .mobile-system-menu > summary > i { color: var(--muted-2); font-size: 16px; font-style: normal; transition: transform .18s ease; }
  .mobile-system-menu[open] > summary > i { transform: rotate(180deg); }
  .mobile-system-menu > summary.active { background: var(--accent-soft); color: var(--accent-2); }
  .mobile-system-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; border-top: 1px solid var(--border-soft); padding: 6px; }
  .mobile-nav .mobile-system-panel a, .mobile-nav .mobile-system-panel button { min-height: 44px; }
  .mobile-nav .mobile-system-theme b { overflow: hidden; font-weight: 650; text-overflow: ellipsis; }
  .mobile-nav .mobile-clear-imported { color: var(--err); }
  .mobile-nav .mobile-logout { grid-column: 1 / -1; border-top-color: var(--border-soft); color: var(--text-soft); }
  :root[data-theme="light"] .mobile-nav a.active { color: #4c2cad; }
  .wrap { padding: 25px 16px 48px; }
  .page-heading { flex-direction: column; }
  .viewer-heading-actions { width: 100%; align-items: stretch; flex-direction: column; }
  .viewer-total { width: 100%; }
  .viewers-summary { grid-template-columns: auto 1fr; }
  .viewers-grid { grid-template-columns: 1fr; }
  .dashboard-heading-side { width: 100%; align-items: stretch; }
  .dashboard-heading-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .dashboard-kpi { min-height: 116px; grid-template-columns: 34px minmax(0, 1fr); gap: 9px; padding: 14px; }
  .dashboard-kpi-icon { width: 34px; height: 34px; }
  .dashboard-kpi-arrow { display: none; }
  .dashboard-kpi-copy strong { font-size: 21px; }
  .dashboard-service-strip { grid-template-columns: 1fr 1fr; gap: 0; }
  .dashboard-service-strip > div { min-height: 45px; border-bottom: 1px solid var(--border-soft); border-left: 0 !important; padding: 7px 8px; }
  .dashboard-service-strip > div:nth-child(even) { border-left: 1px solid var(--border-soft) !important; }
  .dashboard-service-strip .dashboard-service-path { grid-column: 1 / -1; min-height: 35px; margin-top: 0; border-bottom: 0; padding-top: 7px; }
  .dashboard-control-grid, .dashboard-content-grid { grid-template-columns: 1fr; }
  .dashboard-section-head { align-items: stretch; }
  .dashboard-section-head > a, .dashboard-section-head > button { width: 100%; }
  .dashboard-activity { grid-template-columns: 34px minmax(0, 1fr) auto; }
  .dashboard-activity time { display: none; }
  .privacy-chip { align-self: flex-start; }
  .logs-heading { align-items: stretch; }
  .logs-live-status { align-self: flex-start; }
  .logs-summary { grid-template-columns: 1fr 1fr; gap: 9px; }
  .logs-toolbar { grid-template-columns: 1fr; }
  .logs-actions { display: grid; grid-column: auto; grid-template-columns: 1fr 1fr; }
  .logs-actions .btn-danger { grid-column: 1 / -1; }
  .logs-result-meta { align-items: flex-start; flex-direction: column; }
  .logs-list { max-height: none; }
  .log-thread { width: 100%; margin-left: 0; }
  .section-head { flex-direction: column; }
  .section-actions { width: 100%; justify-content: flex-start; }
  .grid { gap: 9px; }
  .stat { min-height: 104px; padding: 15px; }
  .import-options { grid-template-columns: 1fr; }
  .toolbar .muted { width: 100%; margin-left: 0; }
  .category-manager-row { grid-template-columns: 1fr auto; }
  .category-manager-row .tag { justify-self: start; }
  .episode-list { padding-left: 14px; }
  .episode-item { grid-template-columns: 34px 1fr; }
  .episode-item > .media-actions, .episode-item > .muted { grid-column: 1 / -1; }
  .library-command-main { grid-template-columns: 1fr; }
  .library-command-main .library-page-size { grid-column: auto; }
  .library-filter-control { width: 100%; }
  .library-command-actions { align-items: stretch; flex-direction: column; }
  .library-action-buttons { display: grid; grid-template-columns: 1fr 1fr; }
  .library-action-buttons > * { width: 100%; text-align: center; }
  .library-result-count { margin-left: 0; }
  .library-category-create { grid-template-columns: 1fr; }
  .library-category-create button { width: 100%; }
  .compression-panel-summary { align-items: flex-start; flex-wrap: wrap; }
  .compression-panel-summary .compression-summary { width: calc(100% - 28px); order: 3; }
  .compression-panel-body { grid-template-columns: 1fr; }
  .compression-side { min-width: 0; }
  .compression-summary { justify-content: flex-start; }
  .compression-scope-options { grid-template-columns: 1fr; }
  .compression-scope-option { min-height: 0; grid-template-columns: 42px 1fr; align-items: center; }
  .compression-scope-option small { grid-column: 2; }
  .compression-scope-footer { align-items: stretch; flex-direction: column; }
  .compression-scope-footer button { width: 100%; }
  .compression-category-picker { grid-template-columns: 1fr; }
  .compression-category-picker button { width: 100%; }
  .proxy-settings-body { grid-template-columns: 1fr; }
  .proxy-source-list { grid-template-columns: 1fr; }
  .downloads-commandbar { grid-template-columns: 1fr; align-items: stretch; gap: 12px; padding: 12px; }
  .downloads-menu-group { border-top: 1px solid var(--border-soft); border-left: 0; padding-top: 11px; padding-left: 0; }
  .downloads-queue-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .downloads-queue-actions button { width: 100%; min-height: 44px; }
  .downloads-queue-actions [data-cancel-all] { grid-column: 1 / -1; }
  .downloads-menu-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .downloads-action-menu > summary { width: 100%; min-height: 44px; }
  .downloads-action-popover, .downloads-action-menu:last-child .downloads-action-popover { position: static; width: 100%; margin-top: 6px; box-shadow: none; }
  .downloads-menu-actions:has(.downloads-action-menu[open]) { grid-template-columns: 1fr; }
  .downloads-action-menu[open] { grid-column: 1 / -1; }
  .downloads-view-group { grid-column: auto; border-top: 1px solid var(--border-soft); padding-top: 11px; }
  .downloads-view-actions { display: grid; grid-template-columns: 1fr; }
  .downloads-view-actions > button { width: 100%; min-height: 44px; }
  .downloads-limit-control { width: 100%; justify-content: space-between; }
  .downloads-limit-control select { width: 100px; }
  .toolbar > button, .toolbar > .btn { min-height: 44px; }
  .catalog-heading { align-items: stretch; }
  .catalog-total { min-width: 135px; align-content: center; }
  .catalog-overview { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .catalog-filter { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 12px; }
  .catalog-search-field, .catalog-group-filter { grid-column: 1 / -1; }
  .catalog-filter-actions { grid-column: 1 / -1; }
  .catalog-filter-actions > * { flex: 1; }
  .catalog-bulkbar { top: 72px; display: grid; grid-template-columns: 1fr auto; gap: 7px; }
  .catalog-bulk-actions { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(2,minmax(0,1fr)); margin: 0; }
  .catalog-bulk-actions button { width: 100%; min-height: 41px; }
  .catalog-result-line { align-items: flex-start; }
  .btn-sm { min-height: 44px; }

  .catalog-table-wrap { overflow: visible; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .catalog-table, .catalog-table tbody { display: block; width: 100%; }
  .catalog-table { min-width: 0; }
  .catalog-table thead { display: none; }
  .catalog-table tbody { display: grid; gap: 11px; }
  .catalog-table tbody tr.catalog-item-row { display: grid; min-width: 0; grid-template-columns: 68px minmax(0, 1fr) auto; grid-template-areas: "art title select" "art category category" "kind episode status" "tmdb tmdb tmdb" "actions actions actions"; gap: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-bg); padding: 12px; box-shadow: 0 1px 0 var(--card-edge); }
  .catalog-table tbody tr.catalog-item-row:hover { background: var(--card-bg); }
  .catalog-table tbody tr.catalog-item-row > td { min-width: 0; border: 0; padding: 0; }
  .catalog-select { grid-area: select; display: grid; min-width: 44px; min-height: 44px; place-items: start end; }
  .catalog-select input { width: 20px !important; min-height: 20px; }
  .catalog-art { grid-area: art; }
  .catalog-thumb { width: 68px; height: 96px; border-radius: 9px; }
  .catalog-title { grid-area: title; overflow: hidden; padding-top: 2px !important; }
  .catalog-title-main { overflow-wrap: anywhere; padding-right: 4px; font-size: 14px; line-height: 1.35; }
  .catalog-title-raw { display: -webkit-box; overflow: hidden; font-size: 10px; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .catalog-kind { grid-area: kind; }
  .catalog-episode { grid-area: episode; display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
  .catalog-category { grid-area: category; display: flex; min-width: 0; align-items: center; gap: 7px; }
  .catalog-category-name { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
  .catalog-tmdb { grid-area: tmdb; display: grid; grid-template-columns: auto minmax(0, 160px); align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--border-soft) !important; padding-top: 10px !important; }
  .catalog-tmdb input { min-height: 40px; }
  .catalog-destination { display: none; }
  .catalog-status { grid-area: status; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
  .catalog-actions { grid-area: actions; border-top: 1px solid var(--border-soft) !important; padding-top: 10px !important; }
  .catalog-actions .media-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-actions .media-actions button { width: 100%; min-width: 0; white-space: normal; }
  .catalog-mobile-label { display: inline; flex: 0 0 auto; color: var(--muted-2); font-size: 8px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }

  .library-table-wrap { overflow: visible; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .library-page-size { width: 100%; justify-content: space-between; margin: 0; }
  .library-page-size select { width: 92px; }
  .library-search { display: grid; width: 100%; grid-template-columns: minmax(0, 1fr) auto; }
  .library-search input[type="search"] { min-width: 0; }
  .library-search .btn { grid-column: 1 / -1; text-align: center; }
  .library-bulkbar { top: 72px; grid-template-columns: 1fr 1fr; padding: 10px; }
  .library-bulkbar > strong { text-align: right; }
  .library-bulkbar select { grid-column: 1 / -1; }
  .library-bulkbar button, .library-bulkbar #library-batch-compress, .library-bulkbar #library-batch-delete { grid-column: auto; grid-row: auto; width: 100%; }
  .library-bulkbar #library-batch-delete { grid-column: 1 / -1; }
  .library-media-table, .library-media-table tbody { display: block; width: 100%; }
  .library-media-table thead { display: none; }
  .library-media-table tbody { display: grid; gap: 11px; }
  .library-media-table tr.library-media-card { position: relative; display: grid; min-width: 0; grid-template-columns: 58px minmax(0, 1fr) auto auto; grid-template-areas: "cover title title tmdb" "cover seasons episodes size" "category category category category" "actions actions actions actions"; gap: 9px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-bg); padding: 12px; box-shadow: 0 1px 0 var(--card-edge); }
  .library-media-table tr.library-media-card:hover { background: var(--card-bg); }
  .library-media-table tr.library-media-card > td { min-width: 0; border: 0; padding: 0; }
  .library-movies-table tr.library-media-card { grid-template-columns: 58px minmax(0, 1fr) auto; grid-template-areas: "cover title tmdb" "cover size size" "category category category" "actions actions actions"; }
  .library-cover { grid-area: cover; }
  .library-card-select { position: absolute; top: 8px; right: 8px; z-index: 2; display: grid; width: 30px; height: 30px; place-items: center; border: 0 !important; border-radius: 8px; background: var(--panel-2); padding: 0 !important; }
  .library-card-tmdb { margin-right: 30px; }
  .library-card-thumb { width: 58px; height: 82px; border-radius: 9px; }
  .library-card-title { grid-area: title; overflow: hidden; padding-top: 2px !important; overflow-wrap: anywhere; font-size: 14px; line-height: 1.35; }
  .library-card-title .media-compression-seal { margin-left: 0; }
  .library-card-tmdb { grid-area: tmdb; display: grid; align-content: start; justify-items: end; gap: 2px; font-size: 10px; }
  .library-card-seasons { grid-area: seasons; }
  .library-card-episodes { grid-area: episodes; }
  .library-card-size { grid-area: size; }
  .library-card-seasons, .library-card-episodes, .library-card-size { display: grid; align-content: end; gap: 2px; color: var(--text-soft); font-size: 11px; }
  .library-card-file { display: none; }
  .library-card-category { grid-area: category; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 9px; border-top: 1px solid var(--border-soft) !important; padding-top: 10px !important; }
  .library-card-category select { min-height: 42px; }
  .library-card-actions { grid-area: actions; border-top: 1px solid var(--border-soft) !important; padding-top: 10px !important; }
  .library-card-actions .media-actions, .library-card-actions .category-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .library-card-actions button { width: 100%; min-width: 0; white-space: normal; }
  .library-card-actions .category-actions .del:last-child { grid-column: 1 / -1; }
  .library-mobile-label { display: inline; color: var(--muted-2); font-size: 8px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
  .library-series-table .eps-row { display: block; min-width: 0; border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); background: var(--inset-bg); }
  .library-series-table .eps-row > td { display: block; width: 100%; border: 0; padding: 0; }
  .library-series-table .episode-list { padding: 12px; }
  .library-pagination { flex-direction: column; align-items: stretch; text-align: center; }
  .library-pagination .pager { flex-wrap: wrap; }
  .episode-item .media-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .episode-item .media-actions button { width: 100%; min-width: 0; }
  .episode-name { flex-wrap: wrap; }
  .episode-name > .episode-title { flex: 1 1 150px; }
}

@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .dashboard-kpis { grid-template-columns: 1fr; }
  .dashboard-kpi { min-height: 102px; }
  .dashboard-kpi-copy strong { margin-top: 7px; }
  .dashboard-heading-actions { grid-template-columns: 1fr; }
  .library-action-buttons { grid-template-columns: 1fr; }
  .queue-legend { display: grid; grid-template-columns: 1fr 1fr; }
  .dashboard-activity { grid-template-columns: 32px minmax(0, 1fr); }
  .dashboard-activity .tag { grid-column: 2; justify-self: start; }
  .logs-summary article { padding: 13px; }
  .logs-actions { grid-template-columns: 1fr; }
  .logs-actions .btn-danger { grid-column: auto; }
  .log-entry-meta { gap: 6px; }
  .log-origin { width: 100%; overflow-wrap: anywhere; }
  .stat .n { overflow-wrap: anywhere; font-size: clamp(19px, 6.4vw, 23px); }
  .stat .l { overflow-wrap: anywhere; }
  .stat { min-width: 0; }
  .card { padding: 16px; }
  .row > *, .row > .shrink { flex: 1 1 100%; }
  .row button, .row .btn { width: 100%; }
  .catalog-heading { display: grid; gap: 12px; }
  .catalog-total { text-align: left; }
  .catalog-filter { grid-template-columns: 1fr; }
  .catalog-search-field, .catalog-group-filter, .catalog-filter-actions { grid-column: auto; }
  .catalog-filter-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .catalog-empty > div { display: grid; width: 100%; }
  .modal-search-row { grid-template-columns: 1fr 1fr; }
  .modal-search-row > div { grid-column: 1 / -1; }
  .password-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.compression-warning {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--warn, #d29922);
  background: color-mix(in srgb, var(--warn, #d29922) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn, #d29922) 45%, transparent);
}

.compression-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.compression-actions button { flex: 1 1 auto; }



/* --- episodios expandidos no catalogo --- */
.catalog-eps-row > td {
  background: var(--panel-2);
  padding: 16px 20px;
  border-top: 1px solid var(--border-soft);
}
.catalog-eps-panel { display: flex; flex-direction: column; gap: 12px; }

.catalog-eps-warning {
  margin: 0; padding: 10px 13px; border-radius: 10px;
  font-size: 12.5px; line-height: 1.5;
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 11%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 34%, transparent);
}

.catalog-eps-season {
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
  transition: border-color .18s ease;
}
.catalog-eps-season:hover { border-color: var(--border); }
.catalog-eps-season > summary {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; cursor: pointer; list-style: none;
  font-size: 13.5px; user-select: none;
}
/* Alguns navegadores ignoram list-style e mantem o triangulo nativo, que
   apareceria ao lado do nosso chevron. */
.catalog-eps-season > summary::-webkit-details-marker { display: none; }
.catalog-eps-season > summary::marker { content: ''; }
.catalog-eps-season[open] > summary { border-bottom: 1px solid var(--border-soft); }

.catalog-eps-chevron {
  flex: 0 0 auto; width: 18px; text-align: center;
  color: var(--muted); font-size: 17px; line-height: 1;
  transition: transform .18s ease;
}
.catalog-eps-season[open] .catalog-eps-chevron { transform: rotate(90deg); }

.catalog-eps-season-title { font-weight: 650; color: var(--text-strong); }
.catalog-eps-count {
  flex: 0 0 auto; padding: 2px 9px; border-radius: 999px;
  background: var(--icon-bg); color: var(--muted);
  font-size: 11.5px; font-weight: 600;
}

.catalog-eps-progress {
  flex: 1 1 auto; display: flex; align-items: center; gap: 9px;
  min-width: 90px; max-width: 260px;
}
.catalog-eps-track {
  flex: 1 1 auto; height: 5px; border-radius: 999px;
  background: var(--icon-bg); overflow: hidden;
}
.catalog-eps-track > i {
  display: block; height: 100%; border-radius: 999px;
  background: var(--ok); transition: width .35s ease;
}
.catalog-eps-ratio {
  flex: 0 0 auto; color: var(--muted);
  font-size: 11.5px; font-variant-numeric: tabular-nums;
}
.catalog-eps-complete {
  flex: 0 0 auto; color: var(--ok);
  font-size: 12px; font-weight: 600;
}

.catalog-eps-list {
  list-style: none; margin: 0; padding: 6px;
  display: flex; flex-direction: column; gap: 1px;
}
.catalog-eps-item {
  display: flex; align-items: center; gap: 11px;
  padding: 6px 9px; border-radius: 8px; font-size: 13px;
  transition: background .14s ease;
}
.catalog-eps-item:hover { background: var(--hover-bg); }
.catalog-eps-num {
  flex: 0 0 auto; display: grid; place-items: center;
  min-width: 26px; height: 22px; padding: 0 6px;
  border-radius: 6px; background: var(--icon-bg);
  color: var(--muted); font-size: 11px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.catalog-eps-name {
  flex: 1 1 auto; min-width: 0; color: var(--text-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.catalog-eps-item .btn-sm { flex: 0 0 auto; }
.catalog-eps-item.is-repeat { opacity: .55; }
.catalog-eps-item.is-repeat .catalog-eps-name { text-decoration: line-through; }
.catalog-eps-dup {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 40%, transparent);
}

@media (max-width: 720px) {
  .catalog-eps-progress { display: none; }
  .catalog-eps-season > summary { flex-wrap: wrap; gap: 8px; }
}

/* Capa no lugar do rotulo TV/MOV quando o conteudo tem imagem. */
.activity-kind, .active-download-icon { overflow: hidden; padding: 0; }
.activity-kind img, .active-download-icon img {
  width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit;
}

/* Peso do arquivo: o valor atual manda, o anterior e so contexto. */
.library-card-size { line-height: 1.35; }
.size-now { display: block; color: var(--text-strong); font-weight: 600; }
.size-before {
  display: block; margin-top: 2px;
  color: var(--muted); font-size: 11.5px; font-weight: 400;
}

/* Miniatura e caminho completo na lista de episodios. */
.episode-thumb {
  flex: 0 0 auto; width: 34px; height: 50px; border-radius: 6px;
  object-fit: cover; display: block; background: var(--icon-bg);
}
.episode-thumb.is-empty {
  display: grid; place-items: center;
  color: var(--muted); font-size: 10px; font-weight: 700;
}
/* Titulo e selo na primeira linha; o caminho do arquivo ocupa a linha
   inteira abaixo, senao os dois disputam a mesma coluna e se sobrepoem. */
.episode-name { flex-wrap: wrap; row-gap: 2px; }
.episode-path {
  flex: 1 0 100%; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
  font-size: 10.5px; color: var(--muted);
}

/* Sem posicao confiavel: barra listrada em vez de uma barra vazia, que
   pareceria "parado no inicio". */
.viewer-progress.is-unknown {
  background-image: repeating-linear-gradient(
    -45deg, var(--icon-bg) 0 6px, transparent 6px 12px);
}
.viewer-progress.is-unknown > i { display: none; }
