* { box-sizing: border-box; }
body {
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  background: #f5f6f8;
  color: #1d2129;
}
header {
  background: #1d2129;
  color: #fff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: #fff;
}
.header-brand h1 {
  margin: 0; font-size: 17px; font-weight: 600;
  letter-spacing: -0.01em;
}
.header-brand:hover h1 { opacity: 0.85; }
.header-page-title {
  font-size: 14px;
  color: #b0b3b8;
  font-weight: 400;
}
.header-page-title::before {
  content: '/';
  margin-right: 12px;
  color: #5a5d63;
}
.header-actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
  align-items: center;
}
/* nav links — subdued by default, brighter on active/hover */
.header-link {
  color: #c8cacd;
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  transition: background-color 0.12s, color 0.12s;
}
.header-link:hover { background: rgba(255,255,255,0.08); color: #fff; }
.header-link.active { background: rgba(45,127,249,0.18); color: #fff; }
.header-link.subtle { color: #8c8e92; font-weight: 400; }
.header-link.subtle:hover { color: #c8cacd; }
.header-divider {
  width: 1px; height: 18px;
  background: rgba(255,255,255,0.12);
  margin: 0 4px;
}
.header-logout {
  background: rgba(255,255,255,0.06) !important;
  color: #c8cacd !important;
  padding: 7px 14px !important;
  font-size: 13px !important;
  border-color: transparent !important;
}
.header-logout:hover {
  background: rgba(255,255,255,0.14) !important;
  color: #fff !important;
}
@media (max-width: 720px) {
  .header-page-title { display: none; }
  .header-link { padding: 6px 8px; }
}

.nav-bar {
  display: flex; gap: 12px; align-items: center;
  margin-bottom: 16px;
}
.breadcrumb { flex: 1; font-size: 14px; }
.breadcrumb a {
  color: #2d7ff9; text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { margin: 0 6px; color: #65676b; }
/* --- custom folder-picker (tree dropdown) --- */
.folder-picker {
  position: relative;
  display: inline-block;
  min-width: 220px;
}
.fp-trigger {
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid #d0d7de;
  border-radius: 4px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.fp-trigger:hover { border-color: #2d7ff9; }
.fp-trigger-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-chev { color: #65676b; font-size: 11px; }
.fp-popup {
  position: absolute;
  z-index: 1000;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #d0d7de;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  max-height: 360px;
  overflow-y: auto;
  padding: 4px 0;
}
.fp-node {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.fp-node:hover { background: #e7f0fe; }
.fp-node.fp-selected { background: #2d7ff9; color: #fff; }
.fp-node.fp-selected:hover { background: #1f6fe8; }
.fp-toggle {
  display: inline-block;
  width: 14px;
  text-align: center;
  color: #65676b;
  font-size: 10px;
  user-select: none;
}
.fp-toggle:not(.fp-empty):hover { color: #2d7ff9; }
.fp-node.fp-selected .fp-toggle { color: #fff; }
.fp-icon { font-size: 13px; }
.fp-name { flex: 1; }
.fp-empty-msg {
  padding: 12px;
  font-size: 12px;
  color: #65676b;
  text-align: center;
}
/* picker used in narrower contexts (forms) */
.field .folder-picker { display: block; width: 100%; }

.section-h {
  margin: 16px 0 8px;
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: #65676b;
}

.folder-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px; align-items: center;
}
.folder-name {
  font-size: 15px; font-weight: 600; color: #1d2129;
  text-decoration: none;
}
.folder-name:hover { color: #2d7ff9; }

/* Homepage hero — single-action "paste URL → get RSS" entry point.
   The manual builder is still one click away via the secondary link
   below, but the primary CTA is the URL paste flow (used 90% of the
   time for adding new feeds). */
.hero {
  background: #fff;
  border: 1px solid #e3e5e8;
  border-radius: 8px;
  padding: 28px 32px;
  margin-bottom: 20px;
}
.hero-content { max-width: 960px; margin: 0 auto; }
.hero-title {
  margin: 0 0 14px 0;
  font-size: 20px;
  font-weight: 600;
  color: #1d2129;
}
.hero-form {
  display: flex;
  gap: 8px;
}
.hero-form input {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  font-size: 15px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.hero-form input:focus {
  outline: none;
  border-color: #2d7ff9;
  box-shadow: 0 0 0 3px rgba(45,127,249,0.18);
}
.hero-form .btn {
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 500;
}
.hero-secondary {
  margin: 12px 0 0 0;
  font-size: 13px;
  color: #65676b;
  line-height: 1.5;
}
.hero-secondary a {
  color: #2d7ff9;
  text-decoration: none;
  font-weight: 500;
}
.hero-secondary a:hover { text-decoration: underline; }

.health-dot {
  display: inline-block;
  margin-right: 4px;
  font-size: 11px;
  vertical-align: middle;
}
.type-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
}
.type-tag.type-native {
  background: #e6f4ea; color: #1e8e3e;
}
.type-tag.type-scraped {
  background: #fff1e0; color: #b45309;
}
.type-tag.type-admin {
  background: #f3e8ff; color: #7e22ce;
}
.type-tag.type-user {
  background: #e0f2fe; color: #075985;
}
/* "TEMP PASSWORD" badge — vivid so it's hard to miss in the user list */
.type-tag.type-temp {
  background: #fee2e2; color: #991b1b; font-weight: 700;
}

/* Role-differences explainer (Users page) */
.role-explainer {
  margin-bottom: 16px;
}
.role-explainer-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #65676b;
  margin: 0 0 10px 0;
}
.role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.role-card {
  background: #fff;
  border: 1px solid #e3e5e8;
  border-radius: 8px;
  padding: 14px 16px;
}
.role-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e3e5e8;
}
.role-card-subtitle {
  color: #65676b;
  font-size: 13px;
}
.role-card ul {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.55;
  color: #1d2129;
}
.role-card ul li { margin: 4px 0; }
@media (max-width: 640px) {
  .role-grid { grid-template-columns: 1fr; }
}

/* Cleaner add-user form on the Users page */
.user-add-form .field { margin-bottom: 14px; }
.user-add-form .field:last-of-type { margin-bottom: 18px; }
.user-add-form select {
  width: 100%; padding: 8px 10px; font-size: 13px;
  font-family: inherit; border: 1px solid #d0d7de;
  border-radius: 4px; background: #fff;
}

.btn.disabled {
  background: #eef0f2; color: #9aa0a6;
  cursor: not-allowed; pointer-events: none;
}

/* --- tags --- */
.tag-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  align-items: center;
}
.tag-chip {
  background: #fff;
  border: 1px solid #d0d7de;
  color: #1d2129;
  padding: 5px 11px;
  font-size: 12px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tag-chip:hover { background: #e7f0fe; border-color: #2d7ff9; }
.tag-chip.active {
  background: #2d7ff9;
  color: #fff;
  border-color: #2d7ff9;
}
.tag-chip.active:hover { background: #1f6fe8; }
.tag-chip .chip-count {
  background: rgba(0,0,0,0.08);
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
}
.tag-chip.active .chip-count {
  background: rgba(255,255,255,0.25);
}
.tag-chip.small {
  padding: 2px 8px;
  font-size: 11px;
}

.feed-tags {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tag-suggestions {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

/* --- tag autocomplete dropdown --- */
.tag-input-wrap { position: relative; }
.tag-ac-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background: #fff;
  border: 1px solid #d0d7de;
  border-top: none;
  border-radius: 0 0 4px 4px;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}
.tag-ac-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
}
.tag-ac-item.highlighted,
.tag-ac-item:hover {
  background: #e7f0fe;
}
.tag-ac-name strong {
  background: rgba(45,127,249,0.18);
  font-weight: 600;
}
.tag-ac-count {
  background: #eef0f2;
  color: #65676b;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
}

/* --- RSS reader --- */
.reader {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 24px;
  align-items: start;
}
.reader-sidebar {
  background: #fff;
  border: 1px solid #e3e5e8;
  border-radius: 6px;
  padding: 14px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  position: sticky;
  top: 16px;
}
.reader-section + .reader-section { margin-top: 14px; }
.reader-section-label {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 600;
  color: #65676b;
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}
.reader-hint {
  font-size: 11px; color: #65676b; line-height: 1.6;
  border-top: 1px solid #e3e5e8;
  padding-top: 10px;
}
.reader-hint kbd {
  background: #eef0f2;
  border: 1px solid #d0d7de;
  border-radius: 3px;
  padding: 1px 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}
.reader-feed-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  margin-bottom: 2px;
}
.reader-feed-item:hover { background: #e7f0fe; }
.reader-feed-item.active { background: #2d7ff9; color: #fff; }
.reader-feed-item .feed-icon { font-size: 11px; flex-shrink: 0; }
.reader-feed-item .feed-label {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.reader-feed-item .feed-count {
  background: rgba(0,0,0,0.08);
  font-size: 11px; padding: 1px 7px; border-radius: 999px;
  color: inherit;
}
.reader-feed-item.active .feed-count { background: rgba(255,255,255,0.25); }

.reader-main { min-width: 0; }
.reader-toolbar {
  background: #fff;
  border: 1px solid #e3e5e8;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.reader-title { font-size: 18px; margin: 0; flex: 1; min-width: 200px; }
#reader-search {
  padding: 6px 10px; font-size: 13px; font-family: inherit;
  border: 1px solid #d0d7de; border-radius: 4px;
  min-width: 200px;
}
#sort-order {
  padding: 6px 10px; font-size: 13px; font-family: inherit;
  border: 1px solid #d0d7de; border-radius: 4px; background: #fff;
}
.btn.active {
  background: #2d7ff9; color: #fff; border-color: #2d7ff9;
}

.reader-item {
  background: #fff;
  border: 1px solid #e3e5e8;
  border-radius: 6px;
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.reader-item.with-image {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
}
/* Explicitly pin children to their columns. Without this, if the <img>
   gets display:none'd by an onerror handler, CSS Grid auto-places the
   body into column 1 (the 200px image slot) and squishes the text. */
.reader-item.with-image > .reader-item-image { grid-column: 1; }
.reader-item.with-image > .reader-item-body { grid-column: 2; }
.reader-item.selected {
  border-color: #2d7ff9;
  box-shadow: 0 0 0 2px rgba(45,127,249,0.18);
}
.reader-item.read { opacity: 0.6; }
.reader-item.read .reader-item-title { font-weight: 500; }
.reader-item-image {
  width: 100%; height: 140px;
  object-fit: cover; border-radius: 4px;
  background: #f0f2f5;
}
.reader-item-body { min-width: 0; }
.reader-item-meta {
  font-size: 12px; color: #65676b;
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.unread-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #2d7ff9; display: inline-block; flex-shrink: 0;
}
.reader-item-feed {
  background: #eef0f2; padding: 1px 7px; border-radius: 999px; font-size: 11px;
}
.reader-item-title {
  margin: 0 0 8px 0; font-size: 16px; line-height: 1.35;
}
.reader-item-title a { color: #1d2129; text-decoration: none; }
.reader-item-title a:hover { color: #2d7ff9; text-decoration: underline; }
.reader-item-desc {
  font-size: 13px; line-height: 1.55; color: #4b4d52;
  max-height: 240px; overflow: hidden;
  position: relative;
}
.reader-item-desc::after {
  /* fade-out gradient on overflow */
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 30px;
  background: linear-gradient(transparent, #fff);
  pointer-events: none;
}
.reader-item-desc img { max-width: 100%; height: auto; border-radius: 4px; margin: 6px 0; }
.reader-item-desc p { margin: 0 0 6px 0; }
.reader-item-desc a { color: #2d7ff9; }
.reader-item-desc h1, .reader-item-desc h2, .reader-item-desc h3,
.reader-item-desc h4, .reader-item-desc h5, .reader-item-desc h6 {
  margin: 8px 0 4px 0; font-size: 14px;
}

.reader-loading, .reader-empty {
  padding: 50px 20px; text-align: center; color: #65676b;
  background: #fff; border: 1px solid #e3e5e8; border-radius: 6px;
}

/* mobile fallback */
@media (max-width: 720px) {
  .reader { grid-template-columns: 1fr; }
  .reader-sidebar { position: static; max-height: 400px; }
  .reader-item.with-image {
    grid-template-columns: 1fr;
  }
  .reader-item-image { height: 200px; }
}

/* ====================================================================
 * AUTH PAGES (setup, login)
 * ==================================================================== */
.auth-main {
  display: flex; justify-content: center; align-items: flex-start;
  min-height: 100vh; padding: 60px 20px;
}
.auth-card {
  background: #fff; border: 1px solid #e3e5e8; border-radius: 8px;
  padding: 32px; width: 100%; max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.06);
}
.auth-card h1 {
  margin: 0 0 12px 0; font-size: 22px; font-weight: 600;
}
.auth-intro {
  color: #65676b; font-size: 13px; line-height: 1.55; margin: 0 0 18px 0;
}
.auth-status { margin-top: 12px; min-height: 18px; font-size: 13px; }
.auth-status.error { color: #c0392b; }
.auth-status.success { color: #1e8e3e; }
.auth-status.info { color: #2d7ff9; }

/* full-width banner shown on the account page when 2FA is mandatory */
.force-2fa-banner {
  background: #fff8e1;
  border-bottom: 1px solid #f0d97b;
  color: #614108;
  padding: 12px 24px;
  font-size: 14px;
}
/* recovery codes — light amber warning box. Always explicit text colour
   so it's readable on its own background in both light + dark modes. */
.recovery-codes-pre {
  background: #fff8e1;
  border: 1px solid #f0d97b;
  color: #614108;
  border-radius: 4px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.8;
  letter-spacing: 1px;
  margin: 0;
}
/* "I've saved my codes" confirmation box */
.confirmation-box {
  margin-top: 16px;
  padding: 12px;
  background: #e7f0fe;
  border: 1px solid #cfe0fb;
  border-radius: 4px;
  color: #1c5dbb;
}
main { max-width: 1200px; margin: 0 auto; padding: 24px; }
.card {
  background: #fff; border: 1px solid #e3e5e8; border-radius: 6px;
  padding: 13px 16px; margin-bottom: 9px;
  transition: box-shadow .12s, border-color .12s;
}
.card:hover { box-shadow: 0 1px 6px rgba(20,23,28,0.06); }
.feed-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 8px; align-items: start;
}
.feed-actions { display: contents; }
body.select-mode-on .feed-row {
  grid-template-columns: auto 1fr auto auto auto;
}

/* per-card actions: Read + Copy URL visible, the rest in a ⋯ menu */
.feed-menu-wrap { position: relative; }
.feed-menu-btn { padding: 6px 11px; font-weight: 700; line-height: 1; letter-spacing: 1px; }
.feed-menu {
  position: absolute; right: 0; top: calc(100% + 4px);
  min-width: 156px; z-index: 30;
  background: #fff; border: 1px solid #e3e5e8; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(20,23,28,0.14);
  padding: 5px; display: flex; flex-direction: column;
}
.feed-menu[hidden] { display: none; }
.feed-menu .menu-item {
  display: block; width: 100%; text-align: left; box-sizing: border-box;
  background: none; border: 0; cursor: pointer; text-decoration: none;
  font: inherit; font-size: 13px; color: #1d2129;
  padding: 8px 10px; border-radius: 5px;
}
.feed-menu .menu-item:hover { background: #f0f2f5; }
.feed-menu .menu-item.danger { color: #c0392b; }
.feed-menu .menu-sep { height: 1px; background: #ececef; margin: 4px 2px; }

.card.is-paused { opacity: 0.75; }
.health-paused, .card.health-paused { border-left: 3px solid #6b7280; }
.select-checkbox {
  width: 18px; height: 18px; cursor: pointer;
}
.card.is-selected {
  border-color: #2d7ff9;
  box-shadow: 0 0 0 2px rgba(45,127,249,0.15);
}

/* unified filter & manage panel */
.manage-panel {
  background: #fff;
  border: 1px solid #e3e5e8;
  border-radius: 6px;
  padding: 0;
  margin-bottom: 16px;
}
.manage-panel .panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid #e3e5e8;
  background: #fafbfc;
  border-radius: 6px 6px 0 0;
}
.manage-panel .panel-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #65676b;
  flex: 1;
}
.panel-actions {
  display: inline-flex;
  gap: 6px;
}
.manage-panel .filter-section {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.manage-panel .panel-divider {
  height: 1px;
  background: #e3e5e8;
  margin: 0;
}
.manage-panel .actions-section {
  padding: 10px 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.filter-group {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: nowrap;
}
.filter-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #65676b;
  padding-top: 6px;
  min-width: 50px;
  flex-shrink: 0;
}
.filter-group .tag-filter-bar,
.filter-group .status-filter-bar {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.tag-chip.tag-chip-more {
  background: #f7f9fc;
  border-style: dashed;
  color: #2d7ff9;
}
.tag-chip.tag-chip-more:hover {
  background: #e7f0fe;
}
.select-info {
  display: flex;
  gap: 8px;
  align-items: center;
}
/* The browser's [hidden]{display:none} is otherwise overridden by the
   display:flex above (equal specificity), which kept the bulk actions visible
   even outside select mode — making the bulk Refresh a confusing dead-end. */
.select-info[hidden] { display: none; }
#selected-count {
  font-size: 13px;
  color: #65676b;
  padding: 0 6px;
}

/* queue badge */
.queue-badge {
  background: #e7f0fe;
  color: #1c5dbb;
  border: 1px solid #cfe0fb;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
/* without this, .queue-badge's `display: inline-flex` wins over the
   browser default [hidden] rule, leaving an empty pill on screen */
.queue-badge[hidden] { display: none; }
.queue-detail { color: #65676b; }

/* "more tags" popover */
.tag-more-popup {
  position: absolute;
  z-index: 1000;
  width: 320px;
  background: #fff;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  font-size: 13px;
}
.tag-more-header {
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  border-bottom: 1px solid #e3e5e8;
}
.tag-more-header input[type="search"] {
  flex: 1;
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid #d0d7de;
  border-radius: 4px;
}
.tag-more-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 4px 0;
}
.tag-more-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
}
.tag-more-row:hover { background: #f0f2f5; }
.tag-more-row input[type="checkbox"] {
  width: 16px; height: 16px; cursor: pointer;
}
.tag-more-name { flex: 1; }
.tag-more-empty {
  padding: 18px 12px;
  text-align: center;
  color: #65676b;
  font-size: 12px;
}
.tag-more-footer {
  padding: 8px 12px;
  border-top: 1px solid #e3e5e8;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #65676b;
}

/* bulk tag editor */
.tag-bulk-popup { width: 340px; }
.tag-bulk-info {
  padding: 8px 12px;
  font-size: 12px;
  color: #65676b;
  background: #f5f6f8;
  border-bottom: 1px solid #e3e5e8;
}
.tag-bulk-info strong { color: #1d2129; }
.tag-bulk-create,
.tag-more-create {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid #e3e5e8;
  background: #fafbfc;
}
.tag-bulk-create input[type=text],
.tag-more-create input[type=text] {
  flex: 1;
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid #d0d7de;
  border-radius: 4px;
}
.chip-count.chip-count-new {
  background: #e6f4ea;
  color: #1e8e3e;
}
.tag-more-row input[type=checkbox] {
  cursor: pointer;
}

/* muted appearance for bulk action buttons when nothing is selected.
   Still clickable — the handler shows a friendly alert. */
.btn.is-empty-action {
  opacity: 0.55;
}
.btn.is-empty-action:hover {
  opacity: 0.8;
}

/* per-feed refresh countdown */
.refresh-countdown {
  font-variant-numeric: tabular-nums;
  color: #65676b;
}
.refresh-countdown.due {
  color: #2d7ff9;
  font-weight: 600;
}

/* --- form sections (used by picker.html and auto.html) --- */
.form-section {
  background: #f5f6f8;
  border: 1px solid #ebeef2;
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 12px;
}
.form-section:last-of-type { margin-bottom: 16px; }
.form-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #4b4d52;
  margin: 0 0 14px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #e1e4e8;
}
.form-section .field:last-child { margin-bottom: 0; }
.form-section .field { margin-bottom: 12px; }
.form-section input[type=text],
.form-section input[type=url],
.form-section input[type=number],
.form-section select {
  background: #fff;
}
.required-star {
  color: #c0392b;
  margin-left: 2px;
  font-weight: 700;
}
.label-muted {
  font-weight: normal;
  color: #65676b;
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
}
.field input.input-invalid,
.field input.input-invalid:focus {
  border-color: #c0392b;
  outline-color: #c0392b;
  background: #fdf2f0;
}

/* settings grid (refresh interval, max items, stale threshold) */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}
.settings-grid .field { margin-bottom: 0; }
.settings-grid .field.settings-full { grid-column: 1 / -1; }
.input-suffix {
  font-size: 13px;
  color: #65676b;
  align-self: center;
}
.hint.inline {
  margin-top: 0;
  align-self: center;
  font-size: 11px;
}

/* full-width save button at the bottom of forms */
.save-btn {
  width: 100%;
  padding: 10px;
  font-size: 14px;
  margin-top: 8px;
}

/* selects in the settings grid match the input styling */
.settings-grid select,
.field select {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid #d0d7de;
  border-radius: 4px;
  background: #fff;
}

/* per-feed interval tag */
.interval-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  background: #eef0f2;
  color: #65676b;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

/* faint health-tinted left border so users can scan a long list quickly */
.card.health-failed  { border-left: 3px solid #c0392b; }
.card.health-warning { border-left: 3px solid #d97706; }
.card.health-stale   { border-left: 3px solid #6b7280; }
.card.health-healthy { border-left: 3px solid #1e8e3e; }
.card.health-unknown { border-left: 3px solid #d0d7de; }
.feed-name { font-weight: 600; font-size: 15px; }

/* feed-card meta rows ------------------------------------------- */
.feed-source {
  margin-top: 5px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.feed-source a {
  color: #8c8e92;
  text-decoration: none;
}
.feed-source a:hover { text-decoration: underline; color: #57595d; }

/* subtle dot dividers between the stat pairs */
.feed-stats .stat:not(:last-child)::after {
  content: '·'; color: #c7cace; margin-left: 14px;
}

/* de-emphasise status chips with a zero count so the eye lands on real ones */
.tag-chip.is-zero:not(.active) { opacity: 0.4; }

/* empty state */
.card.empty { text-align: center; color: #65676b; }
.empty-hero { padding: 40px 22px; }
.empty-icon { font-size: 34px; line-height: 1; margin-bottom: 10px; }
.empty-title { font-size: 17px; font-weight: 600; color: #1d2129; margin: 0 0 4px; }
.empty-sub { margin: 0 0 16px; }
.empty-examples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.empty-examples .tag-chip { cursor: pointer; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.empty-examples .tag-chip:hover { border-color: #2d7ff9; color: #2d7ff9; }

/* ---- toasts ---- */
#toast-host {
  position: fixed; top: 16px; right: 16px; z-index: 1000;
  display: flex; flex-direction: column; gap: 8px; max-width: 360px;
}
.toast {
  background: #1d2129; color: #fff; padding: 11px 14px; border-radius: 8px;
  font-size: 13px; line-height: 1.4; box-shadow: 0 8px 24px rgba(0,0,0,0.22);
  opacity: 0; transform: translateX(12px); transition: opacity .2s, transform .2s;
  cursor: pointer;
}
.toast.show { opacity: 1; transform: none; }
.toast-success { background: #1e8e3e; }
.toast-error { background: #c0392b; }
.toast-info { background: #2d3748; }

/* ---- modal ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1001; padding: 20px;
  background: rgba(20,23,28,0.45); display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s;
}
.modal-overlay.show { opacity: 1; }
.modal {
  background: #fff; border-radius: 12px; padding: 22px; width: 100%; max-width: 430px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  transform: translateY(8px) scale(.98); transition: transform .15s;
}
.modal-overlay.show .modal { transform: none; }
.modal-title { margin: 0 0 8px; font-size: 17px; font-weight: 600; color: #1d2129; }
.modal-message { margin: 0 0 18px; color: #57595d; font-size: 14px; line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* config form modal */
.modal-form .modal-title { margin-bottom: 16px; }
.cfg-field { display: block; margin-bottom: 12px; }
.cfg-field > span { display: block; font-size: 12px; font-weight: 600; color: #57595d; margin-bottom: 4px; }
.cfg-field input {
  width: 100%; box-sizing: border-box; padding: 9px 11px; font: inherit; font-size: 14px;
  border: 1px solid #d0d7de; border-radius: 6px; background: #fff;
}
.cfg-field input:focus { outline: none; border-color: #2d7ff9; box-shadow: 0 0 0 3px rgba(45,127,249,0.15); }
.cfg-row { display: flex; gap: 12px; }
.cfg-row .cfg-field { flex: 1; }
.cfg-link { margin: 4px 0 18px; font-size: 13px; }
.cfg-link a { color: #2d7ff9; text-decoration: none; }
.cfg-link a:hover { text-decoration: underline; }

/* feed search */
.feed-search { padding: 12px 16px 0; }
.feed-search input {
  width: 100%; box-sizing: border-box; padding: 9px 12px; font: inherit; font-size: 14px;
  border: 1px solid #d0d7de; border-radius: 6px; background: #fff;
}
.feed-search input:focus { outline: none; border-color: #2d7ff9; box-shadow: 0 0 0 3px rgba(45,127,249,0.15); }

/* settings page */
.settings-panel { max-width: 640px; margin: 0 auto; }
.setting-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 0; border-top: 1px solid #ececef;
}
.setting-row:first-of-type { border-top: 0; }
.setting-row input[type=checkbox] { width: 18px; height: 18px; margin-top: 2px; flex: 0 0 auto; cursor: pointer; }
.setting-row small { color: #8c8e92; }
.settings-actions { margin: 18px 0 6px; }

/* bulk import page */
.import-textarea {
  width: 100%; box-sizing: border-box; padding: 11px 13px; font: inherit; font-size: 14px;
  line-height: 1.5; border: 1px solid #d0d7de; border-radius: 8px; resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.import-textarea:focus { outline: none; border-color: #2d7ff9; box-shadow: 0 0 0 3px rgba(45,127,249,0.15); }
.queue-row {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  padding: 9px 4px; border-top: 1px solid #ececef;
}
.queue-row:first-child { border-top: 0; }
.queue-url {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: #1d2129;
}
.queue-actions { display: flex; gap: 6px; flex: 0 0 auto; }

/* ---- account dropdown (header) ---- */
.account-menu { position: relative; }
.account-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: 0; cursor: pointer; color: #fff;
  padding: 5px 8px; border-radius: 8px; font: inherit;
}
.account-trigger:hover { background: rgba(255,255,255,0.12); }
.account-trigger .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: #2d7ff9; color: #fff; font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.account-trigger .account-name { font-size: 14px; }
.account-trigger .caret { font-size: 10px; opacity: .7; }
.account-dropdown {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; z-index: 200;
  background: #fff; border: 1px solid #e3e5e8; border-radius: 10px;
  box-shadow: 0 12px 32px rgba(20,23,28,0.18); padding: 6px;
  display: flex; flex-direction: column;
}
.account-dropdown[hidden] { display: none; }
.account-dropdown-head { padding: 8px 10px 10px; }
.account-dropdown-name { font-weight: 600; color: #1d2129; font-size: 14px; }
.account-dropdown-role { font-size: 11px; color: #8c8e92; text-transform: uppercase; letter-spacing: .04em; }
.account-dropdown a, .account-dropdown > button {
  display: block; width: 100%; text-align: left; box-sizing: border-box;
  background: none; border: 0; cursor: pointer; text-decoration: none;
  font: inherit; font-size: 13px; color: #1d2129; padding: 8px 10px; border-radius: 6px;
}
.account-dropdown a:hover, .account-dropdown > button:hover { background: #f0f2f5; }
.account-dropdown .menu-sep { height: 1px; background: #ececef; margin: 4px 2px; }

/* ---- per-card refreshing pulse ---- */
.card.is-refreshing { position: relative; }
.card.is-refreshing::after {
  content: ''; position: absolute; inset: 0; border-radius: 6px;
  box-shadow: inset 0 0 0 2px rgba(45,127,249,0.5);
  animation: card-pulse 1s ease-in-out infinite; pointer-events: none;
}
@keyframes card-pulse { 0%,100% { opacity: .35; } 50% { opacity: 1; } }

/* ---- dashboard loading skeleton ---- */
.skeleton-card {
  background: #fff; border: 1px solid #e3e5e8; border-radius: 6px;
  padding: 16px; margin-bottom: 9px; height: 64px;
  background-image: linear-gradient(90deg, #f2f3f5 25%, #e9ebee 37%, #f2f3f5 63%);
  background-size: 400% 100%; animation: skel 1.3s ease infinite;
}
@keyframes skel { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---- responsive ---- */
@media (max-width: 760px) {
  main { padding: 16px 12px; }
  .hero-form { flex-direction: column; align-items: stretch; }
  .hero-form .btn { width: 100%; }
  .feed-row, body.select-mode-on .feed-row { grid-template-columns: 1fr; gap: 6px; }
  .feed-menu-wrap { justify-self: start; }
  .feed-menu { right: auto; left: 0; }
  .manage-panel .panel-header { flex-wrap: wrap; gap: 8px; }
  .account-trigger .account-name { display: none; }
}

.feed-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 6px;
  font-size: 12px;
}
.feed-stats .stat {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}
.feed-stats .stat-label {
  color: #8c8e92;
  font-size: 11px;
}
.feed-stats .stat-value {
  color: #1d2129;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.feed-error {
  margin-top: 6px;
  padding: 5px 10px;
  background: #fdf2f0;
  border-radius: 4px;
  font-size: 12px;
  color: #b3261e;
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.btn {
  background: #f0f2f5; border: 1px solid #d0d7de; color: #1d2129;
  padding: 6px 12px; border-radius: 4px; font-size: 12px; cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #e4e6eb; }
.btn-primary { background: #2d7ff9; color: #fff; border-color: #2d7ff9; }
.btn-primary:hover { background: #1f6fe8; }
.btn-danger { background: #fff; color: #c0392b; border-color: #f1c4be; }
.btn-danger:hover { background: #fbeae8; }
.empty {
  text-align: center; padding: 60px 20px; color: #65676b;
}
.empty p { margin: 12px 0; }

/* picker page */
.picker {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 16px;
  height: calc(100vh - 60px);
  padding: 16px;
  max-width: none;
}
.picker .panel {
  background: #fff; border: 1px solid #e3e5e8; border-radius: 6px;
  padding: 16px; overflow-y: auto;
}
.picker .iframe-wrap {
  background: #fff; border: 1px solid #e3e5e8; border-radius: 6px;
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
}
.iframe-toolbar {
  padding: 8px 12px; border-bottom: 1px solid #e3e5e8;
  display: flex; gap: 8px; align-items: center; font-size: 12px;
  background: #fafbfc;
}
.iframe-toolbar .count { margin-left: auto; color: #65676b; }
.iframe-toolbar .count.ok { color: #1e8e3e; }
.iframe-toolbar .count.warn { color: #c0392b; }
.iframe-viewport {
  flex: 1;
  position: relative;
  background: #fff;
  min-height: 0;
}
.iframe-viewport iframe {
  width: 100%;
  height: 100%;
  border: 0;
}
#snapshot-frame { background: #fff; }

/* Loading state shown while the server renders the page in Playwright.
   Takes 10–20s for most pages — show something nicer than a blank iframe. */
.iframe-loading {
  position: absolute;
  inset: 0;
  background: #fafbfc;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  z-index: 1;
}
.iframe-loading[hidden] { display: none; }
.iframe-loading-spinner {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 4px solid #e3e5e8;
  border-top-color: #2d7ff9;
  animation: iframe-spin 0.85s linear infinite;
}
@keyframes iframe-spin { to { transform: rotate(360deg); } }
.iframe-loading-title {
  font-size: 16px;
  font-weight: 600;
  color: #1d2129;
}
.iframe-loading-subtitle {
  font-size: 13px;
  color: #65676b;
  line-height: 1.5;
  max-width: 360px;
}
/* Indeterminate progress bar — slides a "comet" across an empty track */
.iframe-loading-bar {
  margin-top: 8px;
  width: 220px;
  height: 4px;
  background: #e3e5e8;
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.iframe-loading-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: -35%;
  width: 35%;
  height: 100%;
  background: linear-gradient(90deg, transparent, #2d7ff9 50%, transparent);
  animation: iframe-bar 1.4s ease-in-out infinite;
}
@keyframes iframe-bar {
  0%   { left: -35%; }
  100% { left: 100%; }
}
.field { margin-bottom: 14px; }
.field label {
  display: block; font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.04em; color: #65676b;
  margin-bottom: 4px;
}
.field input[type=text], .field input[type=url] {
  width: 100%; padding: 8px 10px; font-size: 13px; font-family: inherit;
  border: 1px solid #d0d7de; border-radius: 4px;
}
.input-row { display: flex; gap: 6px; }
.input-row input { flex: 1; }
.input-row .btn { padding: 4px 10px; font-size: 14px; }
.field input:focus { outline: 2px solid #2d7ff9; outline-offset: -1px; }
.field .hint {
  font-size: 11px; color: #65676b; margin-top: 4px;
}
.toggle-pick {
  font-size: 11px; color: #2d7ff9; cursor: pointer;
  background: none; border: 0; padding: 0; margin-left: 8px;
}
.toggle-pick.active { color: #c0392b; font-weight: 600; }
.sub-count {
  float: right; font-size: 11px; font-weight: normal;
  color: #65676b; text-transform: none; letter-spacing: 0;
}
.sub-count.ok { color: #1e8e3e; }
.sub-count.partial { color: #d97706; }
.sub-count.warn { color: #c0392b; }
.preview-list {
  max-height: 300px; overflow-y: auto;
  border: 1px solid #e3e5e8; border-radius: 4px; padding: 8px;
  font-size: 12px; background: #fafbfc;
}
.preview-item { padding: 6px 4px; border-bottom: 1px solid #eef0f2; }
.preview-item:last-child { border-bottom: 0; }
.preview-item .t { font-weight: 600; }
.preview-item .l { color: #2d7ff9; font-size: 11px; word-break: break-all; }
.preview-item .d { color: #65676b; font-size: 11px; margin-top: 2px; }
.status { font-size: 12px; padding: 8px 12px; border-radius: 4px; }
.status.info { background: #e7f0fe; color: #2d7ff9; }
.status.error { background: #fbeae8; color: #c0392b; }
.status.success { background: #e6f4ea; color: #1e8e3e; }
hr { border: 0; border-top: 1px solid #e3e5e8; margin: 16px 0; }
.spinner {
  display: inline-block; width: 12px; height: 12px;
  border: 2px solid #d0d7de; border-top-color: #2d7ff9; border-radius: 50%;
  animation: spin 0.7s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
