/* Screens — light, poster-forward, purple accent. Kithold family conventions. */
:root {
  --bg: #f6f4fb;           /* soft lavender-white */
  --surface: #ffffff;      /* white cards */
  --surface-2: #efeaf9;    /* light purple-gray (chips, inputs) */
  --border: #e6e0f2;       /* light purple-gray border */
  --text: #201a33;         /* deep near-black, purple-tinted */
  --muted: #6b6480;        /* gray — darkened from #837b96, which measured ~3.7:1 on
                              the bg and ~3.5:1 on chips (below the WCAG AA 4.5:1
                              floor for the small text this token is used for) */
  --purple: #7c3aed;       /* brand accent */
  --purple-ink: #ffffff;   /* text/icons on purple */
  --wanted: #7c3aed;       /* purple */
  --downloaded: #2563eb;   /* blue */
  --watched: #16a34a;      /* green */
  --danger: #dc2626;       /* red */
  --radius: 14px;
  --shadow: 0 6px 20px rgba(80,60,130,.12);   /* soft purple-gray */
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);    /* notch inset, for the pull-to-refresh dial */
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(68px + var(--safe-b));
}
/* Pull to refresh. Sits above the app bar, hidden until pulled. The JS drives
   transform/opacity per frame, so only the snap-back is transitioned here. */
.ptr {
  position: fixed; top: calc(6px + var(--safe-t)); left: 50%; z-index: 60;
  margin-left: -19px; width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
}
.ptr .icon { width: 19px; height: 19px; }
.ptr.ready { color: var(--purple); border-color: var(--purple); }
.ptr.spinning { color: var(--purple); animation: ptr-spin .7s linear infinite; }
/* Snap back only when the finger is gone; during the drag JS owns the value. */
.ptr:not(.ready):not(.spinning) { transition: transform .22s ease, opacity .22s ease; }
/* Pinned at the commit distance while it loads. Both ends declared, or each
   iteration would restart from the inline transform and visibly jump. */
@keyframes ptr-spin {
  from { transform: translateY(68px) rotate(0deg); }
  to   { transform: translateY(68px) rotate(360deg); }
}

a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
.icon { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: inline-block; vertical-align: middle; }

/* Keyboard focus must be visible on every control, not just the inputs. */
:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; border-radius: 6px; }
button:focus-visible, a:focus-visible, .card:focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; }

/* Respect Reduce Motion: kill the sheet slide, the mic pulse and the listening wave. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}

/* ── Header ─────────────────────────────────────────────────────────────── */
header.app-bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px calc(14px + env(safe-area-inset-top, 0px));
  background: linear-gradient(180deg, rgba(246,244,251,.97), rgba(246,244,251,.82));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: .2px; font-size: 19px; }
.brand .mark { color: var(--purple); display: flex; }
.brand-img { width: 27px; height: 27px; border-radius: 7px; display: block; }
.empty-state .big .brand-img { width: 64px; height: 64px; border-radius: 16px; opacity: .5; }
/* 44x44 minimum: HIG hit target. Was 22px icon + 6px padding = 34px. */
.ghost-btn { background: none; border: none; color: var(--muted); padding: 6px; border-radius: 10px; display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
.ghost-btn:hover { color: var(--text); background: var(--surface); }

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 6px; padding: 14px 14px 4px; position: sticky; top: 0; }
.tab {
  flex: 1; text-align: center; padding: 10px 6px; border-radius: 11px;
  background: var(--surface); border: 1px solid transparent; color: var(--muted);
  font-weight: 650; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 7px;
}
.tab .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .8; }
.tab[data-k="wanted"].active { color: var(--wanted); }
.tab[data-k="downloaded"].active { color: var(--downloaded); }
.tab[data-k="watched"].active { color: var(--watched); }
.tab.active { background: var(--surface-2); border-color: var(--border); color: var(--text); }

/* ── Poster grid ────────────────────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; padding: 14px; }
.card { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow); cursor: pointer; }
.card .poster { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; background: var(--surface-2); }
.card .poster.empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; text-align: center; padding: 10px; }
.card .meta { padding: 9px 10px 11px; }
.card .title { font-size: 14px; font-weight: 700; line-height: 1.25; margin: 0 0 3px; }
.card .sub { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 10.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.tag-by { position: absolute; top: 8px; left: 8px; background: rgba(124,58,237,.92); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; backdrop-filter: blur(4px); }
/* A Wanted movie that can never reach Radarr (no IMDB id). Amber, not red: it
   is stalled waiting on upstream metadata, not broken. Top-right, so it never
   collides with the purple .tag-by on the left. */
.tag-blocked { position: absolute; top: 8px; right: 8px; background: rgba(180,83,9,.94); color: #fff; font-size: 10.5px; font-weight: 700; letter-spacing: .2px; padding: 3px 8px; border-radius: 999px; backdrop-filter: blur(4px); }
.card.blocked .poster { opacity: .82; }

.empty-state { text-align: center; color: var(--muted); padding: 60px 30px; }
/* First-run hints: the marquee ways in (voice, photo, household) were invisible
   until you already knew about them. */
.empty-hints { display: inline-flex; flex-direction: column; gap: 12px; margin: 22px auto 0; text-align: left; }
.empty-hints .hint { display: flex; align-items: center; gap: 11px; font-size: 14.5px; color: var(--muted); }
.empty-hints .hint .icon { width: 19px; height: 19px; color: var(--purple); flex: none; }
.empty-state .big { font-size: 44px; color: var(--surface-2); margin-bottom: 10px; }

/* ── Bottom nav bar ─────────────────────────────────────────────────────── */
.bottom-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; align-items: flex-end; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: var(--safe-b); box-shadow: 0 -4px 16px rgba(80,60,130,.06); }
.nav-group { flex: 1; display: flex; align-items: flex-end; justify-content: space-around; }
.navtab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; background: none; border: none; color: var(--muted); padding: 8px 2px 9px; font-size: 11px; font-weight: 600; }
.navtab .icon { width: 24px; height: 24px; stroke-width: 1.9; }
.navtab.active { color: var(--purple); }
.navtab.active .icon { stroke-width: 2.2; }
/* Center raised "Add" FAB — larger circle lifted above the bar (pattern from
   Time 2 Table's BottomNav: a w-14 h-14 circle pulled up with -mt-7). */
.navtab.add { flex: none; align-self: flex-end; width: 60px; height: 60px; margin: 0 8px; padding: 0; border-radius: 50%; background: var(--purple); color: #fff; display: flex; flex-direction: row; align-items: center; justify-content: center; border: 4px solid var(--surface); box-shadow: 0 8px 18px rgba(124,58,237,.5); transform: translateY(-16px); }
.navtab.add .icon { width: 30px; height: 30px; stroke: #fff; stroke-width: 2.6; }
.navtab.add span { display: none; }
.btn-primary { background: var(--purple); color: var(--purple-ink); border: none; font-weight: 800; font-size: 16px; padding: 14px 22px; border-radius: 14px; display: flex; align-items: center; gap: 9px; box-shadow: var(--shadow); width: 100%; max-width: 440px; justify-content: center; }
.btn-primary .icon { stroke: var(--purple-ink); stroke-width: 2.4; }

/* ── Sheets (add + detail) ──────────────────────────────────────────────── */
.sheet { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; animation: slideup .22s ease; }
@keyframes slideup { from { transform: translateY(3%); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px calc(12px + env(safe-area-inset-top,0px)); border-bottom: 1px solid var(--border); }
.sheet-head h2 { font-size: 17px; margin: 0; flex: 1; }
.sheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* Search */
.search-row { display: flex; gap: 8px; padding: 14px 16px; }
/* font-family must be explicit: form controls don't inherit it, and <textarea>
   falls back to monospace in WebKit/Chrome (the Notes field looked like code). */
.field { height: 48px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 0 14px; font-size: 16px; width: 100%; font-family: inherit; }
select.field { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2399a0ac' stroke-width='1.8'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.field:focus { outline: none; border-color: var(--purple); }
/* Floating labels: the label doubles as the placeholder and rises once the field
   is focused or filled, so a field never loses its name the moment you type. */
.fieldwrap { position: relative; }
.fieldwrap .field { height: 56px; padding-top: 19px; }
.fieldwrap > label {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 16px; pointer-events: none;
  transition: top .14s ease, font-size .14s ease, color .14s ease, transform .14s ease;
}
.fieldwrap .field:focus + label,
.fieldwrap .field:not(:placeholder-shown) + label {
  top: 9px; transform: none; font-size: 11.5px; font-weight: 700; letter-spacing: .3px; color: var(--purple);
}
.mic { flex: none; width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); display: flex; align-items: center; justify-content: center; }
.mic.live { color: var(--purple); border-color: var(--purple); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

/* Voice-search "listening" overlay (clear indicator + a way to stop) */
.listening { position: absolute; inset: 0; z-index: 15; display: flex; align-items: center; justify-content: center; background: rgba(246,244,251,.86); backdrop-filter: blur(3px); animation: fadein .15s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.listen-card { display: flex; flex-direction: column; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 28px 32px; }
.wave { display: flex; align-items: center; gap: 5px; height: 44px; }
.wave span { width: 5px; height: 12px; background: var(--purple); border-radius: 3px; animation: wave 1s ease-in-out infinite; }
.wave span:nth-child(2) { animation-delay: .15s; }
.wave span:nth-child(3) { animation-delay: .3s; }
.wave span:nth-child(4) { animation-delay: .45s; }
.wave span:nth-child(5) { animation-delay: .6s; }
@keyframes wave { 0%,100% { height: 12px; } 50% { height: 40px; } }
.listen-text { font-weight: 700; font-size: 16px; color: var(--text); }
.listen-stop { background: var(--surface-2); border: 1px solid var(--border); color: var(--danger); border-radius: 12px; padding: 10px 28px; font-weight: 700; font-size: 15px; }

/* Result rows */
.result { display: flex; gap: 12px; padding: 10px 16px; align-items: center; border-bottom: 1px solid var(--border); }
#results .result { cursor: pointer; }
.result img, .result .noimg { width: 52px; height: 78px; border-radius: 8px; object-fit: cover; background: var(--surface-2); flex: none; }
.result .noimg { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 10px; }
.result .r-meta { flex: 1; min-width: 0; }
.result .r-title { font-weight: 700; font-size: 15px; }
.result .r-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.result .r-add { flex: none; background: var(--surface-2); border: 1px solid var(--border); color: var(--purple); border-radius: 10px; padding: 8px 12px; font-weight: 700; }
.result .r-add.added { color: var(--watched); border-color: var(--watched); background: transparent; display: inline-flex; align-items: center; gap: 5px; }
.result .r-add.added .icon { width: 15px; height: 15px; }

/* Confirm attribution */
.confirm { padding: 16px; display: grid; gap: 12px; }
.confirm .pickers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lbl { font-size: 12px; color: var(--muted); font-weight: 650; margin-bottom: 6px; display: block; }

/* ── Detail ─────────────────────────────────────────────────────────────── */
.detail-hero { position: relative; }
.detail-hero .backdrop { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--surface-2); display: block; }
.detail-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, var(--bg), transparent 70%); }
.detail-body { padding: 0 18px 40px; margin-top: -50px; position: relative; z-index: 1; }
.detail-body h1 { font-size: 24px; margin: 0 0 6px; }
.detail-sub { color: var(--muted); font-size: 14px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.seg { display: flex; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 5px; margin-bottom: 18px; }
.seg button { flex: 1; border: none; background: none; color: var(--muted); font-weight: 700; padding: 11px 6px; border-radius: 9px; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 6px; }
/* One active colour everywhere. The nav already used the brand purple, so the
   detail control's green/blue made the same status two different colours and
   pulled two non-brand hues into the palette. The check + fill carry the state. */
.seg button.on { background: var(--purple); color: #fff; }
.overview { color: #4a4458; line-height: 1.55; font-size: 15px; margin-bottom: 20px; }
.chip.genre { text-transform: none; letter-spacing: normal; font-weight: 600; }
/* Cast strip on the detail screen */
.cast-row { display: flex; gap: 12px; overflow-x: auto; padding: 2px 0 14px; -webkit-overflow-scrolling: touch; }
.cast { flex: none; width: 78px; text-align: center; }
.cast img, .cast-noimg { width: 78px; height: 78px; border-radius: 50%; object-fit: cover; background: var(--surface-2); display: block; }
.cast-noimg { display: flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 700; font-size: 26px; }
.cast-name { font-size: 12px; font-weight: 650; margin-top: 6px; line-height: 1.2; }
.cast-role { font-size: 11px; color: var(--muted); line-height: 1.2; margin-top: 1px; }
.trailer-btn { display: inline-flex; align-items: center; gap: 8px; background: var(--surface-2); color: var(--purple); border: 1px solid var(--border); border-radius: 12px; padding: 11px 18px; font-weight: 700; font-size: 14px; text-decoration: none; margin: 2px 0 8px; }
.trailer-btn .icon { width: 18px; height: 18px; fill: currentColor; }
#richmeta .kv { margin-top: 4px; }
/* Popular shelf heading on the Add screen */
.shelf-h { font-weight: 700; font-size: 15px; padding: 16px 16px 2px; color: var(--text); }
.kv { display: flex; gap: 8px; font-size: 14px; margin-bottom: 10px; }
.kv .k { color: var(--muted); width: 92px; flex: none; }
textarea.field { height: auto; min-height: 84px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.btn-danger { background: none; border: 1px solid var(--border); color: var(--danger); border-radius: 12px; padding: 13px; font-weight: 700; width: 100%; margin-top: 22px; }
/* Archive is reversible, so it reads neutral rather than destructive-red. */
.btn-archive { display: flex; align-items: center; justify-content: center; gap: 8px; background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 12px; padding: 13px; font-weight: 700; width: 100%; margin-top: 22px; }
.btn-archive:hover { color: var(--text); background: var(--surface); }

/* ── Auth ───────────────────────────────────────────────────────────────── */
.auth-wrap { max-width: 380px; margin: 0 auto; padding: 8vh 24px 40px; }
.auth-wrap .brand { justify-content: center; font-size: 26px; margin-bottom: 6px; }
.auth-tag { text-align: center; color: var(--muted); margin-bottom: 30px; font-size: 15px; }
.auth-form { display: grid; gap: 12px; }
.auth-form .btn-primary { max-width: none; }
.auth-err { color: var(--danger); font-size: 14px; text-align: center; min-height: 18px; }
.auth-toggle { text-align: center; color: var(--muted); margin-top: 18px; font-size: 14px; }
.auth-toggle button { background: none; border: none; color: var(--purple); font-weight: 700; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
/* Attribution pins to the bottom (margin-top:auto) so it never floats
   mid-screen on short lists. Phone shell is made a full-height flex column
   below; the wide layout's .wide-main is already a flex column. */
/* The attribution is a FOOTER and belongs at the bottom. It already had
   margin-top:auto but no flex parent to push against, so on a short list it sat
   directly under the grid, stranded mid-screen like stray body text. */
.phone-shell { display: flex; flex-direction: column; min-height: 100vh; min-height: calc(100dvh - 68px - var(--safe-b)); }
.phone-shell > #list { flex: 1 0 auto; }
.wide-main { min-height: 100vh; }
.wide-main > #list { flex: 1 0 auto; }
/* margin-top:auto pins the credit to the bottom of the content column. The extra
   bottom padding clears the raised + FAB, which overhangs the bar into this space
   and was clipping the second line. Wide has no bottom bar, so it needs less. */
.tmdb-footer { margin-top: auto; text-align: center; color: var(--muted); font-size: 12px; padding: 22px 20px calc(88px + var(--safe-b)); }
body.is-wide .tmdb-footer { padding-bottom: 28px; }
/* Only the phone app shell (has the top .app-bar) becomes a viewport-height
   flex column — scoped via :has so the auth screen and wide sidebar layout
   are untouched. Height stops just above the fixed bottom nav (68px). */
#app:has(> .app-bar) { display: flex; flex-direction: column; min-height: calc(100vh - 68px - var(--safe-b)); min-height: calc(100dvh - 68px - var(--safe-b)); }
.tmdb-footer .tmdb { color: #7c3aed; font-weight: 700; }
.toast { position: fixed; bottom: calc(96px + var(--safe-b)); left: 50%; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--border); color: var(--text); padding: 11px 18px; border-radius: 12px; z-index: 60; box-shadow: var(--shadow); font-size: 14px; display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.toast-action { background: none; border: none; color: var(--purple); font-weight: 800; font-size: 14px; padding: 2px 2px; }
.hidden { display: none !important; }

/* ── Wide layout: iPad / desktop sidebar ─────────────────────────────────── */
body.is-wide { padding-bottom: 0; }
.wide-shell { display: flex; min-height: 100vh; align-items: stretch; }
.sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 232px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 22px 14px calc(16px + var(--safe-b)); z-index: 40; }
.side-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 21px; padding: 2px 8px 18px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav .navtab { flex-direction: row; justify-content: flex-start; gap: 13px; padding: 11px 14px; border-radius: 12px; }
.side-nav .navtab span { font-size: 15px; font-weight: 650; }
.side-nav .navtab.active { background: rgba(124,58,237,.1); }
.side-add { margin-top: 16px; width: 100%; max-width: none; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 12px; border-top: 1px solid var(--border); }
.side-link { display: flex; align-items: center; gap: 13px; padding: 11px 14px; border-radius: 12px; background: none; border: none; color: var(--muted); font-size: 14.5px; font-weight: 600; text-align: left; }
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link .icon { width: 22px; height: 22px; flex: none; }
/* Signed-in identity at the foot of the sidebar: initials avatar + name. */
.side-me { align-items: center; }
.side-me .avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; background: var(--purple); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 800; letter-spacing: .4px; }
.side-me .me-name { font-size: 14.5px; font-weight: 650; text-transform: capitalize; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.side-me.active .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--purple); }
.wide-main { margin-left: 232px; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wide-main > * { width: 100%; max-width: 1180px; margin-left: auto; margin-right: auto; }
/* Wide: fewer, LARGER posters in a centred column. The old 158px tracks spread
   3 thumbnails across a 5-column grid and left the page looking abandoned. */
body.is-wide .grid { grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 22px; padding: 2px 28px 40px; max-width: 1040px; margin-inline: auto; }
body.is-wide .card .title { font-size: 15px; }
body.is-wide .card .sub { font-size: 12.5px; }
body.is-wide .empty-state { padding: 70px 30px 100px; }
/* Heading above the grid so the content column has a top edge. */
.list-head { display: flex; align-items: baseline; gap: 12px; max-width: 1040px; margin-inline: auto; padding: 28px 28px 10px; }
.list-head h2 { font-size: 27px; margin: 0; letter-spacing: -.2px; }
.list-head .count { color: #615a72; font-size: 14px; font-weight: 600; }
.list-head .mfilter { margin-left: auto; }

/* TV / Movies filter. Phone: a full-width segmented row under the header.
   Wide: sits inline at the right of the list heading. */
.mfilter { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 4px; margin: 12px 14px 0; }
.mf { flex: 1; border: none; background: none; color: var(--muted); font-weight: 650; font-size: 13.5px; padding: 8px 14px; border-radius: 8px; white-space: nowrap; }
.mf.on { background: var(--purple); color: #fff; }
.list-head .mfilter { margin: 0; flex: none; }
.list-head .mf { flex: none; }

/* ── Sort ───────────────────────────────────────────────────────────────────
   Phone: shares a row with the TV/Movies filter. Wide: inline in the heading.
   Height is set explicitly to match .mfilter — a native select renders shorter
   than its neighbours otherwise and the row looks misaligned. */
.list-controls { display: flex; align-items: stretch; gap: 8px; margin: 12px 14px 0; }
.list-controls .mfilter { margin: 0; flex: 1; min-width: 0; }
.sortwrap { display: flex; flex: none; }
.list-controls .sortwrap { flex: 1; min-width: 0; }
.sortsel {
  width: 100%; height: 42px; min-height: 42px;      /* = .mfilter: 8px padding + 4px pad + borders */
  appearance: none; -webkit-appearance: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 11px;
  color: var(--ink); font: inherit; font-weight: 650; font-size: 13.5px;
  padding: 0 30px 0 13px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6480' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.sortsel:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }
.list-head .sortwrap { flex: none; }
.list-head .sortsel { width: auto; }

/* Release date on the card. Upcoming titles get the accent so a Wanted list of
   unreleased films reads at a glance. */
.card .when { white-space: nowrap; }
.card .when.soon { color: var(--purple); font-weight: 650; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* Sheets become centered floating cards (not full-screen) on wide screens. */
/* The huge spread on the second shadow IS the backdrop scrim — without it the
   list behind stayed fully lit and the panel never read as modal. */
body.is-wide .sheet { inset: 5vh 0 auto 0; margin-inline: auto; width: min(680px, 92vw); height: min(88vh, 900px); border-radius: 20px; border: 1px solid var(--border); box-shadow: 0 24px 70px rgba(30,20,60,.3), 0 0 0 100vmax rgba(30,20,60,.38); overflow: hidden; }
body.is-wide .sheet .sheet-head { border-radius: 20px 20px 0 0; }

/* ── Header actions ─────────────────────────────────────────────────────── */
.bar-actions { display: flex; gap: 2px; }

/* ── Social sign-in ─────────────────────────────────────────────────────── */
#socialwrap { display: grid; gap: 10px; margin-bottom: 18px; }
.gbtn-wrap { display: flex; justify-content: center; min-height: 44px; }
.gbtn-wrap > div { width: 100%; }
.socbtn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 44px; border-radius: 8px; border: none; background: #000; color: #fff; font-size: 15px; font-weight: 600; }
/* Native (Capacitor) Google button — Google brand styling, since GIS can't render in a WKWebView */
.socbtn.gbtn-native { background: #fff; color: #1f1f1f; border: 1px solid #dadce0; }
.socbtn svg { flex: none; }
.orline { text-align: center; color: var(--muted); font-size: 13px; position: relative; margin: 4px 0; }
.orline::before, .orline::after { content: ""; position: absolute; top: 50%; width: 34%; height: 1px; background: var(--border); }
.orline::before { left: 0; } .orline::after { right: 0; }

/* ── Invite banner + sheets ─────────────────────────────────────────────── */
.invite-banner { background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--purple); border-radius: 10px; padding: 12px 14px; margin-bottom: 18px; font-size: 14px; color: #4a4458; line-height: 1.45; }
.invite-banner strong { color: var(--text); }
.invite-body { max-width: 460px; margin: 0 auto; padding: 34px 22px; text-align: center; }
.invite-illo { color: var(--purple); display: inline-flex; padding: 18px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); margin-bottom: 18px; }
.invite-illo .icon { width: 34px; height: 34px; }
/* overflow-wrap: a long address used to run straight off the right edge. */
.invite-body h3 { font-size: 21px; margin: 0 0 10px; overflow-wrap: anywhere; }
.invite-body p { color: var(--muted); line-height: 1.55; margin: 0 0 24px; font-size: 15px; }
.invite-body .btn-primary { max-width: none; }
.invite-link { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font-size: 13px; color: var(--purple); word-break: break-all; text-align: left; margin: 18px 0 14px; font-family: ui-monospace, Menlo, monospace; }
.invite-note { font-size: 13px; color: var(--muted); margin-top: 14px !important; }
/* Sonarr/Radarr setup rows */
.arr-row { text-align: left; margin: 22px 0 0; padding-top: 18px; border-top: 1px solid var(--border); }
.arr-row:first-of-type { border-top: none; padding-top: 0; }
.arr-label { font-weight: 700; font-size: 15px; margin-bottom: 8px; }
.arr-row .invite-link { margin: 0 0 8px; font-size: 12px; }
.arr-hint { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 8px 0 0 !important; }
.ghost-copy { display: inline-flex; align-items: center; gap: 7px; background: none; border: none; color: var(--muted); font-weight: 650; font-size: 14px; margin-top: 4px; }
.ghost-copy:hover { color: var(--text); }
.ghost-copy .icon { width: 17px; height: 17px; }

/* Inline explanation on a title that cannot sync to Radarr. Amber like its card
   badge: informational (waiting on upstream metadata), not an error. */
.notice { background: #fff7ed; border: 1px solid #fed7aa; color: #7c2d12; border-radius: 12px; padding: 12px 14px; font-size: 13.5px; line-height: 1.5; margin: 4px 0 16px; }
.notice strong { display: block; margin-bottom: 3px; }

/* Destination picker. Native selects render shorter than text inputs, so the
   height is set explicitly to line up with .field alongside it. */
.dest { display: flex; align-items: center; gap: 10px; padding: 0 14px 4px; }
.dest-lbl { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.dest-sel {
  flex: 1; height: 48px; padding: 0 34px 0 12px;   /* matches .field, per the fleet form rule */
  border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6480' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 18px;
  color: var(--text); font-size: 14.5px; font-weight: 600;
  -webkit-appearance: none; appearance: none;
}
.detail-body .dest-sel { width: 100%; margin-top: 2px; }

/* Batch screenshot review: several photos detected at once, shown together for
   one pass rather than confirming each inline. */
.batch { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.brow { display: flex; align-items: center; gap: 11px; padding: 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.brow.bad { opacity: .72; border-style: dashed; }
.bthumb { width: 44px; height: 62px; object-fit: cover; border-radius: 7px; background: var(--surface-2); flex: none; }
.bmeta { flex: 1; min-width: 0; }
.bmeta .r-title { font-size: 14.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bmeta .r-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 44x44 hit target, per HIG. */
.bdrop { flex: none; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; background: none; border: none; color: var(--muted); border-radius: 10px; }
.bdrop:hover { color: var(--danger); background: var(--surface-2); }

/* Drop target for screenshots dragged onto the window (Photos, Finder, a
   browser). Hidden until a drag carrying files enters the page. */
.dropzone {
  position: fixed; inset: 0; z-index: 200;
  display: none; align-items: center; justify-content: center;
  background: rgba(124,58,237,.14); backdrop-filter: blur(3px);
  pointer-events: none;                 /* never swallow the drop itself */
}
.dropzone.on { display: flex; }
.dz-inner {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 34px 44px; border-radius: 20px;
  background: var(--surface); color: var(--purple);
  border: 2px dashed var(--purple); box-shadow: var(--shadow);
  font-size: 16px; font-weight: 700;
}
.dz-inner .icon { width: 34px; height: 34px; }
