:root {
  --bg: #0f1115;
  --bg-2: #161a22;
  --bg-3: #1d2330;
  --border: #2a3142;
  --text: #e8ecf4;
  --muted: #9aa3b5;
  --accent: #6ea8fe;
  --accent-2: #3d7eff;
  --danger: #ff6b6b;
  --ok: #3dd68c;
  --sidebar-w: 260px;
  --list-w: 380px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  height: 100%;
  width: 100%;
  margin: 0;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--accent); text-decoration: none; }
button, input, select { font: inherit; }
.hidden { display: none !important; }

.btn {
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text);
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  min-height: 40px;
}
.btn:hover { border-color: #3d4660; }
.btn.primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}
.btn.ghost { background: transparent; }
.btn.speaking {
  background: rgba(110,168,254,.2);
  border-color: var(--accent);
}

.icon-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
}
.icon-btn:active { background: var(--bg-3); }

.brand {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.muted { color: var(--muted); }

.badge {
  flex: 0 0 auto;
  min-width: 1.35rem;
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  background: rgba(255,255,255,.05);
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 0.65rem 0.7rem;
  cursor: pointer;
  min-height: 42px;
}
.nav-item-secondary {
  opacity: 0.92;
}
.nav-item-secondary[data-view="starred"] {
  margin-top: 0.55rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
}
.coming-soon-panel {
  padding: 2rem 1.25rem;
  text-align: center;
  max-width: 28rem;
  margin: 0 auto;
}
.coming-soon-title {
  font-size: 1.35rem;
  font-weight: 650;
  margin-bottom: 0.35rem;
}
.coming-soon-sub {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 0.75rem;
}
.coming-soon-body {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
  margin: 0;
  word-break: break-word;
}
.books-toolbar {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem 1rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
.books-disclaimer {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
  word-break: break-word;
}
.books-add {
  justify-self: start;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.books-list {
  display: grid;
  gap: 0;
}
.book-row {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  border-bottom: 1px solid var(--border);
  padding: 0.25rem 0.5rem 0.25rem 0;
}
.book-open {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 0.75rem 0.75rem;
  cursor: pointer;
  min-height: 56px;
}
.book-title {
  display: block;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.book-meta {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.85rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.book-delete {
  align-self: center;
  flex: 0 0 auto;
}
.nav-item-label {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-kind {
  display: inline;
  margin-right: 0.35rem;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  background: transparent;
  vertical-align: baseline;
}
.nav-kind::after {
  content: " ·";
  color: var(--muted);
}
.item-kind {
  display: inline;
  margin-right: 0.35rem;
  font-size: 0.75em;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}
.item-kind::after {
  content: " · ";
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}
.nav-item.podcast .nav-item-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.nav-item.podcast .nav-kind {
  flex: 0 0 auto;
}
.nav-item.podcast .nav-item-text {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podcast-folder-tabs {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 0 0 auto;
}
.podcast-folder-tabs .btn {
  min-height: 40px;
  padding: 0.35rem 0.65rem;
}
.podcast-folder-tabs .btn.active {
  background: rgba(110,168,254,.18);
  color: #fff;
}
.unread-order-tabs {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  max-width: none;
}
.unread-order-tabs .btn {
  min-height: 40px;
  min-width: 0;
  padding: 0.35rem 0.4rem;
  font-size: 0.8rem;
}
.unread-order-tabs .btn.active {
  background: rgba(110,168,254,.18);
  color: #fff;
}
#btn-play-all.playing {
  font-weight: 600;
}

.podcast-player {
  margin: 0 0 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.podcast-player-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
.podcast-player-art {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg-3);
}
.podcast-player-main {
  flex: 1 1 auto;
  min-width: 0;
}
.podcast-player audio {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 44px;
}
.podcast-player-meta {
  margin-top: 0.45rem;
  font-size: 0.8rem;
  word-break: break-word;
}

.nav-item:hover,
.nav-item:active { background: var(--bg-3); }
.nav-item.active { background: rgba(110,168,254,.15); color: #fff; }

.nav-section-title {
  margin-top: 0.65rem;
  margin-bottom: 0.2rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.side-link {
  float: right;
  font-size: 0.75rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--accent);
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  flex: 0 0 auto;
}
.pane-header h2 {
  margin: 0;
  font-size: 1rem;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pane-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
  min-width: 0;
}
.pane-header .icon-btn {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  min-height: 40px;
}
.pane-header #btn-clear-archive {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

.article-list {
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.article-row {
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 0.9rem 1rem;
  cursor: pointer;
}
.article-row:hover,
.article-row:active { background: rgba(255,255,255,.04); }
.article-row.active { background: rgba(110,168,254,.12); }
.article-row.read .article-title { color: var(--muted); font-weight: 500; }
.article-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
  min-width: 0;
}
.article-feed {
  font-size: 0.75rem;
  color: var(--accent);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.article-star {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 0.8rem;
  line-height: 1;
}
.article-date {
  flex: 0 0 auto;
  font-size: 0.68rem;
  line-height: 1.2;
  color: var(--muted);
  background: rgba(255,255,255,.06);
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  white-space: nowrap;
}
.article-pills {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  min-width: 0;
  max-width: 100%;
}
.article-reading {
  opacity: 0.92;
}
.article-listen {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}
.article-archived {
  max-width: min(11rem, 42vw);
  overflow: hidden;
  text-overflow: ellipsis;
}
.article-title {
  font-weight: 650;
  line-height: 1.35;
  margin-bottom: 0.25rem;
  font-size: 0.98rem;
}
.article-snip {
  font-size: 0.86rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.reader-empty {
  margin: auto;
  color: var(--muted);
  padding: 2rem 1rem;
  text-align: center;
}
.reader-article {
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.reader-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
}
.reader-header h1 {
  margin: 0 0 0.8rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
}
.reader-body {
  font-size: 1.05rem;
  line-height: 1.65;
  max-width: 46rem;
}

.listen-panel {
  max-width: 46rem;
  margin-bottom: 1rem;
}
.listen-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}
.listen-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.listen-body {
  font-size: 1.05rem;
  line-height: 1.65;
}
.listen-chunk {
  padding: 0.65rem 0.75rem;
  margin: 0 0 0.5rem;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  min-height: 44px;
  color: inherit;
}
.listen-chunk.listen-active {
  /* Soft paragraph cue; sentence mark carries the follow-along. */
  border-color: transparent;
  background: transparent;
}
.listen-chunk.listen-active.listen-active-fallback {
  background: rgba(255, 235, 59, 0.28);
}
.listen-sentence-mark {
  background: rgba(255, 235, 59, 0.42);
  color: inherit;
  border-radius: 2px;
  padding: 0 0.05em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.listen-body img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}
.listen-figure {
  margin: 0 0 0.75rem;
}
.reader-body img,
.reader-body figure,
.reader-body picture {
  max-width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}
.reader-body figure {
  margin: 0 0 1rem;
}
.reader-body figure img {
  display: block;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}
.reader-body a { word-break: break-word; }
.reader-body p { margin: 0 0 1rem; }
.reader-body .yt-embed,
.reader-body .video-embed {
  position: relative;
  width: 100%;
  max-width: 46rem;
  aspect-ratio: 16 / 9;
  margin: 0 0 1rem;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}
.reader-body .yt-embed iframe,
.reader-body .video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.reader-body .content-fallback {
  margin-top: 1.2rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--muted);
}
.reader-body pre, .reader-body code {
  background: var(--bg-3);
  border-radius: 6px;
}
.reader-body pre { padding: 0.8rem; overflow: auto; }

.voice-details {
  margin: 0 0 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-2);
  padding: 0.15rem 0.75rem 0.55rem;
}
.voice-details summary {
  cursor: pointer;
  padding: 0.55rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.voice-hint {
  margin: 0.35rem 0 0.25rem;
  font-size: 0.8rem;
  line-height: 1.4;
}
.engine-row select { width: 100%; }

.toast {
  position: fixed;
  z-index: 200;
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 0.8rem 1rem;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}

/* Auth / settings shared */
.auth-page {
  min-height: 100%;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background:
    radial-gradient(900px 400px at 20% -10%, rgba(110,168,254,.18), transparent),
    var(--bg);
}
.auth-card {
  width: min(420px, 100%);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.4rem;
}
.stack { display: grid; gap: 0.9rem; margin-top: 1rem; }
label { display: grid; gap: 0.35rem; font-size: 0.9rem; color: var(--muted); }
input, select {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.alert {
  margin: 0.8rem 0;
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.alert.error { border-color: rgba(255,107,107,.4); background: rgba(255,107,107,.08); }
.alert.ok { border-color: rgba(61,214,140,.4); background: rgba(61,214,140,.08); }

.settings-page { min-height: 100%; overflow: auto; background: var(--bg); }
.settings-head {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.settings-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
  padding: calc(0.6rem + var(--safe-top)) 0.75rem 0.5rem;
}
.settings-back {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}
.settings-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
}
.wide-only { display: none; }

/* Sectieschakelaar: op een telefoon vier tikdoelen i.p.v. eindeloos scrollen */
.settings-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.25rem;
  padding: 0 0.5rem 0.5rem;
}
.settings-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-height: 44px;
  padding: 0 0.3rem;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  font-size: clamp(0.72rem, 3vw, 0.85rem);
  font-weight: 600;
  min-width: 0;
}
.settings-tab .settings-tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settings-tab[aria-current="page"] {
  background: rgba(110,168,254,.15);
  border-color: rgba(110,168,254,.35);
  color: #fff;
}
.tab-count {
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255,255,255,.07);
  border-radius: 999px;
  padding: 0.05rem 0.35rem;
}
.settings-wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 1rem 1rem calc(2rem + var(--safe-bottom));
  display: grid;
  gap: 1rem;
}
.settings-panel {
  display: grid;
  gap: 1rem;
  scroll-margin-top: 7rem;
}
/* Met JS staat er ??n sectie open; zonder JS blijft de hele pagina bruikbaar. */
html.js .settings-panel:not(.is-active) { display: none; }
.js-only { display: none !important; }
html.js .js-only { display: block !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.settings-account-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .settings-account-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  .wide-only { display: inline; }
  .settings-bar { padding: calc(0.75rem + var(--safe-top)) 1rem 0.6rem; }
  .settings-title { font-size: 1rem; }
  /* Tabs krijgen op bredere schermen hun natuurlijke breedte */
  .settings-tabs {
    grid-template-columns: none;
    grid-auto-flow: column;
    justify-content: start;
    gap: 0.35rem;
    padding: 0 1rem 0.6rem;
  }
  .settings-tab { padding: 0 0.9rem; }
}
.settings-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
}
.settings-card h2 { margin: 0 0 0.9rem; font-size: 1.05rem; }
.settings-card h2 .count-note { font-size: 0.78rem; font-weight: 400; }
.settings-subhead {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

/* Inklapbaar "toevoegen"-blok: de lijst blijft bovenaan bereikbaar */
.settings-add { padding: 0; }
.settings-add > summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 52px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.settings-add > summary::-webkit-details-marker { display: none; }
.settings-add > summary::before {
  content: '+';
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(110,168,254,.15);
  color: var(--accent);
  font-weight: 700;
  line-height: 1;
}
.settings-add[open] > summary::before { content: '?'; }
.settings-add-body { padding: 0 1rem 1rem; }
.settings-add-body .stack { margin-top: 0; }

/* Korte hulptekstjes onder velden */
.form-note {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
}
.form-note:empty { display: none; }
.form-details {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-3);
  padding: 0 0.75rem;
}
.form-details > summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
}
.form-details > p { padding-bottom: 0.65rem; }

/* Feed/sitelogin bewerken gebeurt in de rij zelf */
.inline-edit-row > td {
  padding: 0 !important;
  background: rgba(110,168,254,.05);
}
.settings-form.is-inline {
  margin: 0;
  padding: 0.85rem;
  border-left: 3px solid var(--accent);
}
.feed-table tr.is-editing > td,
.settings-table tr.is-editing > td { background: rgba(110,168,254,.06); }
.is-filtered { display: none !important; }
.feed-filter { margin: 0 0 0.75rem; }
.feed-filter input { min-height: 44px; }

/* Cookiestatus in de sitelogin-lijst */
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  white-space: nowrap;
}
.status-dot::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--muted);
}
.status-ok { color: var(--ok); }
.status-ok::before { background: var(--ok); }
.status-err { color: var(--danger); }
.status-err::before { background: var(--danger); }
.status-muted { color: var(--muted); }
.settings-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.settings-table th,
.settings-table td {
  padding: 0.45rem 0.35rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.settings-table tr.is-editing td { background: rgba(110,168,254,.06); }
.meta-hint {
  margin: -0.35rem 0 0;
  min-height: 1.2em;
  font-size: 0.8rem;
  line-height: 1.35;
}
.meta-hint.meta-hint-error { color: var(--danger); }
.feed-discover-actions {
  margin: -0.15rem 0 0.15rem;
}
.feed-discover {
  margin: 0.15rem 0 0.35rem;
}
.feed-discover-list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 100%;
}
.feed-discover-list li { margin: 0; padding: 0; max-width: 100%; }
.feed-discover-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-2, var(--bg));
  color: var(--text);
  cursor: pointer;
  word-break: break-word;
}
.feed-discover-item:hover,
.feed-discover-item:focus-visible {
  border-color: var(--accent, #6ea8fe);
  outline: none;
}
.feed-discover-item.is-selected {
  border-color: var(--accent, #6ea8fe);
  box-shadow: inset 0 0 0 1px var(--accent, #6ea8fe);
}
.feed-discover-title {
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.3;
}
.feed-discover-meta {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.35;
}
.feed-discover-url {
  font-size: 0.72rem;
  color: var(--muted);
  word-break: break-all;
  line-height: 1.35;
  max-width: 100%;
}
textarea {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.4;
  resize: vertical;
  min-height: 8rem;
}
.feed-table-wrap { overflow: auto; }
.feed-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.feed-table .cell-open { white-space: nowrap; }
.feed-table .open-count { font-variant-numeric: tabular-nums; }
.feed-table .open-total { font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-top: 0.45rem;
}
.settings-account-grid .row-actions { margin-top: 0; }
.inline-form { display: inline; }
.pill {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(110,168,254,.15);
  color: var(--accent);
}
.pill-muted {
  background: rgba(154,163,181,.18);
  color: var(--muted);
}
.err-text { color: var(--danger); }
.err-detail {
  margin-top: 0.25rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
  max-width: 36rem;
  word-break: break-word;
}
.ok-text { color: var(--ok); }
.danger-text { color: var(--danger) !important; }
.checkbox-line {
  display: flex !important;
  align-items: center;
  gap: 0.55rem;
  color: var(--text) !important;
}
.checkbox-line input { width: auto; }
.feed-active-toggle {
  display: inline-flex;
  align-items: center;
  margin: 0;
}
.feed-active-label {
  min-height: 44px;
  padding: 0 0.35rem;
  font-size: 0.85rem;
  margin: 0;
}
.cred-mode {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-3);
}
.cred-mode .checkbox-line { font-size: 0.9rem; }
.cred-preview {
  margin-top: 0.2rem;
  font-size: 0.75rem;
  color: var(--muted);
}
#cred-auth-cookie {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  word-break: break-all;
}

/* =========================
   PHONE / SMALL TABLET
   ========================= */
@media (max-width: 899.98px) {
  html, body { overflow: hidden; height: 100%; }

  .desktop-only { display: none !important; }
  .mobile-only { display: flex; }

  .app {
    height: 100dvh;
    max-height: 100dvh;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
  }

  .topbar {
    flex: 0 0 auto;
    min-height: calc(56px + var(--safe-top));
    align-items: center;
    gap: 0.25rem;
    padding: var(--safe-top) 0.4rem 0.35rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-2);
    z-index: 30;
  }
  .topbar-title { flex: 1; min-width: 0; overflow: hidden; }
  .topbar-subtitle {
    font-size: 0.75rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 80;
    border: 0;
    width: 100%;
    height: 100%;
  }
  .backdrop[hidden] { display: none !important; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(84vw, 300px);
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: calc(0.75rem + var(--safe-top)) 0.75rem calc(0.75rem + var(--safe-bottom));
    background: var(--bg-2);
    border-right: 1px solid var(--border);
    box-shadow: 8px 0 30px rgba(0,0,0,.35);
    transform: translate3d(-105%, 0, 0);
    transition: transform .22s ease;
    overflow: auto;
  }
  .app.menu-open .sidebar { transform: translate3d(0, 0, 0); }

  .nav-views, .nav-feeds { display: grid; gap: 0.2rem; min-width: 0; }
  .sidebar-bottom {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    display: grid;
    gap: 0.35rem;
  }
  .user-line {
    font-size: 0.78rem;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .list-pane,
  .reader-pane {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: none;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
  }
  .app.screen-list .list-pane { display: flex; }
  .app.screen-reader .reader-pane { display: flex; }

  .app.screen-list #btn-back { display: none !important; }
  .app.screen-reader #btn-menu { display: none !important; }
  .app.screen-reader #btn-back { display: inline-flex !important; }
  .app.screen-reader .bottom-nav { display: none !important; }

  .reader-article { padding: 1rem 1rem 2rem; }
  .reader-header h1 { font-size: clamp(1.2rem, 5vw, 1.4rem); }
  .reader-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
    margin-bottom: 0.75rem;
  }
  .reader-actions .btn {
    width: 100%;
    text-align: center;
  }
  .reader-actions .btn.primary { grid-column: 1 / -1; }

  .voice-row {
    display: grid;
    gap: 0.4rem;
  }
  .voice-row input[type="range"] { width: 100%; padding: 0; }

  .bottom-nav {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    width: 100%;
    padding: 0.25rem 0.15rem calc(0.25rem + var(--safe-bottom));
    border-top: 1px solid var(--border);
    background: var(--bg-2);
    z-index: 20;
  }
  .bottom-item {
    border: 0;
    background: transparent;
    color: var(--muted);
    border-radius: 10px;
    padding: 0.3rem 0.05rem;
    display: grid;
    gap: 0.05rem;
    place-items: center;
    font-size: 0.58rem;
    min-height: 52px;
    min-width: 0;
    cursor: pointer;
  }
  .bottom-item span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .bottom-item.active {
    color: var(--text);
    background: rgba(110,168,254,.12);
  }
  .bottom-ico { font-size: 1rem; line-height: 1; }

  .toast {
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(64px + var(--safe-bottom) + 0.6rem);
    text-align: center;
  }
  .app.screen-reader .toast {
    bottom: calc(0.75rem + var(--safe-bottom));
  }

  .feed-table th { display: none; }
  .feed-table tr {
    display: block;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
  }
  .feed-table td {
    display: block;
    padding: 0.15rem 0;
    border: 0;
  }
  .feed-table .mono {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 0.78rem;
    color: var(--muted);
    word-break: break-all;
  }
  /* Stacked rows lose the header, so label the count inline */
  .feed-table .cell-open::before {
    content: 'Openstaand: ';
    color: var(--muted);
  }

  /* Sitelogins: zelfde behandeling, met labels uit data-label */
  .settings-table th { display: none; }
  .settings-table tr {
    display: block;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
  }
  .settings-table td {
    display: block;
    padding: 0.15rem 0;
    border: 0;
  }
  .settings-table td[data-label]:not(.row-actions)::before {
    content: attr(data-label) ': ';
    color: var(--muted);
    font-size: 0.78rem;
  }
  .settings-table td.row-actions::before { content: none; }

  /* Bewerkrij vult de volle breedte van de gestapelde rij */
  .settings-table tr.inline-edit-row,
  .feed-table tr.inline-edit-row { padding: 0; }

  /* Duimvriendelijke knoppen in lijsten */
  .settings-page .row-actions .btn { min-height: 44px; }
}

/* =========================
   DESKTOP / LARGE SCREEN
   ========================= */
@media (min-width: 900px) {
  html, body { overflow: hidden; height: 100%; }

  .mobile-only { display: none !important; }
  .desktop-only { display: flex !important; }

  .app {
    display: grid !important;
    grid-template-columns: var(--sidebar-w) var(--list-w) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "sidebar list reader";
    height: 100vh;
    width: 100%;
    overflow: hidden;
  }

  /* Force both panes visible regardless of screen-list/screen-reader */
  .app .list-pane,
  .app.screen-list .list-pane,
  .app.screen-reader .list-pane {
    display: flex !important;
    flex-direction: column;
    grid-area: list;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border-right: 1px solid var(--border);
    background: var(--bg-2);
  }

  .app .reader-pane,
  .app.screen-list .reader-pane,
  .app.screen-reader .reader-pane {
    display: flex !important;
    flex-direction: column;
    grid-area: reader;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: var(--bg);
  }

  .sidebar {
    grid-area: sidebar;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: auto !important;
    max-width: none !important;
    height: 100% !important;
    transform: none !important;
    box-shadow: none !important;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.85rem;
    background: var(--bg-2);
    border-right: 1px solid var(--border);
    overflow: auto;
  }

  .sidebar-top {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.35rem;
  }
  .nav-views, .nav-feeds { display: grid; gap: 0.2rem; min-width: 0; }
  .sidebar-bottom {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    display: grid;
    gap: 0.35rem;
  }
  .user-line {
    font-size: 0.8rem;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .reader-article { padding: 1.35rem 1.75rem 2.2rem; }
  .reader-header h1 { font-size: 1.65rem; }
  .reader-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.9rem;
  }
  .reader-actions .btn {
    width: auto;
    flex: 0 1 auto;
  }
  .reader-actions .btn.primary { grid-column: auto; }

  .voice-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.7rem;
  }
  .voice-row select { max-width: min(340px, 100%); flex: 1; }
  .voice-row input[type="range"] { width: 120px; padding: 0; }

  .toast {
    left: auto;
    right: 1rem;
    bottom: 1rem;
    max-width: 360px;
    text-align: left;
  }

  .feed-table th { display: table-cell; }
  .feed-table tr { display: table-row; padding: 0; }
  .feed-table th,
  .feed-table td {
    display: table-cell;
    text-align: left;
    padding: 0.65rem 0.4rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
  }
  .feed-table .mono {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 0.8rem;
    color: var(--muted);
    max-width: 320px;
    word-break: break-all;
  }
  .feed-table .cell-open { width: 1%; }
}

/* ?? E-paper / e-ink theme (per-device via data-theme) ?? */
html[data-theme="epaper"] {
  --bg: #f7f7f2;
  --bg-2: #ffffff;
  --bg-3: #ffffff;
  --border: #111111;
  --text: #000000;
  --muted: #222222;
  --accent: #000000;
  --accent-2: #000000;
  --danger: #000000;
  --ok: #000000;
  color-scheme: light;
}
html[data-theme="epaper"] body {
  background: var(--bg);
  color: var(--text);
}
html[data-theme="epaper"] a { color: var(--text); text-decoration: underline; }
html[data-theme="epaper"] .btn,
html[data-theme="epaper"] .icon-btn,
html[data-theme="epaper"] .nav-item,
html[data-theme="epaper"] .bottom-item,
html[data-theme="epaper"] .article-row {
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--bg-2);
  color: var(--text);
  box-shadow: none !important;
  text-shadow: none !important;
  transition: none !important;
  animation: none !important;
}
html[data-theme="epaper"] .btn.primary,
html[data-theme="epaper"] .btn.speaking {
  background: #000000;
  color: #ffffff;
  border-color: #000000;
}
html[data-theme="epaper"] .nav-kind {
  background: rgba(0, 0, 0, 0.06);
  color: var(--muted);
}
html[data-theme="epaper"] .podcast-folder-tabs .btn.active,
html[data-theme="epaper"] .unread-order-tabs .btn.active {
  background: rgba(0, 0, 0, 0.08);
  color: var(--text);
}

html[data-theme="epaper"] .nav-item.active,
html[data-theme="epaper"] .bottom-item.active,
html[data-theme="epaper"] .article-row.active {
  background: #000000;
  color: #ffffff;
  border-color: #000000;
}
html[data-theme="epaper"] .btn.ghost { background: var(--bg-2); }
html[data-theme="epaper"] .badge,
html[data-theme="epaper"] .pill {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 0;
}
html[data-theme="epaper"] .sidebar,
html[data-theme="epaper"] .topbar,
html[data-theme="epaper"] .bottom-nav,
html[data-theme="epaper"] .pane-header,
html[data-theme="epaper"] .reader-header,
html[data-theme="epaper"] .settings-bar,
html[data-theme="epaper"] .settings-card,
html[data-theme="epaper"] .toast {
  background: var(--bg-2);
  border-color: var(--border);
  box-shadow: none !important;
  backdrop-filter: none !important;
}
html[data-theme="epaper"] .toast {
  border: 2px solid #000;
  color: #000;
}
html[data-theme="epaper"] input,
html[data-theme="epaper"] select,
html[data-theme="epaper"] textarea {
  background: #fff;
  color: #000;
  border: 1px solid #000;
  border-radius: 0;
  box-shadow: none;
}
html[data-theme="epaper"] .theme-toggle .btn.active {
  background: #000;
  color: #fff;
}
html[data-theme="epaper"] * {
  transition: none !important;
  animation: none !important;
  text-shadow: none !important;
  box-shadow: none !important;
}
html[data-theme="epaper"] .reader-body img,
html[data-theme="epaper"] .reader-body iframe {
  filter: none;
  opacity: 1;
}
