:root {
  --bg: #0f1420;
  --bg-2: #151b2b;
  --panel: #1b2234;
  --panel-2: #232c42;
  --line: #2c3650;
  --text: #e8ecf5;
  --muted: #9aa5bd;
  --dim: #6b7690;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(99, 102, 241, .16);
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --radius: 14px;
  --sidebar: 248px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
img { display: block; }

/* ---------- Seitenleiste ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 30;
  background: linear-gradient(180deg, #121828, #0d1220); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 22px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 22px; letter-spacing: -.02em; padding: 0 10px 22px; }
.brand span { background: linear-gradient(90deg, #a5b4fc, #c4b5fd); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px; color: var(--muted); font-weight: 600; transition: background .15s, color .15s; cursor: pointer; }
.sidebar nav a:hover { background: var(--panel); color: var(--text); }
.sidebar nav a.active { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 6px 20px -8px rgba(99,102,241,.7); }
.sidebar nav .ext { margin-left: auto; opacity: .6; }
.sidebar-foot { margin-top: auto; color: var(--dim); font-size: 12px; padding: 0 14px; display: flex; flex-direction: column; gap: 12px; }
/* Language: segmented switch EN | DE */
.lang-switch { display: inline-flex; align-self: flex-start; background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.lang-switch button { border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; padding: 4px 11px; border-radius: 999px; cursor: pointer; transition: background .15s, color .15s; }
.lang-switch button:hover { color: var(--text); }
.lang-switch button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.lang-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.foot-meta a { color: inherit; }
.foot-meta a:hover { color: var(--text); text-decoration: underline; }
.update-badge { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; font-size: 12.5px; font-weight: 600; color: #bbf7d0; background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.4); border-radius: 999px; padding: 4px 10px; }
.update-badge svg { width: 15px; height: 15px; }
.update-badge:hover { background: rgba(34,197,94,.2); }
.update-badge[hidden] { display: none; }
[hidden] { display: none !important; }
.facts.note { color: #fcd34d; }

/* ---------- Kopfzeile ---------- */
.main { margin-left: var(--sidebar); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 14px 28px; background: rgba(15, 20, 32, .78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(44, 54, 80, .6);
}
.brand-mobile { display: none; padding: 0; }
.search { flex: 1; min-width: 0; max-width: 720px; display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 0 16px; transition: border-color .15s, box-shadow .15s; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { color: var(--dim); width: 19px; height: 19px; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 16px; padding: 11px 0; }
.search input::placeholder { color: var(--dim); }
.search input::-webkit-search-cancel-button { filter: invert(.7); }

#view { padding: 26px 28px 60px; }

/* ---------- Reihen ---------- */
.row { margin-bottom: 34px; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 14px; }
.row-head h2 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.row-head h2::after { content: "›"; color: var(--dim); margin-left: 8px; font-weight: 500; }
.row-head h2 a { color: inherit; text-decoration: none; }
.row-head h2 a:hover { text-decoration: underline; text-underline-offset: 3px; }
.scroller { display: grid; grid-auto-flow: column; grid-auto-columns: 168px; gap: 16px; overflow-x: auto; padding: 4px 2px 14px; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.scroller > * { scroll-snap-align: start; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px 16px; }

/* ---------- Kachel ---------- */
.card { position: relative; display: block; border-radius: var(--radius); background: var(--panel); outline: 1px solid rgba(255,255,255,.06); overflow: hidden; transition: transform .18s ease, box-shadow .18s ease, outline-color .18s; }
.card:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 18px 40px -16px rgba(0,0,0,.8); outline-color: rgba(129, 140, 248, .7); }
.card .cover { aspect-ratio: 1; width: 100%; object-fit: cover; background: var(--panel-2); }
.card .overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; padding: 12px;
  background: linear-gradient(180deg, rgba(10,14,24,0) 30%, rgba(10,14,24,.92) 100%); opacity: 0; transition: opacity .18s;
}
.card:hover .overlay, .card:focus-visible .overlay { opacity: 1; }
.card .overlay b { font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .overlay small { color: #c7cfe0; font-size: 12px; }
.card-meta { padding: 10px 12px 12px; }
.card-meta .t { font-size: 13.5px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.card-meta .a { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

/* ---------- Status-Abzeichen ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; letter-spacing: .01em; white-space: nowrap; }
.card .badge { position: absolute; top: 8px; left: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.5); }
.badge svg { width: 13px; height: 13px; stroke-width: 2.6; }
.b-available { background: var(--green); color: #052e14; }
.b-downloading { background: var(--accent); color: #fff; }
.b-processing { background: var(--accent-2); color: #fff; }
.b-not_found { background: var(--amber); color: #3a2300; }
.b-failed { background: var(--red); color: #fff; }
.b-type { background: rgba(255,255,255,.1); color: #dfe4ef; }

/* ---------- Detailseite ---------- */
.detail { position: relative; margin: -26px -28px 0; padding: 40px 28px 30px; overflow: hidden; }
.detail-bg { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(40px) saturate(1.3); opacity: .45; transform: scale(1.1); }
.detail-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(15,20,32,.3) 0%, var(--bg) 92%); }
.detail-inner { position: relative; display: flex; gap: 34px; align-items: flex-end; }
.detail-cover { width: 270px; aspect-ratio: 1; border-radius: 16px; object-fit: cover; box-shadow: 0 30px 60px -20px rgba(0,0,0,.9); outline: 1px solid rgba(255,255,255,.1); flex: none; }
.detail-info { min-width: 0; flex: 1; }
.detail-info .badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.detail-info h1 { margin: 0; font-size: clamp(26px, 3.4vw, 40px); line-height: 1.1; font-weight: 800; letter-spacing: -.02em; }
.detail-info .sub { color: var(--muted); font-size: 17px; margin-top: 6px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 18px; color: #c9d1e2; font-size: 14px; margin-top: 14px; }
.facts span b { color: var(--dim); font-weight: 500; margin-right: 5px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 10px; padding: 11px 20px; font-weight: 700; font-size: 15px; cursor: pointer; transition: filter .15s, transform .1s, background .15s; white-space: nowrap; }
.btn:active { transform: scale(.98); }
.btn svg { width: 19px; height: 19px; stroke-width: 2.2; }
.btn-primary { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 10px 24px -10px rgba(99,102,241,.8); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-green { background: var(--green); color: #052e14; }
.btn-ghost { background: rgba(255,255,255,.08); color: var(--text); border: 1px solid rgba(255,255,255,.12); }
.btn-ghost:hover { background: rgba(255,255,255,.14); }
.btn[disabled] { opacity: .6; cursor: default; filter: none; }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 8px; }
.progress { height: 6px; border-radius: 99px; background: rgba(255,255,255,.1); overflow: hidden; margin-top: 12px; max-width: 420px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 99px; transition: width .6s; }

.section { margin-top: 30px; }
.section h3 { font-size: 18px; margin: 0 0 12px; }
.overview { color: #cdd4e3; white-space: pre-line; max-width: 900px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0; max-width: 520px; }
.kv div { padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv div:nth-child(odd) { color: var(--muted); }
.facts a, .kv a { color: inherit; text-decoration: underline; text-decoration-color: var(--dim); text-underline-offset: 2px; }
.facts a:hover, .kv a:hover { color: #fff; text-decoration-color: var(--accent); }
.kv div:nth-last-child(-n+2) { border-bottom: 0; }
.detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: 34px; align-items: start; }

/* ---------- Release-Liste ---------- */
.releases { display: flex; flex-direction: column; }
.rel { display: grid; grid-template-columns: 54px 1fr auto; gap: 14px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.rel:last-child { border-bottom: 0; }
.rel .score { font-weight: 800; font-size: 15px; text-align: center; border-radius: 8px; padding: 6px 0; background: var(--panel-2); }
.rel .score.good { background: rgba(34,197,94,.16); color: #4ade80; }
.rel .score.bad { color: var(--dim); }
.rel .name { font-size: 13.5px; word-break: break-word; }
.rel .why { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.rel .why .neg { color: #fca5a5; }
.rel .why .pos { color: #86efac; }

/* ---------- Anfragen ---------- */
.page-title { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 20px; }
.req-list { display: flex; flex-direction: column; gap: 12px; }
.req { position: relative; display: grid; grid-template-columns: 92px 1fr auto; gap: 18px; align-items: center; padding: 14px; overflow: hidden; }
.req-bg { position: absolute; inset: 0; background-size: cover; background-position: center; filter: blur(30px); opacity: .14; }
.req > *:not(.req-bg) { position: relative; }
.req img { width: 92px; height: 92px; border-radius: 10px; object-fit: cover; }
.req .t { font-weight: 700; font-size: 16px; line-height: 1.25; }
.req .a { color: var(--muted); font-size: 13px; margin-top: 2px; }
.req .m { color: var(--dim); font-size: 12.5px; margin-top: 6px; word-break: break-word; }
.req .side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

/* ---------- Leer / Laden ---------- */
.empty { text-align: center; color: var(--muted); padding: 70px 20px; }
.empty svg { width: 46px; height: 46px; color: var(--dim); margin-bottom: 10px; }
.skel { background: linear-gradient(90deg, var(--panel) 0%, var(--panel-2) 50%, var(--panel) 100%); background-size: 200% 100%; animation: sh 1.3s infinite linear; border-radius: var(--radius); }
.skel-card { aspect-ratio: 1; }
@keyframes sh { to { background-position: -200% 0; } }
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { position: fixed; left: 50%; bottom: calc(26px + var(--safe-b)); transform: translateX(-50%); z-index: 50; background: var(--panel-2); border: 1px solid var(--line); padding: 12px 18px; border-radius: 12px; box-shadow: 0 20px 40px -10px rgba(0,0,0,.7); font-weight: 600; max-width: calc(100vw - 32px); }
.toast.err { border-color: rgba(239,68,68,.6); }
.toast.ok { border-color: rgba(34,197,94,.6); }

.bottomnav { display: none; }

/* ---------- Mobil ---------- */
@media (max-width: 1023px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding-bottom: calc(68px + var(--safe-b)); }
  .brand-mobile { display: flex; }
  .topbar { padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  #view { padding: 18px 16px 30px; }
  .bottomnav {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: rgba(13, 18, 32, .92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-b));
  }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--dim); padding: 4px 0; cursor: pointer; }
  .bottomnav a.active { color: #a5b4fc; }
  .scroller { grid-auto-columns: 132px; gap: 12px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scroll-padding-left: 16px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px 12px; }
  .card .overlay { display: none; }
  .row-head h2 { font-size: 18px; }
  .detail { margin: -18px -16px 0; padding: 24px 16px 20px; }
  .detail-inner { flex-direction: column; align-items: center; text-align: center; gap: 20px; }
  .detail-cover { width: min(230px, 62vw); }
  .detail-info .badges, .facts, .actions { justify-content: center; }
  .detail-grid { grid-template-columns: 1fr; gap: 20px; }
  .kv { max-width: none; }
  .req { grid-template-columns: 64px 1fr; gap: 12px; }
  .req img { width: 64px; height: 64px; }
  .req .side { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
  .rel { grid-template-columns: 44px 1fr; }
  .rel .btn { grid-column: 2; justify-self: start; }
  .page-title { font-size: 24px; }
}

/* ===================== v0.2: accounts, settings, users ===================== */
#app[hidden], #auth[hidden] { display: none !important; }
.b-pending { background: var(--amber); color: #3a2300; }
.b-declined { background: #475569; color: #e2e8f0; }
.muted { color: var(--muted); }
code { background: var(--panel-2); padding: 2px 6px; border-radius: 6px; font-size: 13px; }

/* Buttons */
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; color: var(--muted); padding: 8px; cursor: pointer; text-decoration: underline; width: 100%; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger-ghost { background: transparent; color: #fca5a5; border: 1px solid rgba(239,68,68,.4); }
.btn-danger-ghost:hover { background: rgba(239,68,68,.12); }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }

/* Avatars */
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; font-weight: 800; font-size: 14px; flex: none; text-transform: uppercase; }
.avatar.lg { width: 48px; height: 48px; font-size: 19px; }
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.avatar.xs { width: 18px; height: 18px; font-size: 10px; }

/* Sidebar user chip */
.user-chip { display: flex; align-items: center; gap: 10px; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.user-chip:empty { display: none; }
.chip-text { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.chip-text b { color: var(--text); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-text small { color: var(--dim); font-size: 12px; }

/* Auth */
#auth { min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(ellipse at top, rgba(99,102,241,.25), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 32px 28px; box-shadow: 0 30px 80px -30px rgba(0,0,0,.8); }
.auth-brand { display: flex; align-items: center; gap: 12px; justify-content: center; font-size: 26px; font-weight: 800; margin-bottom: 22px; }
.auth-brand span { background: linear-gradient(90deg, #a5b4fc, #c4b5fd); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-card h1 { font-size: 22px; margin: 0 0 4px; text-align: center; }
.auth-card h2 { font-size: 17px; margin: 18px 0 4px; }
.auth-card > p, .auth-card .muted { text-align: center; margin: 0 0 18px; font-size: 14px; }
.auth-card h2 + .muted { text-align: left; }
.steps { display: flex; justify-content: center; gap: 10px; margin: 14px 0 4px; }
.step { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--panel-2); color: var(--dim); }
.step.on { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #fff; }
.step.done { background: var(--green); color: #052e14; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; border: 0; padding: 0; min-width: 0; }
.form .field { margin: 0; }
.field > span { font-weight: 600; font-size: 14px; }
.field small, .toggle small { color: var(--dim); font-size: 12.5px; font-weight: 400; line-height: 1.4; }
.field input, .field select, .row-edit input, .indexer-name {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; color: var(--text);
  font: inherit; font-size: 15px; padding: 10px 12px; outline: 0; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .row-edit input:focus, .indexer-name:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field select:disabled, .field input:disabled { opacity: .6; }
.form-error { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.4); color: #fecaca; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.toggle { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; cursor: pointer; }
.toggle input[type="checkbox"], .toggle input[type="checkbox"]:disabled { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; opacity: 0; pointer-events: none; }
.toggle { position: relative; }
.toggle > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.toggle b { font-weight: 600; font-size: 14.5px; }
.switch { width: 40px; height: 23px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); position: relative; flex: none; transition: background .15s; margin-top: 1px; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: #cbd5e1; transition: transform .15s, background .15s; }
.toggle input:checked + .switch { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .switch::after { transform: translateX(17px); background: #fff; }
.toggle input:disabled + .switch { opacity: .5; }
.toggle input:focus-visible + .switch { box-shadow: 0 0 0 3px var(--accent-soft); }
.perms { gap: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* Page head, chips, tabs */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .page-title { margin: 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 16px; scrollbar-width: none; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.chip span { background: var(--panel-2); color: var(--text); border-radius: 99px; padding: 0 7px; font-size: 12px; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: #c7d2fe; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 16px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: #c7d2fe; border-color: var(--accent); }

/* Settings */
.settings-body { max-width: 860px; }
.settings-section { padding: 16px 18px; margin-bottom: 12px; }
.settings-section .field { margin-bottom: 12px; }
.settings-section .toggle { padding: 7px 0; }
.settings-section .field input, .settings-section .field select { padding: 8px 11px; font-size: 14.5px; }
.svc-logo { width: 26px; height: 26px; border-radius: 6px; flex: none; }
.indexer-head h2, .settings-section h2.with-logo { display: flex; align-items: center; gap: 10px; }
/* A switched-off service shows its header line only */
.client.off .client-body { display: none; }
.client.off { padding-top: 12px; padding-bottom: 12px; }
.client.off .indexer-head { margin-bottom: 0; }
.client.off .svc-logo { filter: grayscale(1); opacity: .6; }
.client-hint { margin: -6px 0 12px; font-size: 13px; }
@media (min-width: 1200px) { .settings-body { max-width: 980px; } }
.settings-section h2 { font-size: 17px; margin: 0 0 4px; }
.settings-section > .muted { margin: 0 0 16px; font-size: 13.5px; }
.settings-section h2 + .field, .settings-section h2 + .toggle { margin-top: 14px; }
.save-bar { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; padding: 14px 0; background: linear-gradient(180deg, transparent, var(--bg) 35%); z-index: 5; }
.test-result { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; margin-right: auto; flex-wrap: wrap; }
.test-result:empty { display: none; }
.test-result svg { width: 16px; height: 16px; stroke-width: 2.4; }
.test-result.ok { color: #4ade80; }
.test-result.err { color: #fca5a5; }
.test-result small { flex-basis: 100%; color: var(--muted); font-weight: 400; }
.row-editor { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.row-edit { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; align-items: center; }
.indexer-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.indexer-name { font-weight: 700; font-size: 16px; max-width: 320px; }
.indexer-head .toggle { padding: 0; margin-left: auto; }
.indexer-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#addIx { margin-bottom: 8px; }
.kv.plain { max-width: none; background: none; border: 0; }

/* Users */
.user-list { display: flex; flex-direction: column; gap: 10px; }
.user-row { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 16px; padding: 14px 18px; text-align: left; cursor: pointer; font: inherit; color: inherit; width: 100%; transition: border-color .15s; }
.user-row:hover { border-color: var(--accent); }
.user-name { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-meta { color: var(--dim); font-size: 13px; margin-top: 2px; }
.perm-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.pill { font-size: 11.5px; padding: 2px 8px; border-radius: 99px; background: var(--panel-2); color: var(--muted); }
.user-stats { display: flex; flex-direction: column; align-items: center; color: var(--dim); font-size: 12px; }
.user-stats b { color: var(--text); font-size: 20px; }
.chev { color: var(--dim); }
.role-owner { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #fff; }
.role-admin { background: var(--accent-soft); color: #c7d2fe; }
.role-user { background: var(--panel-2); color: var(--muted); }

/* Requests */
.req-main { min-width: 0; }
.req .m { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.req .who { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; }
.req .rel-name { word-break: break-word; }
.side-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.facts.requester { align-items: center; gap: 8px; }
.facts.requester span { color: var(--muted); }

/* Modal and bottom sheet */
.modal-back, .sheet-back { position: fixed; inset: 0; z-index: 60; background: rgba(5,8,15,.7); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 20px 22px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.9); }
.modal.small { max-width: 400px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-user { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.modal-actions.spread { justify-content: space-between; }
.sheet-back { place-items: end stretch; padding: 0; }
.sheet { background: var(--panel); border-radius: 20px 20px 0 0; border-top: 1px solid var(--line); padding: 18px 16px calc(18px + var(--safe-b)); display: flex; flex-direction: column; gap: 4px; }
.sheet-user { display: flex; align-items: center; gap: 12px; padding: 4px 8px 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.sheet-user small { display: block; color: var(--dim); }
.sheet a, .sheet button { display: flex; align-items: center; gap: 12px; padding: 13px 10px; border-radius: 10px; background: none; border: 0; color: var(--text); font: inherit; font-weight: 600; font-size: 16px; text-align: left; cursor: pointer; }
.sheet a:active, .sheet button:active { background: var(--panel-2); }
.sheet-lang { display: flex; align-items: center; justify-content: space-between; padding: 10px; font-weight: 600; }
.sheet-lang .lang-switch button { font-size: 14px; padding: 6px 14px; }

@media (max-width: 1023px) {
  .grid-2, .row-edit { grid-template-columns: 1fr; }
  .row-edit { padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
  .row-edit .icon-btn { justify-self: end; }
  .user-row { grid-template-columns: auto 1fr auto; gap: 12px; padding: 12px 14px; }
  .user-row .chev { display: none; }
  .settings-section { padding: 16px; }
  .tabs a { padding: 10px 12px; }
  .indexer-head { flex-wrap: wrap; }
  .req .side { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
  .side-actions { flex-wrap: nowrap; margin-left: auto; }
}

/* v0.3: download clients, Prowlarr */
.indexer-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.indexer-head h2 .pill { font-size: 11px; font-weight: 700; }
.subhead { font-size: 17px; margin: 26px 0 12px; }
details.advanced { margin: 4px 0 14px; border: 1px dashed var(--line); border-radius: 10px; padding: 10px 14px; }
details.advanced summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px; }
details.advanced[open] summary { margin-bottom: 8px; }
details.advanced .muted { font-size: 13px; margin: 0 0 12px; }
.proto { font-weight: 700; border-radius: 6px; padding: 0 6px; }
.proto-usenet { background: rgba(99,102,241,.18); color: #c7d2fe; }
.proto-torrent { background: rgba(16,185,129,.18); color: #6ee7b7; }

/* v0.4: notifications, stalled */
.b-stalled { background: #f97316; color: #2a1200; }
.events { margin-top: 6px; }

/* Sorting on discover and in genre search (same look as the settings) */
.sortbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin: 0 0 18px; }
.sortbar .field { margin: 0; min-width: 230px; max-width: 300px; }
.row-count { color: var(--dim); font-size: 13px; font-weight: 400; margin-left: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* Language switch on the sign-in card */
.auth-card { position: relative; }
.auth-lang { position: absolute; top: 14px; right: 14px; }
.small-note { font-size: 12.5px; text-align: center; margin: 0; }
/* Invites */
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.invite-list { display: flex; flex-direction: column; gap: 8px; }
.invite-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.invite-row.closed { opacity: .55; }
.invite-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.invite-main small { color: var(--dim); font-size: 13px; overflow-wrap: anywhere; }
.invite-link { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px !important; }
.update-inline { color: #86efac; font-weight: 600; }
/* the on/off switch in a card header sits on the title line */
.indexer-head .toggle, .settings-section h2 + .toggle.in-head { margin-top: 0; align-items: center; }
.indexer-head .toggle .switch { margin-top: 0; }
.kv.plain a { color: #c7d2fe; text-decoration: underline; text-decoration-color: var(--dim); text-underline-offset: 3px; }
.kv.plain a:hover { color: #fff; text-decoration-color: var(--accent); }
.auth-card .auth-brand { margin-top: 26px; }
.settings-section .indexer-head h2 { margin: 0; }
.settings-section .indexer-head .toggle { padding: 0; margin: 0 0 0 auto; }

/* Manual requests */
.manual-hint { display: flex; align-items: center; gap: 16px; justify-content: space-between; flex-wrap: wrap; padding: 14px 18px; margin-top: 22px; }
.manual-hint > div { display: flex; flex-direction: column; gap: 2px; }
.manual-hint small { color: var(--dim); font-size: 13px; }
.b-manual { background: rgba(245,158,11,.15); color: #fcd34d; }
.modal:has(#manPick:not([hidden])) { max-width: 760px; }
.pick-head { margin: 0 0 4px; font-size: 16px; }
.pick-list { max-height: 55vh; overflow: auto; margin-bottom: 8px; }
