/* ============ Auth + nieuwsbriefbeheer ============ */
.login-panel {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: rgba(24, 21, 15, .42);
  backdrop-filter: blur(8px);
  padding: 24px;
}
.login-panel[hidden] { display: none; }
.login-card {
  width: min(460px, 100%);
  background: var(--card, #fff);
  border: 1px solid var(--line, #e3dccf);
  border-radius: 18px;
  box-shadow: 0 24px 80px -40px rgba(24, 21, 15, .55);
  padding: 26px;
  display: grid;
  gap: 12px;
}
.login-card h1 { margin: 0; }
.compact-grid { margin: 16px 0; }
.newsletter-admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: start;
}
.newsletter-admin-grid form,
#campaign-form {
  display: grid;
  gap: 12px;
}
.newsletter-admin-grid label,
#campaign-form label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}
#campaign-sites { min-height: 130px; }
#campaign-preview-dialog {
  width: min(920px, calc(100vw - 32px));
  height: min(760px, calc(100vh - 32px));
  border: 0;
  border-radius: 18px;
  padding: 16px;
}
#campaign-preview-frame {
  width: 100%;
  height: calc(100% - 48px);
  border: 1px solid var(--line, #e3dccf);
  border-radius: 12px;
  background: #fff;
}
@media (max-width: 980px) {
  .newsletter-admin-grid { grid-template-columns: 1fr; }
}
/* ============ NieuwsOog Beheer ============ */
:root {
  --paper: #faf7f2;
  --card: #ffffff;
  --ink: #18150f;
  --ink-soft: #4f4a40;
  --ink-faint: #8a8478;
  --accent: #d6452c;
  --accent-dark: #b23519;
  --ok: #2c8a4b;
  --warn: #d9961c;
  --line: #e3dccf;
  --line-strong: #d7cbbb;
  --paper-soft: #fffdf8;
  --shadow: 0 1px 2px rgba(24,21,15,.06), 0 14px 34px -22px rgba(24,21,15,.28);
  --shadow-soft: 0 1px 1px rgba(24,21,15,.04), 0 10px 24px -20px rgba(24,21,15,.22);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", -apple-system, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(214,69,44,.08), transparent 280px),
    linear-gradient(180deg, #fffaf2 0, var(--paper) 320px);
  color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img { display: block; }
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }

/* ---- header ---- */
.bar { background: rgba(24,21,15,.98); color: var(--paper); position: sticky; top: 0; z-index: 50; box-shadow: 0 1px 0 rgba(250,247,242,.08), 0 16px 38px -30px rgba(0,0,0,.8); }
.bar-inner { max-width: 1280px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 22px; min-height: 58px; }
.brand { display: flex; align-items: center; gap: 9px; color: #ff6a4d; font-family: var(--serif); font-weight: 900; font-size: 21px; letter-spacing: .03em; }
.brand span { color: var(--paper); }
.brand em { font-style: italic; font-weight: 700; color: #ff6a4d; }
.brand-blocks { display: inline-flex; align-items: stretch; line-height: 1; font-size: 14px; }
.bb {
  font-family: var(--sans, Inter, sans-serif); font-weight: 800; letter-spacing: .02em;
  color: #faf7f2; padding: .3em .34em .26em; display: inline-flex; align-items: center;
}
.bb-nieuws { background: #18150f; box-shadow: inset 0 0 0 1px rgba(250,247,242,.35); }
.bb-oog { background: #d6452c; }
.bb-eye { height: .68em; width: 1.12em; margin: 0 .05em; flex-shrink: 0; }
.tabs { display: flex; gap: 6px; flex: 1; align-self: stretch; align-items: center; }
.tabs a { padding: 17px 12px 15px; font-weight: 800; font-size: 13.5px; color: #c9c2b4; border-bottom: 3px solid transparent; border-radius: 8px 8px 0 0; }
.tabs a.active { color: #fff; border-bottom-color: var(--accent); }
.tabs a:hover { color: #fff; background: rgba(250,247,242,.05); }
.nav-menu { position: relative; display: inline-flex; align-self: stretch; align-items: center; }
.nav-menu-btn {
  border: 0; background: transparent; color: #c9c2b4; padding: 17px 14px;
  border-bottom: 3px solid transparent; cursor: pointer; font-weight: 800; font-size: 13.5px; border-radius: 8px 8px 0 0;
}
.nav-menu-btn.active, .nav-menu:hover .nav-menu-btn, .nav-menu.open .nav-menu-btn { color: #fff; border-bottom-color: var(--accent); }
.nav-menu-list {
  position: absolute; top: calc(100% - 1px); left: 0; min-width: 184px; display: none; padding: 8px;
  background: #211d16; border: 1px solid rgba(250,247,242,.16); border-radius: 0 0 12px 12px;
  box-shadow: 0 20px 42px -18px rgba(0,0,0,.65);
}
.nav-menu:hover .nav-menu-list, .nav-menu:focus-within .nav-menu-list, .nav-menu.open .nav-menu-list { display: grid; }
.nav-menu-list a { padding: 10px 12px; border-bottom: 0; border-radius: 8px; }
.nav-menu-list a.active, .nav-menu-list a:hover { background: rgba(250,247,242,.08); color: #fff; }
.bar-actions { display: flex; align-items: center; gap: 14px; }
.totals { font-size: 12.5px; color: #c9c2b4; }

/* ---- layout ---- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 34px 22px 74px; }
h1 { font-family: var(--serif); font-weight: 900; font-size: 32px; line-height: 1.08; margin: 0 0 7px; letter-spacing: -.01em; }
.sub { color: var(--ink-faint); margin: 0 0 24px; max-width: 70ch; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.page-head .sub { margin-bottom: 0; }
.page-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 22px; }
.dashboard-card { cursor: pointer; transition: transform .12s, border-color .12s; }
.dashboard-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 38%, var(--line)); }
.dashboard-card .btn-small { align-self: flex-start; margin-top: 6px; }
.dashboard-panels { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .85fr); gap: 20px; }
.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.action-tile { text-align: left; border: 1px solid var(--line); background: #fbf8f1; color: var(--ink); border-radius: 10px; padding: 12px 13px; cursor: pointer; display: grid; gap: 3px; }
.action-tile:hover { border-color: var(--accent); color: var(--accent-dark); }
.action-tile b { font-size: 13.5px; }
.action-tile span { color: var(--ink-faint); font-size: 12.5px; }
.activity-list { display: grid; gap: 8px; }
.activity-item { display: flex; gap: 8px; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 8px; font-size: 12.5px; color: var(--ink-soft); }
.activity-item:last-child { border-bottom: 0; padding-bottom: 0; }
.settings-jumps { align-self: center; }
.settings-section { scroll-margin-top: 76px; margin-top: 0; padding-top: 0; border-top: 0; }
body[data-admin-tab="instellingen"] .settings-section { margin-top: 30px; padding-top: 26px; border-top: 1px solid var(--line); }
.settings-section .page-head { margin-bottom: 16px; }

/* ---- buttons & forms ---- */
.btn {
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; font-weight: 700; font-size: 13.5px; padding: 8px 14px;
  border-radius: 9px; cursor: pointer; white-space: nowrap;
  min-height: 40px; display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 0 rgba(24,21,15,.04);
}
.btn:hover { border-color: var(--ink); transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: wait; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-icon { padding: 6px 9px; font-size: 14px; min-width: 40px; }
.btn-danger:hover { border-color: var(--accent); color: var(--accent); }
.link-btn { border: 0; background: transparent; padding: 0; color: inherit; font: inherit; font-weight: 800; cursor: pointer; text-align: left; }
.link-btn:hover { color: var(--accent-dark); text-decoration: underline; }

input, select {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--card);
  border: 1.5px solid var(--line); border-radius: 9px; padding: 8px 12px;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
textarea { font: inherit; font-size: 13px; color: var(--ink); background: var(--card); border: 1.5px solid var(--line); border-radius: 8px; padding: 8px 12px; resize: vertical; min-height: 80px; }
textarea:focus { outline: none; border-color: var(--accent); }
.inline-field { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); font-size: 13px; font-weight: 700; white-space: nowrap; }
.inline-field input { width: 74px; padding: 7px 8px; }

.add-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; background: rgba(255,255,255,.86); border: 1px solid rgba(227,220,207,.8); border-radius: 14px; box-shadow: var(--shadow-soft); padding: 14px 16px; }
.add-form input[type="url"] { flex: 2; min-width: 260px; }
.add-form input[type="text"] { flex: 1; min-width: 150px; }
.interval-label { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ink-soft); white-space: nowrap; }
.interval-label input { width: 64px; text-align: center; }
.msg { font-size: 13.5px; font-weight: 700; margin: 12px 0 18px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper-soft); display: inline-flex; max-width: 100%; }
.msg.ok { color: var(--ok); border-color: #c9e8d3; background: #f0faf3; }
.msg.err { color: var(--accent-dark); border-color: #f1c8bd; background: #fff2ee; }
.is-loading { opacity: .72; transition: opacity .12s ease; }
.is-loading .more { pointer-events: none; }

/* ---- feeds table ---- */
.table-scroll { overflow-x: auto; margin-top: 22px; background: rgba(255,255,255,.92); border: 1px solid rgba(227,220,207,.72); border-radius: 14px; box-shadow: var(--shadow-soft); }
.feeds-table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.feeds-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); padding: 13px 14px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; background: #fffdf9; }
.feeds-table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.feeds-table tbody tr:hover { background: #fffaf2; }
.feeds-table tr:last-child td { border-bottom: 0; }
.feeds-table .num { text-align: right; }
.feed-source { font-weight: 700; }
.feed-title { color: var(--ink-faint); font-size: 12px; display: block; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-url { color: var(--ink-faint); font-size: 12px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.feed-url:hover { color: var(--accent); }
.badge { display: inline-block; font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.badge.ok { background: #e3f2e8; color: var(--ok); }
.badge.err { background: #fbe7e2; color: var(--accent-dark); cursor: help; max-width: 180px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.badge.off { background: var(--line); color: var(--ink-faint); }
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; }
.interval-cell input { width: 56px; text-align: center; padding: 5px 6px; font-size: 13px; }
.category-cell select, .subcategory-cell select { max-width: 150px; padding: 5px 8px; font-size: 13px; }
.muted { color: var(--ink-faint); font-size: 12.5px; white-space: nowrap; }

/* ---- articles ---- */
.article-filter-panel {
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(227,220,207,.72);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  padding: 12px;
  margin-bottom: 14px;
}
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.article-filter-panel .filters { margin-bottom: 0; }
.article-filters-main { align-items: stretch; }
.filters input[type="search"] { flex: 1; min-width: 240px; }
.filters select { max-width: 190px; padding: 7px 10px; font-size: 13px; }
.advanced-filters {
  margin-top: 10px !important;
  padding-top: 10px;
  border-top: 1px dashed var(--line-strong);
}
.count { color: var(--ink-faint); font-size: 13px; margin-left: auto; }
.view-toggle { display: inline-flex; gap: 4px; background: var(--line); border-radius: 10px; padding: 3px; }
.btn-toggle { border: 0; background: transparent; padding: 6px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-toggle.active { background: var(--card); color: var(--accent); box-shadow: 0 1px 3px rgba(24,21,15,.12); }
.quick-filters, .smart-summary { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -8px 0 16px; }
.btn-quick { padding: 5px 10px; font-size: 12px; border-radius: 999px; }
.btn-quick.active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.smart-summary { margin-top: -6px; }
.smart-chip { border: 1px solid var(--line); background: var(--card); color: var(--ink-soft); border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 700; }
.smart-chip b { color: var(--ink); }
.smart-chip.muted { color: var(--ink-faint); }
.smart-action { cursor: pointer; font: inherit; }
.smart-action:hover { border-color: var(--accent); color: var(--accent); }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: -8px 0 18px; }
.filter-chip { border: 1px solid var(--line); background: var(--card); color: var(--ink-soft); border-radius: 999px; padding: 5px 9px; display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 12px; cursor: pointer; }
.filter-chip:hover { border-color: var(--accent); color: var(--accent-dark); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.acard { background: rgba(255,255,255,.94); border: 1px solid rgba(227,220,207,.7); border-radius: 14px; box-shadow: var(--shadow-soft); overflow: hidden; cursor: pointer; transition: transform .12s, box-shadow .12s; display: flex; flex-direction: column; }
.acard:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.acard-img { aspect-ratio: 16/9; background: #f1ece3; position: relative; }
.acard-img img { width: 100%; height: 100%; object-fit: cover; }
.acard-img .noimg { display: grid; place-items: center; height: 100%; color: var(--accent); opacity: .45; font-size: 30px; }
.img-flag { position: absolute; right: 8px; bottom: 8px; font-size: 10px; font-weight: 800; letter-spacing: .05em; padding: 2px 7px; border-radius: 5px; background: rgba(24,21,15,.78); color: #fff; }
.img-flag.stored { background: var(--ok); }
.acard-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.acard-body h3 { font-family: var(--serif); font-size: 15.5px; font-weight: 700; line-height: 1.3; margin: 0; flex: 1; }
.acard-meta { font-size: 12px; color: var(--ink-faint); }
.acard-meta b { color: var(--ink-soft); }
.kicker { color: var(--accent); font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.tag-chip { display: inline-block; font-size: 10.5px; font-weight: 800; padding: 2px 7px; border-radius: 999px; background: #f1ece3; color: var(--ink-soft); white-space: nowrap; }
.tag-chip.story { background: #eaf1fb; color: #225a9a; }
.more { display: block; margin: 28px auto 0; padding: 10px 32px; border-radius: 999px; }
.action-toolbar { align-items: stretch; }
.toolbar-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px;
  border: 1px solid rgba(227,220,207,.75);
  border-radius: 12px;
  background: rgba(255,255,255,.62);
}
.empty {
  text-align: center; color: var(--ink-faint); padding: 28px 24px; margin: 20px auto;
  max-width: 520px; border: 1px dashed var(--line-strong); border-radius: 16px; background: rgba(255,255,255,.52);
}
.article-table-wrap { overflow-x: auto; background: rgba(255,255,255,.92); border: 1px solid rgba(227,220,207,.72); border-radius: 14px; box-shadow: var(--shadow-soft); }
.articles-table { border-collapse: collapse; width: 100%; font-size: 12.5px; min-width: 900px; }
.articles-table th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); padding: 9px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; background: #fffdf9; }
.articles-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.articles-table tr:last-child td { border-bottom: 0; }
.article-row { cursor: pointer; }
.article-row:hover { background: #fffaf3; }
.article-title { display: block; max-width: 520px; font-family: var(--serif); font-size: 14px; line-height: 1.2; margin: 1px 0 3px; }
.article-id, .article-sub, .article-time { display: block; color: var(--ink-faint); font-size: 11.5px; }
.article-time { white-space: nowrap; }
.article-time b { color: var(--ink-soft); font-weight: 700; }
.status-stack, .modal-status { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.status-stack { max-width: 220px; gap: 4px; }
.status-pill { display: inline-block; font-size: 10.5px; font-weight: 800; padding: 2px 6px; border-radius: 999px; white-space: nowrap; }
.status-pill.ok { background: #e3f2e8; color: var(--ok); }
.status-pill.warn { background: #fff1d4; color: #8a5a00; }
.status-pill.err { background: #fbe7e2; color: var(--accent-dark); max-width: 190px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.status-pill.off { background: var(--line); color: var(--ink-faint); }
.articles-table .cell-actions { justify-content: flex-start; }
.db-fields, .db-detail-grid { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; max-width: 240px; }
.db-chip { display: inline-block; font-size: 10px; font-weight: 800; line-height: 1; padding: 3px 5px; border-radius: 5px; white-space: nowrap; }
.db-chip.present { background: #edf7ef; color: var(--ok); }
.db-chip.missing { background: #fbe7e2; color: var(--accent-dark); text-decoration: line-through; }
.db-detail { margin: 2px 0 12px; padding: 10px 12px; background: #fbf8f1; border: 1px solid var(--line); border-radius: 10px; }
.db-detail h3 { font-size: 12px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); }
.db-detail-grid { max-width: none; gap: 5px; }
.db-missing { margin: 8px 0 0; font-size: 12px; color: var(--ink-faint); }
.story-source-detail { margin: 2px 0 12px; padding: 10px 12px; background: #f7fbff; border: 1px solid #d7e5f5; border-radius: 10px; }
.story-source-detail h3 { font-size: 12px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .08em; color: #4e759e; }
.story-source-list { display: grid; gap: 6px; }
.story-source-link {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  border: 1px solid #d7e5f5; border-radius: 8px; background: #fff; padding: 7px 9px;
}
.story-source-link:hover { border-color: var(--accent); color: var(--accent); }
.story-source-link.off { color: var(--ink-faint); }
.story-source-name { font-weight: 800; }
.story-source-title { color: var(--ink-faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- crawler ---- */
.crawler-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 18px; }
.crawler-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin: 0 0 22px; }
.crawler-card {
  background: rgba(255,255,255,.94); border: 1px solid rgba(227,220,207,.72); border-radius: 14px; box-shadow: var(--shadow-soft);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-height: 110px;
}
.crawler-card-title { color: var(--ink-faint); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.crawler-card strong { font-family: var(--serif); font-size: 25px; line-height: 1.1; }
.crawler-card span:last-child { color: var(--ink-faint); font-size: 12.5px; }
.crawler-card.ok { border-top: 4px solid var(--ok); }
.crawler-card.warn { border-top: 4px solid var(--warn); }
.crawler-card.err { border-top: 4px solid var(--accent); }
.crawler-card.off { border-top: 4px solid var(--line); }
.story-ai-summary, .story-ai-image, .story-ai-output { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fbf8f1; margin: 18px 0; }
.story-ai-summary h3, .story-ai-image h3, .story-ai-output h3 { margin-top: 0; }
.story-ai-image img, .story-ai-output img { border-radius: 10px; display: block; margin-top: 8px; max-width: 100%; }
.story-ai-field { margin-top: 14px; }
.story-ai-field h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }
.story-ai-prompt { margin-top: 10px; }
.story-ai-prompt summary { cursor: pointer; color: var(--ink-faint); font-size: 12px; font-weight: 700; }
.story-ai-prompt pre { margin: 8px 0 0; padding: 10px 12px; border-radius: 8px; background: #fff; border: 1px solid var(--line); white-space: pre-wrap; font-size: 12px; line-height: 1.45; max-height: 220px; overflow: auto; }
#story-ai-queue tr[data-story-id], #story-ai-runs tr[data-story-id] { cursor: pointer; }
.crawler-debug-panel {
  background: rgba(255,255,255,.9); border: 1px solid rgba(227,220,207,.72); border-radius: 14px; box-shadow: var(--shadow-soft);
  padding: 14px 16px; margin: 0 0 22px;
}
.crawler-debug-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.debug-group { background: #fbf8f1; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.debug-group h3 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); }
.debug-chips, .debug-status-line, .debug-links, .debug-meta { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.debug-chip {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 999px;
  padding: 3px 8px; font-size: 11px; font-weight: 800; background: var(--line); color: var(--ink-faint);
}
.debug-chip.ok { background: #e3f2e8; color: var(--ok); }
.debug-chip.warn { background: #fff1d4; color: #8a5a00; }
.debug-chip.err { background: #fbe7e2; color: var(--accent-dark); }
.debug-chip.off { background: var(--line); color: var(--ink-faint); }
.debug-status-line { margin: 5px 0; max-width: 300px; }
.debug-meta { color: var(--ink-faint); font-size: 11.5px; margin: 4px 0; }
.debug-meta span:not(:last-child)::after { content: "·"; margin-left: 5px; color: var(--line); }
.debug-note { margin: 5px 0; color: var(--ink-faint); font-size: 11.5px; line-height: 1.35; white-space: normal; max-width: 360px; }
.debug-note.ok { color: var(--ok); }
.debug-note.err { color: var(--accent-dark); }
.debug-links { margin-top: 5px; }
.debug-links a, .btn-copy {
  font: inherit; font-size: 10.5px; font-weight: 800; border: 1px solid var(--line);
  background: #fff; color: var(--ink-soft); border-radius: 999px; padding: 2px 7px;
}
.debug-links a:hover, .btn-copy:hover { border-color: var(--accent); color: var(--accent); }
.btn-copy { cursor: pointer; }
.debug-details { margin-top: 8px; }
.debug-details summary { cursor: pointer; font-weight: 800; font-size: 12.5px; color: var(--ink-soft); }
.debug-json {
  margin: 8px 0 0; padding: 10px 12px; max-height: 360px; overflow: auto;
  background: #18150f; color: #faf7f2; border-radius: 8px; font-size: 11.5px; line-height: 1.45;
}
.domain-quality-table { min-width: 980px; }
.domain-quality-row.ok td:first-child { border-left: 4px solid var(--ok); }
.domain-quality-row.warn td:first-child { border-left: 4px solid #d9961c; }
.domain-quality-row.err td:first-child { border-left: 4px solid var(--accent); }
.domain-quality-row.off td:first-child { border-left: 4px solid var(--line); }
.domain-name { display: block; font-family: var(--serif); font-size: 14.5px; line-height: 1.2; margin-bottom: 3px; }
.domain-quality-head { margin-top: 18px; }
.crawler-panels { display: grid; gap: 22px; }
.crawler-panel { background: transparent; }
.panel-head { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin: 0 0 10px; }
.panel-head h2 { font-family: var(--serif); font-weight: 900; font-size: 20px; margin: 0; }
.table-scroll.compact { margin-top: 0; }
.crawler-table th, .crawler-table td { font-size: 12.5px; }
.crawler-table .article-title { max-width: 420px; }
.compact-empty { padding: 18px 0; }
.err-text { color: var(--accent-dark); font-weight: 700; }

/* ---- extension rules ---- */
.extension-layout { display: grid; grid-template-columns: minmax(300px, .8fr) minmax(420px, 1.2fr); gap: 20px; align-items: start; }
.rule-list { display: grid; gap: 8px; }
.rule-card { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.92); color: var(--ink); padding: 10px 12px; text-align: left; cursor: pointer; }
.rule-card:hover, .rule-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(214,69,44,.08); }
.rule-card b { display: block; font-size: 14px; }
.rule-card small { display: block; margin-top: 2px; color: var(--ink-faint); font-size: 11.5px; }
.rule-editor { display: grid; gap: 12px; }
.rule-editor label:not(.checkline) { display: grid; gap: 5px; color: var(--ink-soft); font-size: 12.5px; font-weight: 800; }
.rule-editor textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.checkline { display: inline-flex; gap: 8px; align-items: center; font-weight: 800; color: var(--ink-soft); }
.rule-editor-panel { position: sticky; top: 78px; }

/* ---- analytics ---- */
.analytics-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }
.analytics-card { display: grid; gap: 12px; margin: 0; }
.analytics-field { display: grid; gap: 6px; color: var(--ink-soft); font-size: 12.5px; font-weight: 800; }
.analytics-field textarea { min-height: 118px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.analytics-slot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.analytics-slot-grid label { display: grid; gap: 4px; }

/* ---- analytics stats dashboard ---- */
.analytics-stats-panel { margin: 0 0 28px; }
.analytics-config-head { margin: 28px 0 14px; font-size: 18px; }
.stat-table-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }
.stat-table-card { display: grid; gap: 10px; background: var(--card, #fff); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat-table-card h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }
.stat-table-card .feeds-table { font-size: 12.5px; }
.stat-table-card .feeds-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- category lists ---- */
.lists-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; max-width: 780px; }
.list-panel { background: rgba(255,255,255,.92); border: 1px solid rgba(227,220,207,.72); border-radius: 14px; box-shadow: var(--shadow-soft); padding: 18px 20px; align-self: start; }
.list-panel h2 { font-family: var(--serif); font-weight: 900; font-size: 19px; margin: 0 0 14px; }
.list-add { display: flex; gap: 8px; margin-bottom: 12px; }
.list-add input { flex: 1; min-width: 0; }
.list-items { list-style: none; margin: 0; padding: 0; }
.list-items li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.list-items li:last-child { border-bottom: 0; }
.list-items input { flex: 1; min-width: 0; padding: 5px 9px; font-size: 13.5px; border-color: transparent; background: transparent; }
.list-items input:hover, .list-items input:focus { border-color: var(--line); background: var(--card); }
.list-items input:focus { border-color: var(--accent); }
.list-count { font-size: 12px; color: var(--ink-faint); white-space: nowrap; }
.list-empty { padding: 18px 0 6px; }

/* ---- modal ---- */
dialog { border: 0; border-radius: 14px; padding: 0; max-width: 640px; width: calc(100vw - 40px); box-shadow: 0 24px 80px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(24,21,15,.45); }
#modal-body { padding: 0 0 22px; }
#modal-body img.hero { width: 100%; max-height: 320px; object-fit: cover; }
#modal-body .inner { padding: 18px 24px 0; }
#modal-body h2 { font-family: var(--serif); font-size: 22px; line-height: 1.2; margin: 8px 0 10px; }
#modal-body .meta-row { font-size: 12.5px; color: var(--ink-faint); margin-bottom: 12px; }
#modal-body .modal-status { margin: 0 0 10px; }
#modal-body p.sumtext { font-size: 14.5px; color: var(--ink-soft); }
#modal-body .modal-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.tag-editor { margin: 2px 0 12px; padding: 10px 12px; background: #fbf8f1; border: 1px solid var(--line); border-radius: 10px; }
.tag-editor h3 { font-size: 12px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); }
.tag-options { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tag-option { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px; background: var(--card); font-size: 12px; font-weight: 700; cursor: pointer; }
.tag-option input { margin: 0; accent-color: var(--accent); }
.crawl-timeline { margin: 2px 0 12px; padding: 10px 12px; background: #fbf8f1; border: 1px solid var(--line); border-radius: 10px; }
.crawl-timeline h3 { font-size: 12px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); }
.crawl-timeline ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.crawl-timeline li { border-left: 3px solid var(--line); padding-left: 10px; }
.crawl-timeline li:has(.status-pill.err) { border-left-color: var(--accent); }
.crawl-timeline li:has(.status-pill.warn) { border-left-color: #d9961c; }
.crawl-event-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 3px; }

.crawl-content-debug, .crawl-sources-debug { margin: 2px 0 12px; padding: 10px 12px; background: #fbf8f1; border: 1px solid var(--line); border-radius: 10px; }
.crawl-content-debug h3, .crawl-sources-debug h3 { font-size: 12px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); }
.crawl-debug-grid { display: flex; flex-wrap: wrap; gap: 5px 10px; margin-bottom: 8px; }
.crawl-debug-item { font-size: 11.5px; color: var(--ink-faint); }
.crawl-debug-item b { color: var(--ink-soft); font-weight: 800; text-transform: uppercase; letter-spacing: .04em; font-size: 10.5px; margin-right: 3px; }
.crawl-debug-item a { color: var(--accent-dark); word-break: break-all; }
.crawl-content-body {
  margin: 8px 0 0; padding: 10px; max-height: 320px; overflow: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap; word-break: break-word; color: var(--ink-soft);
}
.crawl-sources-debug details { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 6px 10px; margin-bottom: 6px; }
.crawl-sources-debug details[open] { padding-bottom: 10px; }
.crawl-sources-debug summary { cursor: pointer; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.crawl-sources-debug summary::-webkit-details-marker { color: var(--ink-faint); }
.crawl-source-name { font-weight: 800; color: var(--ink); }
.crawl-source-pills { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.crawl-source-body { margin-top: 8px; }
.crawl-source-body .crawl-content-debug, .crawl-source-body .crawl-timeline { margin: 8px 0 0; background: #fbf8f1; }

.modal-close { position: absolute; right: 10px; top: 10px; background: rgba(24,21,15,.6); color: #fff; border: 0; border-radius: 50%; width: 30px; height: 30px; font-size: 15px; cursor: pointer; }

.story-row { cursor: pointer; }
.story-row:hover { background: #fbf8f1; }
.story-members { margin-top: 12px; }
.story-members h3 { font-size: 12px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); }
.story-member { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 10px 12px; margin-bottom: 8px; display: grid; gap: 6px; }
.story-member-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.story-member .article-title { font-size: 14px; }
.story-member-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-small { padding: 4px 10px; font-size: 12.5px; border-radius: 6px; }

@media (max-width: 820px) {
  .bar-inner { height: auto; flex-wrap: wrap; padding: 10px 16px; gap: 8px 16px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { padding: 10px 12px; min-height: 40px; display: inline-flex; align-items: center; }
  .nav-menu-btn { padding: 10px 12px; min-height: 40px; }
  .nav-menu-list { position: fixed; top: 96px; left: 20px; }
  .totals { display: none; }
  .wrap { padding: 24px 16px 58px; }
  .page-head { display: grid; gap: 10px; }
  .page-actions { justify-content: flex-start; }
  .dashboard-panels, .extension-layout { grid-template-columns: 1fr; }
  .rule-editor-panel { position: static; }
  .btn-icon, .modal-close { min-width: 44px; min-height: 44px; }
  .add-form { padding: 12px; }
  .add-form input[type="url"], .add-form input[type="text"], .add-form select { flex: 1 1 100%; min-width: 0; max-width: none; width: 100%; }
  .add-form .btn { width: 100%; }
  .interval-label { flex: 1 1 auto; white-space: normal; }
  .filters select, .filters input[type="search"] { flex: 1 1 160px; max-width: none; min-width: 150px; }
  .article-filter-panel { padding: 10px; }
  .article-filters-main .view-toggle { flex: 1 1 auto; }
  .toolbar-group { flex: 1 1 100%; justify-content: flex-start; }
  .view-toggle { min-height: 44px; }
  .btn-toggle, .btn-quick { min-height: 38px; }
  .count { width: 100%; margin-left: 0; }
  .lists-grid { grid-template-columns: 1fr; max-width: none; }
  .table-scroll, .article-table-wrap { overflow: visible; }
  .feeds-table, .feeds-table thead, .feeds-table tbody, .feeds-table tr, .feeds-table th, .feeds-table td,
  .articles-table, .articles-table thead, .articles-table tbody, .articles-table tr, .articles-table th, .articles-table td,
  .crawler-table, .crawler-table thead, .crawler-table tbody, .crawler-table tr, .crawler-table th, .crawler-table td {
    display: block; min-width: 0; width: 100%;
  }
  .feeds-table thead, .articles-table thead, .crawler-table thead { display: none; }
  .feeds-table tr, .articles-table tr, .crawler-table tr {
    padding: 13px 14px; border-bottom: 1px solid var(--line);
  }
  .feeds-table tr:last-child, .articles-table tr:last-child, .crawler-table tr:last-child { border-bottom: 0; }
  .feeds-table td, .articles-table td, .crawler-table td {
    padding: 5px 0; border: 0; text-align: left;
  }
  .feeds-table td, .crawler-table td {
    display: grid; grid-template-columns: minmax(92px, 34%) minmax(0, 1fr); gap: 10px; align-items: start;
  }
  .feeds-table td::before, .crawler-table td::before {
    color: var(--ink-faint); font-size: 10px; font-weight: 800; letter-spacing: .08em;
    text-transform: uppercase; padding-top: 2px;
  }
  .feeds-table td:nth-child(1)::before { content: "Bron"; }
  .feeds-table td:nth-child(2)::before { content: "Feed"; }
  .feeds-table td:nth-child(3)::before { content: "Categorie"; }
  .feeds-table td:nth-child(4)::before { content: "Subcategorie"; }
  .feeds-table td:nth-child(5)::before { content: "Interval"; }
  .feeds-table td:nth-child(6)::before { content: "Status"; }
  .feeds-table td:nth-child(7)::before { content: "Laatste run"; }
  .feeds-table td:nth-child(8)::before { content: "Volgende run"; }
  .feeds-table td:nth-child(9)::before { content: "Artikelen"; }
  .feeds-table td:nth-child(10)::before { content: "Acties"; }
  #crawler-runs td:nth-child(1)::before { content: "Tijd"; }
  #crawler-runs td:nth-child(2)::before { content: "Type"; }
  #crawler-runs td:nth-child(3)::before { content: "Status"; }
  #crawler-runs td:nth-child(4)::before { content: "Feeds"; }
  #crawler-runs td:nth-child(5)::before { content: "Artikelen"; }
  #crawler-runs td:nth-child(6)::before { content: "Tekst"; }
  #crawler-runs td:nth-child(7)::before { content: "Afbeeldingen"; }
  #crawler-runs td:nth-child(8)::before { content: "Duur"; }
  #crawler-runs td:nth-child(9)::before { content: "Fout"; }
  #crawler-problems td:nth-child(1)::before { content: "Artikel"; }
  #crawler-problems td:nth-child(2)::before { content: "Bron"; }
  #crawler-problems td:nth-child(3)::before { content: "Tekst"; }
  #crawler-problems td:nth-child(4)::before { content: "Afbeelding"; }
  #crawler-problems td:nth-child(5)::before { content: "Import"; }
  #crawler-problems td:nth-child(6)::before { content: "Actie"; }
  .feed-title, .feed-url, .article-title { max-width: none; white-space: normal; overflow-wrap: anywhere; }
  .category-cell select, .subcategory-cell select { max-width: none; width: 100%; }
  .cell-actions { justify-content: flex-start; flex-wrap: wrap; }
  .status-stack, .db-fields { max-width: none; }
}

@media (max-width: 420px) {
  body { font-size: 14px; }
  .bar-inner { padding: 9px 12px; gap: 8px 10px; }
  .brand { font-size: 18px; }
  .brand-blocks { font-size: 12px; }
  .bar-actions, .crawler-actions, .filters, .quick-filters, .toolbar-group { gap: 8px; }
  .bar-actions .btn, .crawler-actions .btn, .filters .btn, .filters select, .filters input[type="search"], .toolbar-group .btn {
    width: 100%; flex: 1 1 100%; min-width: 0;
  }
  .toolbar-group .inline-field { flex: 1 1 100%; justify-content: space-between; white-space: normal; }
  .wrap { padding: 20px 12px 50px; }
  h1 { font-size: 25px; }
  .sub { font-size: 13.5px; margin-bottom: 18px; }
  .crawler-cards { grid-template-columns: 1fr; }
  .crawler-card { min-height: 0; padding: 12px 14px; }
  .crawler-card strong { font-size: 22px; }
  .panel-head { align-items: start; flex-direction: column; gap: 4px; }
  .feeds-table td, .crawler-table td { grid-template-columns: 1fr; gap: 3px; }
  dialog { width: calc(100vw - 20px); }
  #modal-body .inner { padding: 16px 16px 0; }
  #modal-body h2 { font-size: 20px; }
  .list-panel { padding: 16px 14px; }
  .list-add { flex-wrap: wrap; }
  .list-add .btn { width: 100%; }
  .clustering-settings { grid-template-columns: 1fr; }
}

/* ============ clustering ============ */
.clustering-settings {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px 16px;
  margin-bottom: 14px;
}
.cl-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12.5px;
}
.cl-field > span { color: color-mix(in srgb, CanvasText 62%, transparent); font-weight: 600; }
.cl-field small { color: var(--ink-faint); font-size: 11px; }
.cl-field input[type="number"], .cl-field input[type="text"], .cl-field select {
  padding: 5px 8px;
  border-radius: 7px;
  border: 1px solid color-mix(in srgb, CanvasText 18%, transparent);
  background: Canvas;
  color: CanvasText;
}
.cl-field.cl-bool {
  flex-direction: row;
  align-items: center;
  gap: 7px;
}
.cl-group-title {
  grid-column: 1 / -1;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: color-mix(in srgb, CanvasText 50%, transparent);
  margin-top: 6px;
}
.cluster-detail { margin: 12px 0; }
.cluster-detail .cl-meta { color: color-mix(in srgb, CanvasText 55%, transparent); font-size: 12px; margin: 2px 0 8px; }
