/* Ensure [hidden] always wins over display: flex/grid on component rules */
[hidden] { display: none !important; }

/* History pane header styles */
.history-pane-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.8rem 0.3rem 0.8rem;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border-bottom: 1px solid var(--line);
  font-size: 1.13rem;
}
.history-header-icon {
  font-size: 1.35rem;
  color: var(--accent);
  vertical-align: middle;
}
.history-header-label {
  font-weight: 600;
  letter-spacing: 0.01em;
}
.history-close-pill {
  margin-left: auto;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  width: 2rem;
  height: 2rem;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.history-close-pill .material-symbols-rounded {
  font-size: 1.15rem;
  line-height: 1;
  font-variation-settings: "FILL" 1, "wght" 600, "GRAD" 0, "opsz" 24;
}
.history-close-pill:hover {
  background: var(--accent-dark, #2a5a7a);
}
:root {
  --pane-left: 280px;
  --pane-middle: 420px;
  --resizer-size: 8px;
  --pane-heading-height: 42px;
  --folders-strip-width: 16px;
  --topbar-height: 0px;
  --post-title-size: 0.88rem;
  --folders-header-height: 2.5rem;
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

*::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid var(--scrollbar-track);
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

body {
  margin: 0;
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top right, var(--bg-top) 0%, var(--bg-mid) 45%, var(--bg-bottom) 100%);
  height: 100vh;
  overflow: hidden;
}

a {
  color: var(--link);
  text-decoration-line: underline;
  text-decoration-thickness: 1.6px;
  text-underline-offset: 2px;
  text-decoration-color: color-mix(in srgb, var(--link) 60%, transparent);
}

a:hover {
  color: var(--link-hover);
  text-decoration-color: var(--link-hover);
}

.topbar-brand {
  font-size: 1.25rem;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Folders pane header: logo + hamburger */
.folders-pane-header {
  flex-shrink: 0;
  height: var(--folders-header-height);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.4rem 0.45rem 0.3rem;
  border-bottom: 1px solid var(--line);
}

.folders-pane-header .topbar-brand {
  flex: 1;
  text-align: center;
}

.folders-pane-header-collapse-btn {
  flex-shrink: 0;
  margin-left: auto;
}

.folders-pane-menu .menu-popover {
  position: fixed;
  top: var(--folders-header-height);
  left: 0.35rem;
  right: auto;
}

.topbar-debug {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-width: 0;
}

.topbar-debug-btn {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  border-radius: 5px;
  border: 1px solid color-mix(in srgb, var(--warn, #f90) 60%, transparent);
  background: color-mix(in srgb, var(--warn, #f90) 12%, transparent);
  color: var(--warn, #f90);
  cursor: pointer;
  white-space: nowrap;
}

.topbar-debug-btn:hover {
  background: color-mix(in srgb, var(--warn, #f90) 22%, transparent);
}

.topbar-debug-btn.active {
  background: color-mix(in srgb, var(--warn, #f90) 30%, transparent);
  border-color: var(--warn, #f90);
  font-weight: 600;
}

.topbar-debug-btn .material-symbols-rounded {
  font-size: 1rem;
}


.context-menu-item.debug-item {
  color: var(--warn, #f90);
}


.topbar-menu {
  flex: 0 0 auto;
  position: relative;
  z-index: 320;

}


.medium-pane-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 18, 0.28);
  backdrop-filter: blur(1px);
  z-index: 250;
}

.medium-pane-backdrop[hidden] {
  display: none;
}

body[data-layout-mode="wide"][data-left-collapsed="1"] .pane-folders {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--folders-strip-width);
  overflow: hidden;
  z-index: 260;
  border-right: 1px solid var(--line);
  border-radius: 0;
  cursor: e-resize;
  transition: width 140ms ease, box-shadow 140ms ease;
}

body[data-layout-mode="wide"][data-left-collapsed="1"][data-left-floating="1"] .pane-folders {
  width: var(--pane-left);
  box-shadow: var(--shadow);
  border-radius: 0 8px 8px 0;
  cursor: default;
}

body[data-layout-mode="wide"][data-left-collapsed="1"] .pane-resizer[data-resizer="left-middle"] {
  display: none;
}

body[data-layout-mode="wide"][data-left-collapsed="1"] .panes {
  grid-template-columns: var(--pane-middle) var(--resizer-size) minmax(340px, 1fr);
  padding-left: 0;
}

body[data-layout-mode="wide"][data-left-collapsed="1"] .pane-posts {
  grid-column: 1 / 2;
}

body[data-layout-mode="wide"][data-left-collapsed="1"] .pane-resizer[data-resizer="middle-right"] {
  grid-column: 2 / 3;
}

body[data-layout-mode="wide"][data-left-collapsed="1"] .pane-entry {
  grid-column: 3 / 4;
}

body[data-layout-mode="medium"] .panes {
  grid-template-columns: minmax(320px, 1fr) var(--resizer-size) minmax(340px, 1fr);
  padding: 0.35rem;
  padding-left: 0.35rem;
  gap: 0;
}

body[data-layout-mode="medium"] .pane-resizer[data-resizer="left-middle"] {
  display: none;
}

body[data-layout-mode="medium"] .pane-posts {
  grid-column: 1 / 2;
}

body[data-layout-mode="medium"] .pane-resizer[data-resizer="middle-right"] {
  grid-column: 2 / 3;
}

body[data-layout-mode="medium"] .pane-entry {
  grid-column: 3 / 4;
}

body[data-layout-mode="medium"] .pane-folders {
  position: fixed;
  top: 0.35rem;
  left: 0;
  bottom: 0.35rem;
  width: var(--folders-strip-width);
  z-index: 260;
  overflow: hidden;
  border-radius: 0 8px 8px 0;
  border-right: 1px solid var(--line);
  cursor: e-resize;
  transition: width 160ms ease, box-shadow 160ms ease;
}

body[data-layout-mode="medium"][data-medium-left-open="1"] .pane-folders {
  width: min(370px, 82vw);
  box-shadow: var(--shadow);
  cursor: default;
}

.pane-folders .tree {
  flex: 1 1 0;
  min-height: 0;
  height: auto;
}

.folders-utility-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  flex: 1 1 auto;
}

.folders-utility-btn {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: 1.7rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
}

.folders-utility-row .folders-utility-btn {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.folders-utility-btn .material-symbols-rounded {
  font-size: 1rem;
  line-height: 1;
  font-variation-settings: "FILL" 0, "wght" 600, "GRAD" 0, "opsz" 24;
}

body[data-single-mode="1"] .folders-utility-row {
  gap: 0.45rem;
}

body[data-single-mode="1"] .folders-utility-row .folders-utility-btn {
  min-height: 2.75rem;
  height: 2.75rem;
  border-radius: 10px;
}

body[data-single-mode="1"] .folders-utility-btn .material-symbols-rounded {
  font-size: 1.45rem;
}

.folders-utility-btn:hover {
  color: var(--ink);
  background: var(--hover-bg);
}

.folders-utility-btn.active,
.folders-utility-btn.has-alert {
  color: var(--accent);
  border-color: transparent;
  background: transparent;
}

.folders-utility-btn.active .material-symbols-rounded,
.folders-utility-btn.has-alert .material-symbols-rounded {
  font-variation-settings: "FILL" 1, "wght" 600, "GRAD" 0, "opsz" 24;
}

.folders-utility-badge {
  position: absolute;
  top: -0.28rem;
  right: -0.2rem;
  min-width: 1rem;
  height: 1rem;
  border-radius: 999px;
  background: color-mix(in srgb, #d85a4a 88%, var(--accent));
  color: #fff;
  font-size: 0.68rem;
  line-height: 1;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.2rem;
}

.folders-collapse-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 1.15rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 100ms, background 100ms;
}

.folders-collapse-btn:hover {
  color: var(--ink);
  background: var(--hover-bg);
}

/* When inside the utility row, size matches other buttons */
.folders-utility-row .folders-collapse-btn {
  flex: 0 0 auto;
  height: 1.7rem;
  width: 1.9rem;
  padding: 0;
  font-size: 1rem;
  border-radius: 6px;
}

/* Default full pane: show << */
.folders-btn-strip-icon,
.folders-btn-popout-icon {
  display: none;
}
.folders-btn-expanded-icon {
  display: inline;
}

.folders-btn-icon.material-symbols-rounded {
  font-size: 0.95rem;
  line-height: 1;
  font-variation-settings: "FILL" 1, "wght" 600, "GRAD" 0, "opsz" 24;
}

.folders-btn-strip-icon.material-symbols-rounded {
  font-variation-settings: "FILL" 0, "wght" 700, "GRAD" 0, "opsz" 24;
}

.folders-btn-popout-icon.material-symbols-rounded {
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
}

/* Collapsed strip: show > */
body[data-layout-mode="wide"][data-left-collapsed="1"]:not([data-left-floating="1"]) .folders-btn-expanded-icon,
body[data-layout-mode="medium"]:not([data-medium-left-open="1"]) .folders-btn-expanded-icon,
body[data-layout-mode="wide"][data-left-collapsed="1"][data-left-floating="1"] .folders-btn-expanded-icon,
body[data-layout-mode="medium"][data-medium-left-open="1"] .folders-btn-expanded-icon {
  display: none;
}
body[data-layout-mode="wide"][data-left-collapsed="1"]:not([data-left-floating="1"]) .folders-btn-strip-icon,
body[data-layout-mode="medium"]:not([data-medium-left-open="1"]) .folders-btn-strip-icon {
  display: inline;
}

/* Popped-out-from-strip: show >> */
body[data-layout-mode="wide"][data-left-collapsed="1"][data-left-floating="1"] .folders-btn-popout-icon,
body[data-layout-mode="medium"][data-medium-left-open="1"] .folders-btn-popout-icon {
  display: inline;
}

/* Strip state: overlay transparent pane, only header collapse btn is interactive */
body[data-layout-mode="wide"][data-left-collapsed="1"]:not([data-left-floating="1"]) .pane-folders,
body[data-layout-mode="medium"]:not([data-medium-left-open="1"]) .pane-folders {
  background: transparent;
  border: none;
  box-shadow: none;
  pointer-events: none;
}

/* Strip header: transparent bg, only collapse btn clickable */
body[data-layout-mode="wide"][data-left-collapsed="1"]:not([data-left-floating="1"]) .folders-pane-header,
body[data-layout-mode="medium"]:not([data-medium-left-open="1"]) .folders-pane-header {
  justify-content: center;
  border-bottom: none;
  background: transparent;
  pointer-events: auto;
}

body[data-layout-mode="wide"][data-left-collapsed="1"]:not([data-left-floating="1"]) .folders-pane-header > :not(.folders-pane-header-collapse-btn),
body[data-layout-mode="medium"]:not([data-medium-left-open="1"]) .folders-pane-header > :not(.folders-pane-header-collapse-btn) {
  display: none;
}

/* Hide tree content when folders pane is in strip mode. */
body[data-layout-mode="wide"][data-left-collapsed="1"]:not([data-left-floating="1"]) .pane-folders .tree,
body[data-layout-mode="medium"]:not([data-medium-left-open="1"]) .pane-folders .tree {
  display: none;
}


/* Collapse/pin control is not relevant in single-pane mode. */
body[data-single-mode="1"] #folders-collapse-btn {
  display: none;
}

.feeds-tab-bar {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--line);
  margin-bottom: 0.75rem;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}
.feeds-tab-btn {
  padding: 0.35rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font: inherit;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
}
.feeds-tab-btn:hover { color: var(--ink); }
.feeds-tab-btn--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.feeds-tab-count {
  display: inline-block;
  background: color-mix(in srgb, var(--muted) 20%, transparent);
  border-radius: 99px;
  padding: 0 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 1.1em;
  text-align: center;
}
.feeds-tab-panel { display: block; }
.feeds-tab-panel[hidden] { display: none; }

.problem-feed-tabs {
  display: flex;
  gap: 0.15rem;
  margin-bottom: 0.6rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.4rem;
}

.problem-tab-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.2rem 0.65rem;
  font: inherit;
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
}

.problem-tab-btn.active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--ink);
  font-weight: 600;
}

.problem-tab-btn:not(.active):hover {
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  color: var(--ink);
}

.problem-tab-count {
  display: inline-block;
  background: color-mix(in srgb, var(--muted) 20%, transparent);
  border-radius: 99px;
  padding: 0 0.35em;
  font-size: 0.78em;
  font-weight: 600;
  vertical-align: middle;
}

.problem-feed-action-ack:hover {
  color: #27ae60;
}

.problem-feed-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: min(56vh, 420px);
  overflow: auto;
}

.problem-feed-item {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.45rem 0.55rem;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
}

.problem-feed-row {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin-bottom: 0.22rem;
}

.problem-feed-link {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.problem-feed-link:hover {
  text-decoration: underline;
}

.problem-feed-actions {
  display: flex;
  gap: 0.15rem;
  flex: 0 0 auto;
}

.problem-feed-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
}

.problem-feed-action:hover {
  background: color-mix(in srgb, var(--ink) 10%, transparent);
  color: var(--ink);
}

.problem-feed-action-danger:hover {
  color: #c0392b;
}

.problem-feed-action .material-symbols-rounded {
  font-size: 1.05rem;
}

.problem-feed-meta {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--muted);
}

.problem-feed-error {
  margin-top: 0.22rem;
  font-size: 0.78rem;
}
.problem-feed-section-divider {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-top: 1px solid var(--line);
  margin: 0.75rem 0 0.4rem;
  padding-top: 0.5rem;
}
.inactive-feed-list {
  list-style: none !important;
  margin: 0;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.inactive-feed-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.inactive-feed-row:last-child { border-bottom: 0; }
.inactive-feed-folder {
  font-size: 0.78rem;
  color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inactive-feed-folder::after { content: " ›"; }
.inactive-feed-name {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
}
.inactive-feed-enable-btn {
  flex-shrink: 0;
  padding: 0.2rem 0.6rem;
  border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
  border-radius: 5px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.inactive-feed-enable-btn:hover {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
}


/* Pull-to-refresh indicator */
.ptr-indicator {
  position: fixed;
  left: 50%;
  top: 0;
  /* display:none is set by JS; transform is also managed entirely by JS */
  display: none;
  transform: translateX(-50%) translateY(-56px);
  align-items: center;
  justify-content: center;
  height: 56px;
  width: 56px;
  pointer-events: none;
  z-index: 9999;
  transition: none;
}

/* In folders pane, indicator is position:absolute inside .pane-folders.
   overflow:hidden on .pane-folders clips it when translated above the top. */
.pane-folders .ptr-indicator {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: auto;
  transform: translateY(-56px);
}

.ptr-indicator .ptr-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 2px 6px rgba(0,0,0,0.22);
  color: var(--accent, #1d6fbf);
  transition: transform 180ms ease;
}

.ptr-indicator.ptr-armed .ptr-icon {
  box-shadow: 0 3px 10px rgba(0,0,0,0.24);
}

.ptr-indicator.ptr-ready .ptr-icon {
  background: color-mix(in srgb, var(--accent, #1d6fbf) 14%, var(--surface));
}

.ptr-indicator.ptr-loading .ptr-icon {
  animation: ptr-spin 0.7s linear infinite;
}

@keyframes ptr-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}


.topbar-search-input {
  width: 100%;
  height: 2.05rem;
  border: 1px solid var(--field-border);
  border-radius: 999px;
  background: var(--field-bg);
  color: var(--ink);
  caret-color: var(--ink);
  padding: 0 0.8rem;
}

.topbar-search-input:focus,
.topbar-search-input:focus-visible {
  outline: none;
  border-color: var(--field-focus-border);
  box-shadow: 0 0 0 1px var(--field-focus-ring);
}

.topbar-search-input::placeholder {
  color: var(--muted);
}

.root-item-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.root-item-row .root-item {
  border-bottom: 0;
  flex: 1;
}

.saved-items-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.saved-items-row .saved-item {
  border-bottom: 0;
  flex: 1;
}

.saved-item {
  justify-content: flex-start;
  border-radius: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  height: var(--pane-heading-height);
  padding: 0 0.8rem;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: normal;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
}

.saved-item.active {
  color: var(--ink);
  background: var(--accent-soft);
  border-color: var(--active-border);
}

.saved-item:not(.active) {
  color: var(--muted);
}

.saved-item .name {
  flex: 0 0 auto;
}

.saved-items-icon {
  flex: 0 0 auto;
  font-size: 1rem;
  line-height: 1;
  font-variation-settings: "FILL" 0, "wght" 600, "GRAD" 0, "opsz" 24;
}

.saved-item.active .saved-items-icon {
  font-variation-settings: "FILL" 1, "wght" 700, "GRAD" 0, "opsz" 24;
}

/* Unread-only toggle — now lives in burger menu as a .menu-item */
.folders-unread-toggle.active {
  color: var(--accent);
}
.folders-unread-toggle.active .material-symbols-rounded {
  font-variation-settings: "FILL" 1, "wght" 700, "GRAD" 0, "opsz" 24;
}

.app-menu {
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  border-right: 1px solid var(--line);
  position: relative;
}

.topbar-menu.app-menu {
  border-right: 0;
}

.app-menu.hamburger-menu > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--pane-heading-height);
  height: var(--pane-heading-height);
  padding: 0;
  border-radius: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.app-menu.hamburger-menu > summary:hover {
  background: var(--hover-bg);
  color: var(--ink);
}

.menu-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.2rem 0.3rem 0.2rem 0.55rem;
  gap: 0.5rem;
}

.menu-brand {
  font-family: "Merriweather", Georgia, serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

.menu-divider {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 0.2rem 0;
}

.menu-checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
}

.menu-checkbox-item input {
  width: 0.95rem;
  height: 0.95rem;
  margin: 0;
  flex: 0 0 auto;
}

.flyout-item {
  position: relative;
}

.flyout-trigger {
  display: block;
  position: relative;
  cursor: default;
  user-select: none;
}

.flyout-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
  font-variation-settings: "FILL" 0, "wght" 600, "GRAD" 0, "opsz" 24;
  opacity: 0.55;
  margin: 0;
}

.flyout-label {
  display: block;
  min-width: 0;
}

.menu-popover.flyout-left .flyout-trigger {
  padding-left: 1.6rem;
  padding-right: 0.55rem;
}

.menu-popover.flyout-left .flyout-arrow {
  left: 0.55rem;
}

.menu-popover.flyout-left .flyout-label {
  text-align: left;
}

.menu-popover.flyout-right .flyout-trigger {
  padding-right: 1.35rem;
  padding-left: 0.55rem;
}

.menu-popover.flyout-right .flyout-arrow {
  right: 0.55rem;
}

.menu-popover.flyout-right .flyout-label {
  text-align: left;
}

.flyout-panel {
  display: none;
  position: absolute;
  top: 0;
  min-width: 160px;
  background: var(--elevated-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 0.25rem;
  z-index: 30;
  grid-gap: 0.2rem;
}

.menu-popover.flyout-left .flyout-panel {
  right: 100%;
  left: auto;
  margin-right: 0.35rem;
  margin-left: 0;
}

.menu-popover.flyout-right .flyout-panel {
  left: 100%;
  right: auto;
  margin-left: 0.35rem;
  margin-right: 0;
}

.flyout-item:hover .flyout-panel {
  display: grid;
}

.flyout-panel form {
  display: contents;
}

.refresh-status {
  color: var(--muted);
  font-size: 0.82rem;
}

.refresh-menu {
  position: relative;
}

.refresh-menu summary {
  cursor: pointer;
  list-style: none;
}

.refresh-menu summary::-webkit-details-marker {
  display: none;
}

.refresh-menu-options {
  position: absolute;
  left: 0;
  bottom: calc(100% + 0.45rem);
  min-width: 180px;
  display: grid;
  gap: 0.2rem;
  padding: 0.3rem;
  background: var(--elevated-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.refresh-option {
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  border-radius: 6px;
  padding: 0.4rem 0.5rem;
}

.refresh-option:hover {
  background: #f0f8fb;
}

.refresh-option.active {
  background: var(--accent-soft);
  color: var(--ink);
}

.panes {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--pane-left) var(--resizer-size) var(--pane-middle) var(--resizer-size) minmax(340px, 1fr);
  gap: 0;
  padding: var(--resizer-size);
  height: 100vh;
  overflow: hidden;
}

.pane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.pane h2 {
  margin: 0;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pane .entry-pane-title {
  text-transform: none;
  letter-spacing: 0;
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.25;
  border-bottom: 0;
  padding: 0;
  flex: 1;
  min-width: 0;
}

.entry-pane-title-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  min-width: 0;
}

.entry-pane-title-leading {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  flex: 0 0 auto;
}

.entry-pane-title-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
  flex: 0 0 auto;
}

.entry-source-mode-indicator {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.08rem 0.45rem;
  font-size: 0.72rem;
  line-height: 1.2;
  color: var(--muted);
  background: transparent;
}

.entry-pane-header {
  border-bottom: 1px solid var(--line);
  padding: 0.5rem 0.8rem;
}

.entry-pane-bottom-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.45rem;
}

.entry-pane-meta {
  margin-bottom: 0;
  margin-top: 0.2rem;
  width: 100%;
  justify-content: space-between;
  gap: 0.5rem;
}

.entry-meta-left {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  flex-wrap: wrap;
}

.entry-author-inline {
  color: var(--muted);
}

.entry-meta-time {
  margin-left: auto;
  white-space: nowrap;
}

.entry-pane-title-link {
  display: -webkit-box;
  color: inherit;
  text-decoration: none;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entry-pane-title-link:hover {
  text-decoration: underline;
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border-bottom: 1px solid var(--line);
}

.pane-header h2 {
  border-bottom: 0;
}

.hidden-panel[hidden] {
  display: none;
}

.stack-form {
  display: grid;
  gap: 0.45rem;
  padding: 0.7rem;
  border-bottom: 1px solid var(--line);
}

input, select, button {
  font: inherit;
  padding: 0.45rem 0.55rem;
}

button, .button-link {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

button:hover, .button-link:hover {
  opacity: 0.9;
}

.tree {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  padding: 0 0.3rem 0.3rem;
}

.posts {
  overflow: auto;
  padding: 0.38rem;
}

.post-item-hidden {
  display: none;
}

.posts-chunk-sentinel {
  height: 1px;
}

.posts-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.35rem 0.55rem 0.3rem;
  border-bottom: 1px solid var(--line);
}

.toolbar-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toolbar-search-row {
  margin-top: 0.25rem;
}

.toolbar-search-row .posts-search-form {
  width: 100%;
}

.toolbar-search-row .topbar-search-input {
  width: 100%;
}

.toolbar-search-hidden {
  display: none;
}

.sort-group {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
}

.toolbar-dropdown {
  position: relative;
  display: inline-flex;
}

.toolbar-dropdown > summary {
  list-style: none;
  cursor: pointer;
  gap: 0.25rem;
}

.toolbar-dropdown > summary::-webkit-details-marker {
  display: none;
}

.toolbar-dd-icon {
  font-size: 1.0rem;
  line-height: 1;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
}

.toolbar-dropdown-summary.active .toolbar-dd-icon {
  font-variation-settings: "FILL" 1, "wght" 700, "GRAD" 0, "opsz" 24;
}

.toolbar-dd-label {
  font-size: 0.78rem;
  font-weight: 500;
}

.toolbar-dd-chevron {
  font-size: 0.85rem;
  line-height: 1;
  color: var(--muted);
}

.toolbar-dropdown-popover {
  min-width: 160px;
  z-index: 1500;
}

.mark-read-group {
  position: relative;
}

.mark-read-menu {
  position: relative;
}

.mark-read-menu > summary {
  list-style: none;
}

.mark-read-menu > summary::-webkit-details-marker {
  display: none;
}

.mark-read-summary {
  /* auto-width to fit both glyphs; sort-pill provides height and border */
  width: auto;
  min-width: unset;
  padding: 0 0.35rem;
  gap: 0;
  color: var(--ink) !important;
  background: var(--accent-soft) !important;
  border-color: var(--active-border) !important;
  cursor: pointer;
}

.mark-read-trigger-icon {
  font-size: 1.06rem;
  line-height: 1;
  font-variation-settings: "FILL" 1, "wght" 650, "GRAD" 0, "opsz" 24;
}

.mark-read-trigger-caret {
  font-size: 1.1rem;
  line-height: 1;
  margin-left: -0.1rem;
  transition: transform 140ms ease;
}

.mark-read-menu[open] .mark-read-summary {
  background: var(--accent-soft);
  border-color: var(--active-border) !important;
}

.mark-read-menu[open] .mark-read-trigger-caret {
  transform: rotate(180deg);
}

.mark-read-popover {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  min-width: 200px;
  z-index: 60;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 0.3rem;
  display: grid;
  gap: 0.1rem;
}

.mark-read-divider {
  height: 1px;
  margin: 0.18rem 0.2rem 0.08rem;
  background: var(--line);
}

.mark-read-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.35rem 0.4rem;
}

.mark-read-header-label {
  margin: 0 0.1rem 0.08rem;
  padding: 0.1rem 0.4rem 0.08rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  line-height: 1.4;
}

.mark-read-section-label {
  margin: 0 0.1rem 0.05rem;
  padding: 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  line-height: 1.4;
}

.mark-read-action-form,
.mark-unread-action-form {
  margin: 0;
}

.mark-read-action {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--ink);
  padding: 0.36rem 0.45rem;
  text-align: left;
  font: inherit;
  font-size: 0.83rem;
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 0.38rem;
  cursor: pointer;
}

.mark-read-action-icon {
  font-size: 0.95rem;
  line-height: 1;
  flex-shrink: 0;
  color: var(--muted);
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
  transition: color 100ms;
}

.mark-read-action:hover {
  background: var(--accent-soft);
  border-color: var(--active-border);
}

.mark-read-action:hover .mark-read-action-icon {
  color: var(--ink);
}

.mark-read-action:disabled {
  opacity: 0.45;
  cursor: default;
}

.sort-pill,
.sort-arrow {
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 400;
  line-height: 1.2;
  text-transform: none;
  letter-spacing: 0;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
}

.sort-pill {
  height: 1.95rem;
  padding: 0 0.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.filter-pill {
  width: 1.95rem;
  min-width: 1.95rem;
  height: 1.95rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
}

.filter-icon {
  font-size: 1.08rem;
  line-height: 1;
  font-variation-settings: "FILL" 0, "wght" 600, "GRAD" 0, "opsz" 24;
}

.filter-pill.active .filter-icon {
  font-variation-settings: "FILL" 1, "wght" 700, "GRAD" 0, "opsz" 24;
}

.sort-arrow {
  width: auto;
  height: 1.95rem;
  min-width: 1.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.5rem;
}

.sort-arrow .material-symbols-rounded {
  font-size: 1.06rem;
  line-height: 1;
  font-variation-settings: "FILL" 1, "wght" 600, "GRAD" 0, "opsz" 24;
}

.sort-pill.active,
.sort-arrow.active {
  color: var(--ink);
  background: var(--accent-soft);
  border-color: var(--active-border);
}

.tree-block {
  border-bottom: 1px solid var(--tree-line);
  padding-bottom: 0.25rem;
  margin-bottom: 0.2rem;
}

.root-tree-block {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border-bottom: 0;
  margin-bottom: 0;
}

.tags-tree-block {
  flex: 0 0 auto;
  margin-top: auto;
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: 0;
  border-top: 1px solid var(--tree-line);
}

.section-block-header {
  padding: 0.45rem 0.5rem;
  margin: 0 0 0.2rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.tags-header-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
}

.tags-header {
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  color: var(--muted);
}

.tags-collapse-chevron {
  margin-left: auto;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.tags-tree-body {
  max-height: min(35vh, 260px);
  overflow: auto;
}

.tags-tree-block.is-collapsed .tags-tree-body {
  display: none;
}

.tags-tree-block.is-collapsed .tags-collapse-chevron {
  transform: rotate(-90deg);
}

.tags-empty {
  padding: 0.45rem 0.5rem 0.2rem;
}

.tree-children {
  margin-top: 0.2rem;
  padding-left: 0.7rem;
}

.tree-folder-group {
  margin-bottom: 0.1rem;
}

.tree-folder-row {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.tree-toggle,
.tree-toggle-spacer {
  width: 1rem;
  flex: 0 0 1rem;
}

.tree-toggle {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  cursor: pointer;
  line-height: 1;
}

.tree-toggle .material-symbols-rounded {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
  font-variation-settings: "FILL" 0, "wght" 600, "GRAD" 0, "opsz" 24;
}

.tree-toggle.expanded {
  transform: rotate(90deg);
}

.tree-toggle-spacer {
  display: inline-block;
}

.tree-item, .post-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 0.5rem;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.45rem 0.5rem;
}

.post-item.post-item-hidden {
  display: none;
}

.post-item {
  position: relative;
  align-items: stretch;
  flex-direction: row;
  cursor: pointer;
  overflow: hidden;
  padding: 0;
  gap: 0;
  margin-bottom: 0.34rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 97%, transparent);
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
  --post-swipe-offset: 0px;
  --post-swipe-progress: 0;
  --post-stack-gap: 0.34rem;
}

.post-item:last-of-type {
  margin-bottom: 0;
}

.post-item-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.1rem;
  min-width: 0;
  padding: 0;
  flex: 1 1 auto;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  transform: translateX(var(--post-swipe-offset));
  transition: transform 180ms ease, box-shadow 180ms ease, background 140ms ease;
  will-change: transform;
  touch-action: pan-y;
}

.post-item.is-swiping .post-item-card {
  transition: none;
}

.post-item.post-swipe-commit .post-item-card {
  box-shadow: 0 10px 24px color-mix(in srgb, var(--bg-bottom) 28%, transparent);
}

.post-swipe-actions {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.post-swipe-action {
  flex: 1 1 50%;
  display: flex;
  align-items: center;
  min-width: 0;
  color: #f8fbff;
  opacity: calc(0.3 + (var(--post-swipe-progress) * 0.7));
}

.post-swipe-action-read {
  justify-content: flex-start;
  padding: 0 0.9rem;
  background: color-mix(in srgb, var(--accent) 76%, #12283a);
}

.post-swipe-action-save {
  justify-content: flex-end;
  padding: 0 0.9rem;
  background: color-mix(in srgb, #d2a23d 78%, #543b11);
}

.post-swipe-copy {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.post-swipe-icon.material-symbols-rounded {
  font-size: 1rem;
  line-height: 1;
  font-variation-settings: "FILL" 1, "wght" 600, "GRAD" 0, "opsz" 24;
}

.post-item[data-swipe-direction="right"] .post-swipe-action-save,
.post-item[data-swipe-direction="left"] .post-swipe-action-read {
  opacity: 0.15;
}

.post-title-row {
  min-width: 0;
}

.post-content {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.06rem;
  padding: calc(var(--post-stack-gap) / 2) 0.34rem;
}

.post-thumbnail {
  position: relative;
  flex: 0 0 4.5rem;
  width: 4.5rem;
  min-width: 4.5rem;
  height: var(--post-tile-height, 84px);
  min-height: var(--post-tile-height, 84px);
  max-height: var(--post-tile-height, 84px);
  align-self: stretch;
  overflow: hidden;
  border-radius: 0;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--accent) 18%, transparent), transparent 52%),
    linear-gradient(160deg, color-mix(in srgb, var(--surface) 72%, var(--bg-top)), color-mix(in srgb, var(--surface) 92%, var(--bg-bottom)));
  box-shadow: inset -1px 0 0 color-mix(in srgb, var(--line) 82%, transparent);
}

.post-thumbnail-image {
  display: block;
  width: 100%;
  height: 100%;
  max-height: var(--post-tile-height, 84px);
  object-fit: cover;
}


.post-thumbnail.is-empty {
  display: none;
}

/* crop-left: legacy alias kept for any cached pages */
.post-thumbnail.crop-left .post-thumbnail-image { object-position: left center; }
/* cover position variants */
.post-thumbnail.crop-cover-top-left .post-thumbnail-image    { object-position: left top; }
.post-thumbnail.crop-cover-top .post-thumbnail-image         { object-position: center top; }
.post-thumbnail.crop-cover-top-right .post-thumbnail-image   { object-position: right top; }
.post-thumbnail.crop-cover-left .post-thumbnail-image        { object-position: left center; }
.post-thumbnail.crop-cover-right .post-thumbnail-image       { object-position: right center; }
.post-thumbnail.crop-cover-bottom-left .post-thumbnail-image { object-position: left bottom; }
.post-thumbnail.crop-cover-bottom .post-thumbnail-image      { object-position: center bottom; }
.post-thumbnail.crop-cover-bottom-right .post-thumbnail-image{ object-position: right bottom; }

/* crop-contain: letterbox — keep full image, blank bars from theme bg */
.post-thumbnail.crop-contain {
  background: var(--bg);
}
.post-thumbnail.crop-contain .post-thumbnail-image {
  object-fit: contain;
}

/* crop-smart: keep full image with blurred backdrop fill */
.post-thumbnail.crop-smart {
  background-size: cover;
  background-position: center;
}
.post-thumbnail.crop-smart::after {
  content: '';
  position: absolute;
  inset: 0;
  backdrop-filter: blur(12px) brightness(0.55) saturate(0.8);
}
.post-thumbnail.crop-smart .post-thumbnail-image {
  position: relative;
  z-index: 1;
  object-fit: contain;
}

.post-main-link {
  display: block;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.post-feed-row {
  width: 100%;
  min-width: 0;
}

.post-bottom-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.06rem;
  width: 100%;
  min-width: 0;
  padding: 0 0.34rem calc(var(--post-stack-gap) / 2);
}

.post-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  width: 100%;
  min-width: 0;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  min-width: 0;
}

.post-read-toggle-form {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
}

.post-read-toggle {
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  width: 1.3rem;
  height: 1.3rem;
  padding: 0;
  margin: 0;
  min-width: 1.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  cursor: pointer;
  border-radius: 999px;
}

.post-read-toggle:hover {
  opacity: 1;
}

.post-read-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 999px;
}

.post-save-toggle-form {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
}

.post-meta-actions {
  display: inline-flex;
  align-items: flex-start;
  gap: 0;
  flex: 0 0 auto;
}

.post-save-toggle {
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  width: 1.3rem;
  height: 1.3rem;
  padding: 0;
  margin: 0;
  min-width: 1.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  cursor: pointer;
  font-size: 1rem;
  border-radius: 999px;
}

.post-save-toggle:hover {
  opacity: 1;
}

.post-save-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 999px;
}

.post-save-indicator {
  pointer-events: none;
}

.post-save-indicator.material-symbols-rounded {
  font-size: 1.1rem;
  line-height: 1;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
}

.post-save-toggle[title^="Remove"] .post-save-indicator.material-symbols-rounded {
  font-variation-settings: "FILL" 1, "wght" 600, "GRAD" 0, "opsz" 24;
}

.post-feed {
  cursor: pointer;
  border-radius: 3px;
}

.post-feed:hover .feed-name {
  text-decoration: underline;
}

.post-item.is-read {
  border-color: transparent;
}

.tree-item .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  color: var(--folder-name-ink, var(--ink));
}

.root-item,
.child-item {
  flex: 1;
}

.root-item {
  justify-content: flex-start;
  border-radius: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  height: var(--pane-heading-height);
  padding: 0 0.8rem;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: normal;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.root-item.active {
  color: var(--ink);
  background: var(--accent-soft);
  border-color: var(--active-border);
}

.root-item .count {
  margin-left: auto;
}

.root-item .name {
  flex: 0 0 auto;
}

.tree-item.active {
  background: var(--accent-soft);
  border-color: var(--active-border);
}

.post-item.active {
  border-color: var(--active-border);
}

.post-item.active .post-item-card {
  background: var(--accent-soft);
}

.tree-item:hover {
  background: var(--hover-bg);
}

.post-item:hover .post-item-card {
  background: var(--hover-bg);
}

.post-item.active {
  border-color: var(--active-border);
  background: color-mix(in srgb, var(--accent-soft) 65%, var(--surface));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--active-border) 38%, transparent);
}

.post-item:hover {
  background: var(--hover-bg);
}

.count {
  color: var(--muted);
  font-size: 0.85rem;
}

.feed-error-badge {
  font-size: 0.72rem;
  color: #c97a00;
  line-height: 1;
  flex-shrink: 0;
}

.feed-push-badge {
  font-size: 0.65rem;
  opacity: 0.45;
  line-height: 1;
  flex-shrink: 0;
  cursor: default;
  user-select: none;
}

.post-title {
  flex: 1;
  font-weight: 700;
  font-size: var(--post-title-size);
  line-height: 1.24;
  line-clamp: 2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-read-indicator.material-symbols-rounded {
  flex: 0 0 auto;
  font-size: 1rem;
  line-height: 1;
  color: var(--accent);
  font-variation-settings: "FILL" 1, "wght" 600, "GRAD" 0, "opsz" 20;
  pointer-events: none;
}

.post-item.is-read .post-title {
  color: var(--muted);
  font-weight: 600;
}

.post-item.is-read .post-meta,
.post-item.is-read .post-feed,
.post-item.is-read .post-time,
.post-item.is-read .feed-name {
  color: color-mix(in srgb, var(--muted) 88%, var(--bg));
}

.post-item.is-read .feed-favicon,
.post-item.is-read .feed-icon,
.post-item.is-read .post-thumbnail-image {
  opacity: 0.6;
}

.post-item.is-read .post-read-indicator.material-symbols-rounded {
  color: color-mix(in srgb, var(--muted) 80%, var(--bg));
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 20;
}

.post-feed {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
  max-width: 100%;
  min-width: 0;
  color: inherit;
  font-size: 0.83rem;
  color: color-mix(in srgb, var(--muted) 90%, var(--bg));
}

.feed-icon {
  flex: 0 0 auto;
  font-size: 0.85rem;
  opacity: 0.85;
}

.feed-icon.material-symbols-rounded {
  font-size: 0.95rem;
  line-height: 1;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 20;
}

.feed-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.post-feed-link {
  color: inherit;
  text-decoration: none;
}

.post-feed-link:hover {
  text-decoration: underline;
}

/* Dim feeds and folders with no unread items. */
.tree-feed-item[data-unread-count="0"] > .feed-link:not(.active) {
  opacity: 0.6;
}
.tree-folder-group[data-unread-count="0"] .tree-item:not(.active):not(.root-item) {
  opacity: 0.6;
}

.post-time {
  flex: 0 0 auto;
  padding-left: 0;
  white-space: nowrap;
  color: inherit;
  font-size: 0.83rem;
  color: color-mix(in srgb, var(--muted) 90%, var(--bg));
}

@media (max-width: 720px) {
  .post-thumbnail {
    flex-basis: 4rem;
    width: 4rem;
    min-width: 4rem;
  }

  .post-content {
    padding-left: 0.56rem;
  }
}

.feed-list {
  margin: 0.3rem 0 0;
  padding-left: 1rem;
  list-style: none;
}

.tree-feed-list,
.tree-root-feed-list {
  margin-top: 0.1rem;
  margin-bottom: 0.3rem;
}

.tree-feed-list {
  padding-left: 1.6rem;
}

.tree-root-feed-list {
  padding-left: 1rem;
}

.feed-list li {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-list {
  margin-top: 0;
  padding-left: 0;
}

.feed-link {
  color: var(--muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 0.45rem;
  border-radius: 4px;
  padding: 0.2rem 0.3rem;
}

.feed-label {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 0.4rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-label > span {
  display: block;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-favicon {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex: 0 0 14px;
}

.feed-link:hover {
  background: var(--hover-bg);
}

.feed-link.active {
  color: var(--ink);
  background: var(--accent-soft);
}

.tag-link {
  color: var(--muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 0.45rem;
  border-radius: 4px;
  padding: 0.24rem 0.3rem;
}

.tag-link:hover {
  background: var(--hover-bg);
}

.tag-link.active {
  color: var(--ink);
  background: var(--accent-soft);
}

.tag-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-meta, .muted, .entry-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.entry {
  flex: 1;
  min-height: 0;
  padding: 0.8rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.entry-body {
  min-height: 0;
  overflow: auto;
}

.entry h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.35rem;
  line-height: 1.3;
}

.entry-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.7rem;
}

.entry-pane-meta {
  margin-bottom: 0;
}

.entry-feed-link {
  color: inherit;
  text-decoration: none;
  border-radius: 3px;
}

.entry-feed-link:hover {
  text-decoration: underline;
}

.entry-meta-separator {
  color: var(--muted);
}

.entry-source-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.8rem;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  padding: 0;
  margin: 0;
}

.entry-source-button .material-symbols-rounded {
  font-size: 0.95rem;
  line-height: 1;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
}

.entry-source-button:hover {
  color: var(--ink);
  border-color: var(--active-border);
  background: var(--accent-soft);
}

.entry-save-toggle-form {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
}

.entry-read-toggle-form {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
}

.entry-header-toggle {
  border-radius: 999px;
}

.entry-save-toggle {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.3rem 0.35rem;
  margin: 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.entry-save-toggle:hover {
  opacity: 1;
}

.entry-save-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.entry-save-indicator {
  pointer-events: none;
}

.entry-save-indicator.material-symbols-rounded {
  font-size: 1.1rem;
  line-height: 1;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
}

.entry-save-toggle[title^="Remove"] .entry-save-indicator.material-symbols-rounded {
  font-variation-settings: "FILL" 1, "wght" 600, "GRAD" 0, "opsz" 24;
}

.entry-read-toggle {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.3rem 0.35rem;
  margin: 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.entry-read-toggle:hover {
  opacity: 1;
}

.entry-read-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.entry-read-indicator.material-symbols-rounded {
  font-size: 1rem;
  line-height: 1;
  color: var(--accent);
  font-variation-settings: "FILL" 1, "wght" 600, "GRAD" 0, "opsz" 20;
  pointer-events: none;
}

.entry-read-toggle[data-read-state="1"] .entry-read-indicator.material-symbols-rounded {
  color: color-mix(in srgb, var(--muted) 80%, var(--bg));
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 20;
}

.entry-tags-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
  width: 100%;
}

/* Separator between the action toggles and tag chips */
.entry-tags-row-sep {
  display: inline-block;
  width: 1px;
  height: 1rem;
  background: var(--line);
  margin: 0 0.1rem;
  flex: 0 0 auto;
  align-self: center;
}

.entry-tags-form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.entry-tags-form[hidden] {
  display: none !important;
}

.entry-tag-add-button {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.3rem 0.35rem;
  margin: 0;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s;
}

.entry-tag-add-button .material-symbols-rounded {
  font-size: 0.95rem;
  line-height: 1;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
}

.entry-tag-add-button:hover {
  color: var(--ink);
  opacity: 1;
}

.entry-tag-suggestions {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  width: auto;
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--line);
}

.entry-tags-input {
  width: 12ch;
  min-width: 8ch;
  max-width: 18ch;
  flex: 0 1 auto;
  border: 1px solid var(--field-border);
  border-radius: 999px;
  background: var(--field-bg);
  color: var(--ink);
  caret-color: var(--ink);
  padding: 0.08rem 0.45rem;
  font: inherit;
  font-size: 0.76rem;
  line-height: 1.2;
}

.entry-tags-input:focus,
.entry-tags-input:focus-visible {
  outline: none;
  border-color: var(--field-focus-border);
  box-shadow: 0 0 0 1px var(--field-focus-ring);
}

.entry-tags-submit {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 0.08rem 0.45rem;
  font-size: 0.76rem;
  line-height: 1.2;
}

.entry-tags-submit:hover {
  color: var(--ink);
  border-color: var(--active-border);
  background: var(--accent-soft);
}

.entry-pane-alt-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
  flex: 0 0 auto;
}

.entry-tag-chip-row {
  display: flex;
  align-items: center;
  gap: 0.32rem;
  flex-wrap: wrap;
}

.entry-tag-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.08rem 0.45rem;
  font-size: 0.76rem;
  line-height: 1.2;
}

.entry-tag-chip.manual {
  color: var(--ink);
  border-color: var(--active-border);
  background: var(--accent-soft);
}

.entry-tag-link {
  color: var(--link);
  font-size: 0.78rem;
  line-height: 1.2;
  text-decoration: none;
}

.entry-tag-link:hover,
.entry-tag-link.active {
  color: var(--link-hover);
  text-decoration: underline;
}

.entry-tag-chip-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
}

.entry-tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  width: 1rem;
  height: 1rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease, color 0.12s ease, background 0.12s ease;
}

.entry-tag-chip-wrap:hover .entry-tag-remove,
.entry-tag-remove:focus-visible {
  opacity: 1;
}

.entry-tag-remove:hover {
  color: var(--danger, #c0392b);
  background: var(--surface-2, rgba(127, 127, 127, 0.15));
}

.entry-tag-remove[disabled] {
  opacity: 0.4;
  cursor: default;
}

.entry-tag-chip.suggestion {
  color: var(--muted);
  background: transparent;
  opacity: 0.85;
  cursor: pointer;
}

.entry-tag-chip.suggestion:hover {
  opacity: 1;
  color: var(--ink);
  border-color: var(--line);
}

.entry-tag-suggestion-label {
  color: var(--muted);
  font-size: 0.76rem;
}

.entry-source-button.active {
  color: var(--ink);
  border-color: var(--active-border);
  background: var(--accent-soft);
}

.entry-readability-container {
  display: none;
}
.entry-readability-container:not([hidden]) {
  display: block;
  padding: 0.5rem 0.25rem 2rem;
  font-family: Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--ink);
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.entry-readability-loading { color: var(--muted); font-style: italic; font-family: var(--ui-font, sans-serif); }
.entry-readability-lead-image {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 0 0 1.2rem;
}
.entry-readability-content img {
  max-width: 100%;
  height: auto;
}
.entry-readability-content a { color: var(--link, #0a5ca4); }
.entry-readability-content pre { white-space: pre-wrap; }
/* Override CMS inline color/background styles (e.g. Blogger white-background spans) */
.entry-readability-content * {
  background-color: transparent !important;
  color: inherit !important;
}

.entry-source-frame {
  display: none;
}

.entry-source-frame:not([hidden]) {
  display: block;
  border: 0;
  width: 100%;
  flex: 1;
  min-height: 0;
  border-radius: 6px;
  background: white;
  align-self: stretch;
  height: 100%;
}

.entry-source-fallback {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 88%, black 12%);
  box-shadow: var(--shadow);
  z-index: 10;
}

.entry-source-fallback[hidden] {
  display: none;
}

.entry-source-fallback-title {
  color: var(--ink);
  font-size: 0.87rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.entry-source-fallback-text {
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.45rem;
}

.entry-source-open-external {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.8rem;
}

.entry-source-open-external:hover {
  border-color: var(--active-border);
  background: var(--accent-soft);
}

.entry-source-fallback-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.entry-source-dismiss {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  font-size: 0.8rem;
}

.entry-source-dismiss:hover {
  color: var(--ink);
  border-color: var(--active-border);
  background: var(--accent-soft);
}

.entry.source-active {
  position: relative;
  padding: 0;
  gap: 0;
}

.entry.source-active .entry-source-frame:not([hidden]) {
  border-radius: 0;
}

/* Ensure the iframe grows to fill the entry area when source view is active.
   Use explicit flex settings so it behaves correctly across browsers and
   inside nested scrolling/flex containers (fixes clipped/short iframe).
   Guard with :not([hidden]) so reader-view (which also uses source-active)
   cannot accidentally show the iframe. */
.entry.source-active .entry-source-frame:not([hidden]) {
  display: block;
  flex: 1 1 auto;
  align-self: stretch;
  min-height: 0;
  height: auto;
  width: 100%;
}

.entry-content {
  line-height: 1.45;
  /* clip horizontal overflow without creating a scroll container (which would
     force overflow-y:auto and add a spurious inner vertical scrollbar) */
  overflow-x: clip;
}

.audio-feed-suggestion {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line, #ccc);
  border-radius: 8px;
  background: rgba(127, 127, 127, 0.08);
  font-size: 0.9rem;
}
.audio-feed-suggestion-icon { font-size: 1.1rem; }
.audio-feed-suggestion-text { flex: 1 1 12rem; opacity: 0.85; }
.audio-feed-suggestion-btn {
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--accent, #3a7afe);
  border-radius: 6px;
  background: var(--accent, #3a7afe);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}
.audio-feed-suggestion-btn:hover { filter: brightness(1.08); }

.entry-content table {
  max-width: 100%;
}

.entry-content pre {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
}

.entry-lead-image {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  margin: 0 0 0.85rem;
}

/* Inline-SVG (vector) lead images carry only a small intrinsic viewBox size,
   so render them at a consistent, readable display width instead of their
   tiny natural pixels. Aspect ratio is preserved by height:auto. */
.entry-lead-image--vector {
  width: min(320px, 100%);
  height: auto;
}

.entry-lead-image-popped {
  animation: lead-image-pop-in 0.3s ease-out;
}

@keyframes lead-image-pop-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.entry-content figure {
  margin: 0.5em 0;
  margin-left: 0;
  margin-right: 0;
  margin-inline-start: 0;
  margin-inline-end: 0;
}

/* Tumblr NPF gallery rows — render side-by-side images correctly without Tumblr's CSS */
.entry-content .npf_row {
  display: flex;
  gap: 4px;
  margin: 0.5em 0;
  overflow: hidden;
}
.entry-content .npf_row figure {
  flex: 1;
  margin: 0;
  margin-left: 0;
  margin-right: 0;
  margin-inline-start: 0;
  margin-inline-end: 0;
  min-width: 0;
  overflow: hidden;
}
.entry-content .npf_row figure img {
  width: 100%;
  height: auto;
  display: block;
}

.entry-content img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Inline emoji glyphs embedded in post bodies: WordPress wp-smiley (s.w.org),
   IP.Board ipsEmoji, and twemoji's "emoji" class. The source sites size these
   to ~1em via their own CSS; without it the general .entry-content img rule
   above renders them as full-size 72×72 block images (e.g. Vintage Story's 🙃).
   Constrain to text height and keep them inline so they read as emoji. */
.entry-content img.wp-smiley,
.entry-content img.emoji,
.entry-content img.ipsEmoji {
  display: inline-block;
  width: auto;
  height: 1.2em !important;
  max-height: 1.2em;
  margin: 0 0.05em;
  vertical-align: -0.2em;
}

/* Math formula images from Sphinx/dvisvgm blogs (eli.thegreenplace.net, etc.).
   The feed ships each glyph's true rendered px height (preserved onto the img's
   height attribute by html_sanitize) plus a valign-* baseline class. Honor both:
   inline variables/expressions flow within text at author-intended size and sit on
   the text baseline; block (display) equations center and shrink responsively.
   The height attribute drives size, so we set width:auto (intrinsic aspect) and do
   NOT declare a CSS height (which would override the attribute). */
.entry-content img[class*="valign-"] {
  display: inline;
  width: auto;
  max-width: 100%;
  vertical-align: baseline; /* overridden per valign-* class below */
}
/* Math imgs lacking a stamped height (older content / no inline style) fall back to
   roughly one line tall instead of rendering at tiny intrinsic pt. */
.entry-content img[class*="valign-"]:not([height]) {
  height: 1.15em;
}
/* valign-mN: the image baseline sits N px below the text baseline; valign-N above.
   These px offsets are correct because we preserve the native px height. */
.entry-content img.valign-0  { vertical-align: 0; }
.entry-content img.valign-m1  { vertical-align: -1px; }
.entry-content img.valign-m2  { vertical-align: -2px; }
.entry-content img.valign-m3  { vertical-align: -3px; }
.entry-content img.valign-m4  { vertical-align: -4px; }
.entry-content img.valign-m5  { vertical-align: -5px; }
.entry-content img.valign-m6  { vertical-align: -6px; }
.entry-content img.valign-m7  { vertical-align: -7px; }
.entry-content img.valign-m8  { vertical-align: -8px; }
.entry-content img.valign-m9  { vertical-align: -9px; }
.entry-content img.valign-m10 { vertical-align: -10px; }
.entry-content img.valign-m11 { vertical-align: -11px; }
.entry-content img.valign-m12 { vertical-align: -12px; }
.entry-content img.valign-m13 { vertical-align: -13px; }
.entry-content img.valign-m14 { vertical-align: -14px; }
.entry-content img.valign-m15 { vertical-align: -15px; }
.entry-content img.valign-m16 { vertical-align: -16px; }
.entry-content img.valign-m17 { vertical-align: -17px; }
.entry-content img.valign-m18 { vertical-align: -18px; }
.entry-content img.valign-m19 { vertical-align: -19px; }
.entry-content img.valign-m20 { vertical-align: -20px; }
.entry-content img.valign-1  { vertical-align: 1px; }
.entry-content img.valign-2  { vertical-align: 2px; }
.entry-content img.valign-3  { vertical-align: 3px; }
.entry-content img.valign-4  { vertical-align: 4px; }
.entry-content img.valign-5  { vertical-align: 5px; }
.entry-content img.valign-6  { vertical-align: 6px; }
.entry-content img.valign-7  { vertical-align: 7px; }
.entry-content img.valign-8  { vertical-align: 8px; }
.entry-content img.valign-9  { vertical-align: 9px; }
.entry-content img.valign-10 { vertical-align: 10px; }
/* Block (display) equations. The stamped height drives size; max-width:100% +
   object-fit:contain shrink wide equations uniformly (no distortion) on narrow
   columns. Covers SVG (lectio-math-svg) and older PNG display math. */
.entry-content img.align-center {
  display: block;
  margin: 0.8em auto;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}
.entry-content img.align-center:not([height]) {
  height: auto;
}

.entry-content iframe {
  /* Unify every embed (Bandcamp, SoundCloud, Spotify, etc.) to the same footprint
     as the inline YouTube player: full column width, capped at 560px, centered.
     A feed-supplied width="540"/"100" attribute would otherwise leave players
     inconsistently sized or tiny. Height stays as the embed declares it (audio
     players need their own height; forcing 16:9 would crop the controls). */
  width: 100%;
  max-width: 560px;
  display: block;
  margin: 1em auto;
}
/* Video embeds: width:100% would stretch the width while leaving the feed's small
   height attr untouched, producing skinny letterbox stripes. Force 16:9. */
.entry-content iframe[src*="youtube.com"],
.entry-content iframe[src*="youtube-nocookie.com"],
.entry-content iframe[src*="youtu.be"],
.entry-content iframe[src*="vimeo.com"],
.entry-content iframe[src*="dailymotion.com"],
.entry-content iframe[src*="twitch.tv"] {
  aspect-ratio: 16 / 9;
  height: auto;
}
/* Bandcamp players ship with no height attr (default ~150px → empty space below
   the player). Set the heights Bandcamp documents per size/artwork combination. */
.entry-content iframe[src*="bandcamp.com/EmbeddedPlayer"] {
  height: 470px;  /* size=large with album art */
}
.entry-content iframe[src*="bandcamp.com/EmbeddedPlayer"][src*="artwork=small"],
.entry-content iframe[src*="bandcamp.com/EmbeddedPlayer"][src*="artwork=none"] {
  height: 120px;
}
.entry-content iframe[src*="bandcamp.com/EmbeddedPlayer"][src*="size=small"] {
  height: 42px;
}
/* SoundCloud's classic player has a fixed height; don't force it into a 16:9 box. */
.entry-content iframe[src*="soundcloud.com"] {
  height: 166px;
}
/* The inline YouTube player already sits in a 560px centered container with the
   look we're matching — keep its iframe margin/width untouched. */
.entry-content .youtube-embed-container iframe {
  margin: 0;
  max-width: none;
}
.entry-content video {
  /* width="..." HTML attribute can override max-width; use width:100% to
     ensure the video fills the column and never causes a horizontal scrollbar */
  width: 100%;
  height: auto;
}
.entry-content figure {
  max-width: 100%;
  overflow: hidden;
}

/* Inline SVG icons inside links/buttons (e.g. Bootstrap btn with embedded icon).
   Without the originating site's CSS these render at their default SVG size
   (300×150 or 300×300 for a square viewBox). Cap them to 1em so they behave
   like normal inline icons. Standalone SVG diagrams (not wrapped in <a>/<button>)
   fall through to the general img-style rule below. */
.entry-content a svg,
.entry-content button svg {
  display: inline-block;
  width: 1em;
  height: 1em;
  max-width: 1em;
  max-height: 1em;
  overflow: hidden;
  vertical-align: -0.15em;
}

/* PCGamer (and similar Future Publishing sites) use an aspect-ratio placeholder
   pattern: <p class="vanilla-image-block" style="padding-top: 56.27%"> with the
   image NOT absolutely positioned in our reader context. Strip the inline padding
   so the whitespace before the image disappears. */
.entry-content .vanilla-image-block {
  padding-top: 0 !important;
}
.entry-content .vanilla-image-block img {
  position: static !important;
}

.entry-text {
  white-space: pre-wrap;
  font-family: "Source Sans 3", sans-serif;
}

.entry-image-title-text {
  margin: 0.6rem 0 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--ink-mid, color-mix(in srgb, var(--ink) 75%, transparent));
  border-left: 3px solid var(--line);
  line-height: 1.5;
}

.action-modal-textarea {
  width: 100%;
  min-height: 12rem;
  padding: 0.75rem 0.85rem;
  resize: vertical;
  background: var(--field-elevated-bg);
  border: 1px solid var(--field-border);
  border-radius: 8px;
  color: var(--ink);
  caret-color: var(--ink);
  outline: none;
}

.action-modal-textarea:focus,
.action-modal-textarea:focus-visible {
  border-color: var(--field-focus-border);
  box-shadow: 0 0 0 1px var(--field-focus-ring);
}

.action-modal-form input[type="text"],
.action-modal-form input[type="email"] {
  width: 100%;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  background: var(--field-elevated-bg);
  color: var(--ink);
  caret-color: var(--ink);
  outline: none;
}

.action-modal-form input[type="text"]:focus,
.action-modal-form input[type="text"]:focus-visible,
.action-modal-form input[type="email"]:focus,
.action-modal-form input[type="email"]:focus-visible {
  border-color: var(--field-focus-border);
  box-shadow: 0 0 0 1px var(--field-focus-ring);
}

.empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.empty-state-message {
  max-width: 22rem;
  line-height: 1.5;
}

.inline-form {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}

.theme-toggle {
  border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 88%, black 12%);
  color: white;
  cursor: pointer;
  width: 1.7rem;
  height: 1.7rem;
  min-width: 1.7rem;
  text-align: center;
  padding: 0;
  border-radius: 999px;
  font-size: 0.85rem;
  line-height: 1;
}

.menu-popover .theme-toggle {
  width: auto;
  height: auto;
  min-width: 0;
  border-radius: 6px;
  padding: 0.45rem 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-align: left;
  font-size: inherit;
}

.theme-toggle .material-symbols-rounded {
  font-size: 1rem;
  line-height: 1;
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24;
}

.theme-toggle:hover {
  background: color-mix(in srgb, var(--accent) 96%, white 4%);
}

.hamburger-menu {
  position: relative;
}

.hamburger-menu summary {
  list-style: none;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  cursor: pointer;
  min-width: 2.1rem;
  text-align: center;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  user-select: none;
}

.hamburger-menu summary .material-symbols-rounded {
  font-size: 1.2rem;
  line-height: 1;
  font-variation-settings: "FILL" 0, "wght" 600, "GRAD" 0, "opsz" 24;
}

.hamburger-menu summary::-webkit-details-marker {
  display: none;
}

.menu-popover {
  position: absolute;
  top: calc(100% + 0.35rem);
  min-width: 240px;
  background: var(--elevated-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 0.25rem;
  display: grid;
  gap: 0.2rem;
  z-index: 1000;
}

.menu-popover.anchor-left {
  left: 0;
  right: auto;
}

.menu-popover.anchor-right {
  right: 0;
  left: auto;
}

.menu-item {
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  border-radius: 6px;
  padding: 0.45rem 0.55rem;
  cursor: pointer;
}

.menu-item:hover {
  background: var(--hover-bg);
}

.history-menu-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.menu-popover .menu-item > .material-symbols-rounded:not(.flyout-arrow) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 1rem;
  block-size: 1rem;
  font-size: 1rem;
  line-height: 1;
  flex: 0 0 auto;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 20;
}

.file-item {
  display: block;
}

.toast-message {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  max-width: min(92vw, 32rem);
  border: 1px solid var(--line);
  background: var(--toast-bg);
  color: var(--ink);
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 1200;
  opacity: 1;
  pointer-events: auto;
  text-align: center;
  transition: opacity 0.5s ease;
}

.toast-action-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 0.88em;
  padding: 0;
  margin-left: 0.4em;
  text-decoration: underline;
}

.toast-message.fade-out {
  opacity: 0;
}

.pane-resizer {
  width: var(--resizer-size);
  cursor: col-resize;
  border-radius: 6px;
  background: transparent;
}

.pane-resizer:hover {
  background: var(--resizer-hover);
}

body.resizing {
  cursor: col-resize;
  user-select: none;
}

.context-menu {
  position: fixed;
  z-index: 50;
  width: 210px;
  min-width: 210px;
  max-width: 210px;
  background: var(--elevated-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 0.25rem;
}

.context-menu[hidden] {
  display: none;
}

.context-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
}

.context-menu-item:hover {
  background: var(--hover-bg);
}

.context-menu-item.danger {
  color: var(--danger);
}

.context-menu-item.danger:disabled {
  color: var(--danger-muted);
}

#post-context-menu {
  width: 170px;
  min-width: 170px;
  max-width: 170px;
}

.context-submenu-wrap {
  position: relative;
}

.context-submenu-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.submenu-arrow {
  font-size: 0.95rem;
  line-height: 1;
  font-variation-settings: "FILL" 0, "wght" 600, "GRAD" 0, "opsz" 24;
  opacity: 0.8;
}

.context-submenu {
  position: fixed;
  left: 0;
  top: 0;
  min-width: 220px;
  max-height: 320px;
  overflow: auto;
  background: var(--elevated-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 0.25rem;
}

.context-submenu[hidden] {
  display: none;
}

.context-submenu-item {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.context-submenu-item--child {
  padding-inline-start: 1.4rem;
}

.action-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  padding: 2rem 1.5rem;
}

.action-modal[hidden] {
  display: none;
}

.action-modal-panel {
  width: min(440px, 100%);
  min-width: min(320px, 100%);
  min-height: 20rem;
  max-width: calc(100vw - 3rem);
  max-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  background: var(--elevated-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: auto;
  padding: 0.9rem;
  resize: both;
}

body[data-keyboard-open="1"] .action-modal {
  align-items: flex-end;
}

body[data-keyboard-open="1"] .action-modal-panel {
  margin-bottom: calc(var(--vv-bottom-inset, 0px) + 0.4rem);
  max-height: calc(100vh - var(--vv-bottom-inset, 0px) - 2rem);
}

.action-modal-title {
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
}

.action-modal-form {
  display: grid;
  gap: 0.5rem;
}

#global-note-form {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#global-note-text {
  flex: 1 1 auto;
  min-height: 12rem;
}

#global-note-form .action-modal-actions {
  margin-top: 0.5rem;
}

.action-modal-label {
  font-size: 0.86rem;
  color: var(--muted);
}

.action-modal-label-hint {
  font-weight: normal;
  opacity: 0.75;
}

.action-modal-checkbox {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.86rem;
  color: var(--muted);
  margin-top: 0.5rem;
  cursor: pointer;
}

.action-modal-checkbox input {
  margin: 0;
}

.action-modal-hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
}

.fakefeedz-modes {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.fakefeedz-mode-label {
  font-size: 0.9rem;
  cursor: pointer;
}

/* ── Unified Add Feed dialog ─────────────────────────────────────────────── */
.afd-url-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.afd-url-row input {
  flex: 1 1 auto;
  min-width: 0;
}
.afd-spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: afd-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes afd-spin { to { transform: rotate(360deg); } }

.afd-msg {
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--bg);
  margin-bottom: 0.35rem;
  line-height: 1.4;
}
.afd-msg--ok    { border-color: #2e7d52; color: #1a5c3a; background: #d4edda; }
.afd-msg--warn  { border-color: #b8860b; color: #7a5800; background: #fff3cd; }
.afd-msg--error { border-color: #c0392b; color: #7b241c; background: #fde8e6; }
@media (prefers-color-scheme: dark) {
  .afd-msg--ok    { border-color: #2e7d52; color: #6fcf97; background: #0d2a1a; }
  .afd-msg--warn  { border-color: #b8860b; color: #f2c94c; background: #2a1f00; }
  .afd-msg--error { border-color: #c0392b; color: #eb5757; background: #2a0a08; }
}

.afd-pick {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.35rem;
  max-height: 24rem;
  overflow-y: auto;
}
.afd-pick-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.4rem;
  font-size: 0.88rem;
  cursor: pointer;
  padding: 0.2rem 0.35rem;
  border-radius: 4px;
}
.afd-pick-item:hover { background: var(--hover-bg); }
.afd-pick-item span  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.afd-feed-meta { width: 100%; display: flex; flex-wrap: wrap; gap: 0.25rem; padding-left: 1.3rem; margin-top: 0.1rem; }
.afd-chip { font-size: 0.72rem; padding: 0.05rem 0.35rem; border-radius: 3px;
  background: var(--hover-bg); color: var(--muted); white-space: nowrap; }
.afd-chip--good  { background: #1a3d1a; color: #7ec87e; }
.afd-chip--bad   { background: #3d1a1a; color: #d97070; }
.afd-chip--title { background: transparent; color: var(--muted); font-style: italic; }
[data-theme="light"] .afd-chip--good { background: #e8f5e9; color: #2e7d32; }
[data-theme="light"] .afd-chip--bad  { background: #ffebee; color: #c62828; }
.afd-compare-btn {
  align-self: flex-start;
  margin-top: 0.15rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--fg);
  cursor: pointer;
}
.afd-compare-btn:hover { background: var(--hover-bg); }
.afd-compare-btn:disabled { opacity: 0.5; cursor: default; }

/* Settings → Feeds → Compare selected (sfc) */
.sfc-col-check { width: 2rem; text-align: center; }
.sfc-check { cursor: pointer; }
.sfc-toolbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.5rem;
}
.sfc-compare-btn {
  padding: 0.25rem 0.75rem;
  font-size: 0.82rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--fg);
  cursor: pointer;
}
.sfc-compare-btn:hover:not(:disabled) { background: var(--hover-bg); }
.sfc-compare-btn:disabled { opacity: 0.5; cursor: default; }
.sfc-count { font-size: 0.8rem; color: var(--muted); }
.sfc-panel {
  margin-top: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.sfc-panel-heading {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 0.25rem;
}
.sfc-card {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line);
}
.sfc-card:last-child { border-bottom: none; }
.sfc-card-name {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sfc-panel-error { font-size: 0.85rem; color: var(--danger, #d97070); margin: 0; }

.afd-pf {
  display: grid;
  gap: 0.4rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 0.4rem;
}
.afd-pf > summary {
  list-style: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.afd-pf > summary::-webkit-details-marker { display: none; }
.afd-pf > summary::before {
  content: 'chevron_right';
  font-family: 'Material Symbols Rounded';
  font-size: 1rem;
  vertical-align: -0.15em;
  margin-right: 0.15rem;
  display: inline-block;
  transition: transform 0.15s;
}
.afd-pf[open] > summary::before { transform: rotate(90deg); }
.afd-pf > summary:hover { color: var(--fg); }
.afd-pf[open] { gap: 0.4rem; }

.afd-new-folder {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.25rem;
}
.afd-new-folder input { flex: 1 1 auto; min-width: 0; }
.afd-new-folder button { flex-shrink: 0; }

#add-feed-modal .action-modal-label { margin-top: 0.3rem; }

.action-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-top: 0.15rem;
}

.action-modal-cancel {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.feed-properties-panel {
  width: min(680px, 100%);
  max-height: calc(100vh - 2rem);
  overflow: auto;
}

.feed-properties-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.feed-properties-close {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.modal-close {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.feed-properties-close .material-symbols-rounded,
.modal-close .material-symbols-rounded {
  font-size: 1.05rem;
  line-height: 1;
  font-variation-settings: "FILL" 0, "wght" 600, "GRAD" 0, "opsz" 24;
}

.feed-properties-grid {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  gap: 0.45rem 0.85rem;
  margin: 0;
}

.feed-properties-grid dt {
  color: var(--muted);
  font-size: 0.85rem;
}

.feed-properties-grid dd {
  margin: 0;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

#feed-prop-health-detail {
  max-height: 8.5rem;
  overflow: auto;
  padding-right: 0.2rem;
}

.feed-prop-strategy-select {
  font-size: 0.85rem;
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
  border: 1px solid var(--border, #ccc);
  background: var(--bg, #fff);
  color: var(--text, inherit);
}

.feed-prop-thumbnail-url-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.5rem 0;
  flex-wrap: wrap;
}

.feed-prop-thumb-override {
  margin-bottom: 0.5rem;
}
.feed-prop-thumb-preview {
  margin-top: 0.5rem;
}
.feed-prop-thumb-preview-tile {
  /* Override flex properties so it stands alone outside a flex row */
  flex: none;
  width: 4.5rem;
  border-radius: 4px;
  box-shadow: 0 0 0 1px var(--line, #ccc);
}
.feed-prop-thumb-crop-row {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  margin-top: 0.5rem;
}
.feed-prop-crop-section {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.feed-prop-thumb-crop-label {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}
/* 3×3 position dot grid */
.feed-prop-crop-grid {
  display: grid;
  grid-template-columns: repeat(3, 16px);
  gap: 4px;
}
.feed-prop-crop-pos-btn {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--hover-bg);
  border: 1.5px solid var(--line);
  cursor: pointer;
  padding: 0;
}
.feed-prop-crop-pos-btn:hover { border-color: var(--accent); }
.feed-prop-crop-pos-btn.active {
  background: var(--accent);
  border-color: var(--accent);
}
/* Mode buttons (Fill / Fit / Smart) */
.feed-prop-crop-mode-btns {
  display: flex;
  gap: 0.25rem;
}
.feed-prop-crop-mode-btn {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  opacity: 0.65;
}
.feed-prop-crop-mode-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  opacity: 1;
}
.feed-prop-thumbnail-label {
  font-size: 0.8rem;
  color: var(--muted, #888);
  white-space: nowrap;
}
.feed-prop-thumbnail-input {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border, #ccc);
  background: var(--bg, #fff);
  color: var(--text, inherit);
}
.feed-prop-thumbnail-save {
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border, #ccc);
  background: var(--bg, #fff);
  color: var(--text, inherit);
  cursor: pointer;
  white-space: nowrap;
}

.feed-prop-strategy-hint {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

@media (max-width: 640px) {
  .feed-properties-grid {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .feed-properties-grid dt {
    margin-top: 0.35rem;
  }

  .action-modal-panel,
  .feed-properties-panel {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    min-height: 0;
    resize: none;
  }
}

.feed-prop-name-wrap {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.feed-prop-title-input {
  flex: 1 1 0;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.18rem 0.4rem;
  font: inherit;
  font-size: 0.85rem;
  background: var(--bg);
  color: var(--ink);
}
.feed-prop-title-input:focus { outline: none; border-color: var(--accent); }
.feed-prop-reset-title {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0.1rem;
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
}
.feed-prop-reset-title:hover { color: var(--ink); }

.feed-prop-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 1.1rem 0 0.45rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.feed-prop-refresh-btn {
  font-size: 0.78rem;
  font-weight: normal;
  text-transform: none;
  letter-spacing: normal;
  background: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  padding: 2px 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.feed-prop-refresh-btn .material-symbols-rounded {
  font-size: 14px;
}

.feed-prop-refresh-btn:hover {
  background: var(--hover-bg);
}

.feed-prop-toggles {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.feed-prop-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.feed-prop-checkbox {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  cursor: pointer;
}

.feed-prop-strat-empty {
  font-size: 0.85rem;
  margin: 0.25rem 0;
}

.feed-prop-history-filter {
  display: flex;
  gap: 0.4rem;
  margin: 0.4rem 0 0.6rem;
}
.feed-prop-history-filter-btn {
  font: inherit;
  font-size: 0.8rem;
  padding: 2px 10px;
  border: 1px solid var(--border-color, #ccc);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}
.feed-prop-history-filter-btn--active {
  background: var(--accent-color, #3b82f6);
  border-color: var(--accent-color, #3b82f6);
  color: #fff;
}
.feed-prop-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.feed-prop-history-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.35rem 0.5rem;
  /* No boxed outline (the old var(--border-color) fell back to white); a subtle
     bottom divider keeps rows separable without the heavy box. */
  border-bottom: 1px solid var(--line);
}
.feed-prop-history-item:last-child { border-bottom: none; }
.feed-prop-history-item--error {
  border-left: 3px solid var(--danger, #d33);
}
.feed-prop-history-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.feed-prop-history-badge {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 1px 7px;
  border-radius: 4px;
}
.feed-prop-history-badge--ok {
  background: var(--ok-bg, rgba(40, 167, 69, 0.18));
  color: var(--ok-color, #2e7d32);
}
.feed-prop-history-badge--error {
  background: var(--error-bg, rgba(211, 51, 51, 0.18));
  color: var(--error-color, #d33);
}
.feed-prop-history-when {
  font-size: 0.83rem;
}
.feed-prop-history-meta {
  font-size: 0.78rem;
  opacity: 0.8;
}
.feed-prop-history-error {
  font-size: 0.8rem;
}
.feed-prop-automations-list {
  list-style: none;
  margin: 0.25rem 0 0.75rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.feed-prop-automation-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border-color, #ccc);
  border-radius: 6px;
}
.feed-prop-automation-item--off {
  opacity: 0.6;
}
.feed-prop-automation-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.feed-prop-automation-keyword {
  font-size: 0.8rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--code-bg, rgba(127, 127, 127, 0.15));
}
.feed-prop-automation-scope {
  font-size: 0.78rem;
  margin-left: auto;
  opacity: 0.75;
}
.feed-prop-automation-off {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--warning-color, #b26a00);
}
.feed-prop-automation-detail {
  font-size: 0.8rem;
}

.feed-prop-preset-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.feed-prop-preset-btn {
  font: inherit;
  font-size: 0.82rem;
  padding: 3px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: inline-block;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.feed-prop-preset-btn:hover {
  background: transparent;
  border-color: var(--ink);
  opacity: 1;
}
.feed-prop-preset-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.feed-prop-strat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  min-height: 0;
}

.feed-prop-strat-card {
  position: relative; /* needed for dimension overlay and pin button */
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.1s;
}

.feed-prop-strat-card[data-dims]::after {
  content: attr(data-dims);
  position: absolute;
  bottom: 2px; right: 3px; left: auto;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 0.65rem;
  border-radius: 3px;
  padding: 1px 3px;
  pointer-events: none;
  line-height: 1.3;
  white-space: nowrap;
}

.feed-prop-use-as-thumb {
  position: absolute;
  top: 2px; right: 2px;
  background: rgba(0,0,0,0.5);
  border: none;
  color: #fff;
  font-size: 0.7rem;
  cursor: pointer;
  border-radius: 3px;
  padding: 1px 3px;
  opacity: 0;
  transition: opacity 0.15s;
}
.feed-prop-strat-card:hover .feed-prop-use-as-thumb {
  opacity: 1;
}

.feed-prop-strat-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.feed-prop-strat-card:hover {
  border-color: var(--ink);
}

.feed-prop-strat-thumb {
  width: 100%;
  height: auto;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  background: var(--field-elevated-bg);
  max-height: 90px;
}

.feed-prop-strat-thumb-empty {
  width: 100%;
  aspect-ratio: 16/9;
  max-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--field-elevated-bg);
  color: var(--muted);
  font-size: 0.72rem;
}

.feed-prop-strat-label {
  padding: 4px 6px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-prop-strat-error {
  padding: 4px 6px;
  color: var(--muted);
  font-size: 0.7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-prop-strat-captions {
  margin: 0.4rem 0 0.25rem;
  display: grid;
  gap: 0.5rem;
  /* grid-template-columns set inline by JS to match card grid */
}
.feed-prop-strat-cap-cell {
  font-size: 0.78rem;
  line-height: 1.4;
  overflow: hidden;
}
.feed-prop-strat-cap-attr {
  font-style: normal;
  color: var(--muted);
  font-size: 0.7rem;
  margin-right: 0.2em;
}
.feed-prop-strat-cap-title {
  font-style: italic;
  color: var(--ink);
  word-break: break-word;
}
.feed-prop-strat-cap-alt {
  color: var(--muted);
  word-break: break-word;
}

.feed-prop-caption-source-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  flex-wrap: wrap;
}
.feed-prop-caption-source-label {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}
.feed-prop-caption-checks {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.feed-prop-caption-check-label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.85rem;
  cursor: pointer;
  max-width: 100%;
}
.feed-prop-caption-preview {
  font-style: italic;
  color: var(--muted);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 28ch;
}
.feed-prop-caption-auto-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.feed-prop-caption-auto-btn.active:hover {
  background: var(--accent);
}

.folder-prop-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 1rem 0 0.4rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.folder-prop-top-feeds {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.folder-prop-top-feeds th,
.folder-prop-top-feeds td {
  text-align: left;
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid var(--border, #e5e5e5);
}

.folder-prop-top-feeds th {
  color: var(--muted);
  font-weight: 500;
}

.folder-prop-top-feeds td:nth-child(2),
.folder-prop-top-feeds th:nth-child(2),
.folder-prop-top-feeds td:nth-child(3),
.folder-prop-top-feeds th:nth-child(3) {
  text-align: right;
  white-space: nowrap;
}

.folder-prop-feed-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--link, #0066cc);
  cursor: pointer;
  font-size: inherit;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: transparent;
}

.folder-prop-feed-link:hover {
  text-decoration-color: currentColor;
}

.folder-prop-unread-badge {
  color: var(--muted);
  font-size: 0.85em;
}


/* -------------------------------------------------------------------------
   Login page
   ------------------------------------------------------------------------- */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
}

.login-card {
  width: min(22rem, 92vw);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 2rem 2rem 2.25rem;
  box-shadow: 0 4px 24px color-mix(in srgb, #000 32%, transparent);
}

.login-title {
  margin: 0 0 1.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-align: center;
  color: var(--ink);
}

.login-error {
  margin: 0 0 1rem;
  padding: 0.55rem 0.75rem;
  background: color-mix(in srgb, #c0392b 18%, transparent);
  border: 1px solid color-mix(in srgb, #c0392b 45%, transparent);
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--ink);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.login-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-mid, var(--ink));
  margin-top: 0.5rem;
}

.login-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: var(--field-elevated-bg, var(--field-bg));
  border: 1px solid var(--field-border);
  border-radius: 7px;
  color: var(--ink);
  caret-color: var(--ink);
  font-size: 1rem;
  outline: none;
  box-sizing: border-box;
}

.login-input:focus {
  border-color: var(--field-focus-border, var(--accent));
  box-shadow: 0 0 0 1px var(--field-focus-ring, color-mix(in srgb, var(--accent) 38%, transparent));
}

.login-button {
  margin-top: 1.1rem;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.login-button:hover {
  opacity: 0.88;
}

/* Dedup feeds modal */
.feeds-dedup-panel {
  font-size: 0.85rem;
}
.dedup-modal-intro {
  margin-bottom: 0.6rem;
}
.dedup-modal-list {
  flex: 1 1 auto;
  overflow-y: auto;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.dedup-folder-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.dedup-folder-label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.1rem;
}
.dedup-pair {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  border-left: 2px solid var(--line);
  padding-left: 0.5rem;
}
.dedup-pair-row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  min-width: 0;
}
.dedup-tag {
  font-size: 0.7rem;
  font-weight: 600;
  width: 3.8rem;
  flex-shrink: 0;
  text-align: right;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.keep-tag { color: var(--muted); }
.remove-tag { color: var(--danger, #c0392b); }
.dedup-url {
  font-family: var(--mono, monospace);
  font-size: 0.78rem;
  word-break: break-all;
  min-width: 0;
}
.dedup-cross-section {
  margin-top: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.dedup-cross-intro {
  margin-bottom: 0.3rem;
}
.dedup-cross-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.82rem;
  overflow-y: auto;
}
.dedup-cross-pair {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.dedup-folder-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.8rem;
  padding-left: calc(3.8rem + 0.4rem);
}
.dedup-folder-check {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  cursor: pointer;
}

.dedup-upgrade-section {
  margin-top: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.dedup-upgrade-intro {
  margin-bottom: 0.1rem;
}
.dedup-upgrade-hint {
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.dedup-upgrade-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.82rem;
  overflow-y: auto;
}
.dedup-upgrade-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
}
.dedup-upgrade-item input[type="checkbox"] {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

/* ── Highlights ─────────────────────────────────────────────────────────── */
mark.highlight-mark {
  border-radius: 2px;
  padding: 0 1px;
  font: inherit;
}
.highlight-mark-yellow { background: #ffe066; color: #333; }
.highlight-mark-green  { background: #b6f2b6; color: #1a3a1a; }
.highlight-mark-blue   { background: #b3d9ff; color: #0a2340; }
.highlight-mark-pink   { background: #ffc0d6; color: #3a001a; }
.highlight-mark-orange { background: #ffd0a0; color: #3a1a00; }

/* ── Settings > Feeds > Folders table ───────────────────────────────────── */
.feeds-folder-search {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 0 0.6rem;
  padding: 0.4rem 0;
  background: var(--elevated-bg);
}
.feeds-folder-search-icon {
  position: absolute;
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--muted);
  pointer-events: none;
}
.feeds-folder-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.4rem 0.5rem 0.4rem 2rem;
  font-size: 0.85rem;
  color: var(--ink);
  background: var(--input-bg, var(--bg));
  border: 1px solid var(--line);
  border-radius: 6px;
}
.feeds-folder-search-input:focus {
  outline: none;
  border-color: var(--accent, #4a90d9);
}
.feeds-folder-search-empty { padding: 0.5rem 0; }
.settings-folders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.settings-folders-table th {
  text-align: left;
  padding: 0.25rem 0.5rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}
.settings-folder-row td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.settings-folder-row:last-child td { border-bottom: none; }
.settings-folder-name { font-weight: 500; }
.settings-folder-feeds {
  color: var(--muted);
  text-align: right;
  width: 3rem;
}
.settings-folder-status { width: 5rem; text-align: right; }
.settings-folder-actions { width: 3.75rem; text-align: right; white-space: nowrap; padding-right: 0.25rem; }
.settings-folder-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  margin-right: 0.2rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  line-height: 1;
}
.settings-folder-toggle:hover:not(:disabled) { color: var(--ink); }
.settings-folder-toggle:disabled { opacity: 0.25; cursor: default; }
.settings-folder-toggle .material-symbols-rounded { font-size: 18px; transition: transform 0.12s ease; }
.settings-folder-toggle[aria-expanded="true"] .material-symbols-rounded { transform: rotate(90deg); }
.settings-folder-refresh { width: 6.5rem; }
.settings-folder-cadence-select { font-size: 0.78rem; padding: 0.12rem 0.25rem; width: 100%; }
.settings-feed-row td {
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  background: var(--hover-bg, rgba(0, 0, 0, 0.02));
}
.settings-feed-name { padding-left: 2.3rem !important; }
.settings-feed-name-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.settings-feed-name-btn:hover { text-decoration: underline; }
.settings-feed-name-text[data-feed-error] { color: var(--danger, #c0392b); }
.settings-feed-row--disabled .settings-feed-name-text { color: var(--muted); font-style: italic; }
.settings-feed-row--disabled .settings-folder-props-btn:not(.settings-feed-toggle-btn) { opacity: 0.5; }
.settings-feed-disabled-tag {
  margin-left: 0.4rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 0.4em;
  vertical-align: middle;
}
.settings-folder-error-badge {
  display: inline-block;
  background: var(--danger, #c0392b);
  color: #fff;
  border-radius: 10px;
  padding: 0 0.4em;
  font-size: 0.72rem;
  font-weight: 600;
  min-width: 1.4em;
  text-align: center;
}
.settings-folder-cadence {
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: 0.3rem;
}
.settings-folder-props-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 0.15rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
.settings-folder-props-btn:hover { color: var(--ink); background: var(--hover-bg); }
.settings-folder-props-btn .material-symbols-rounded { font-size: 17px; }
.settings-feed-unsub-btn:hover { color: var(--danger, #c0392b); }

/* ── Settings > Feeds > Duplicates inline panel ──────────────────────────── */
.feeds-dedup-controls {
  padding: 0.5rem 0 0.75rem;
}
.dedup-inline-actions {
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.dedup-rescue-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
}
.dedup-rescue-label input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 0.15em;
}

/* Highlights modal */
.highlights-modal-panel {
  min-width: min(420px, 100%);
  max-width: 660px;
  width: 94vw;
}
/* Tab bar */
.hl-tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--line, #ddd);
  margin-bottom: 0.75rem;
}
.hl-tab-btn {
  padding: 0.35rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: 0.85rem;
  color: var(--muted, #888);
  cursor: pointer;
  font-weight: 500;
}
.hl-tab-btn:hover { color: var(--ink, #222); }
.hl-tab-btn--active { color: var(--accent, #4f89ab); border-bottom-color: var(--accent, #4f89ab); }
.hl-tab-panel { }
/* Drag handle */
.hl-rule-handle {
  display: flex;
  align-items: center;
  color: var(--muted, #aaa);
  cursor: grab;
  font-size: 1rem;
  flex-shrink: 0;
  padding: 0 0.1rem;
  user-select: none;
}
.hl-rule-handle:active { cursor: grabbing; }
.hl-rule-dragging { opacity: 0.4; }
.hl-rule-drag-over { outline: 2px solid var(--accent, #4f89ab); outline-offset: -2px; border-radius: 4px; }
/* History tab */
.hl-history-list { display: flex; flex-direction: column; gap: 0.3rem; min-height: 2rem; max-height: 55vh; overflow-y: auto; }
.hl-history-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--line, #eee);
  font-size: 0.82rem;
}
.hl-history-row:last-child { border-bottom: none; }
.hl-history-count { color: var(--muted, #888); margin-left: auto; white-space: nowrap; }
.hl-history-ts { color: var(--muted, #888); font-size: 0.78rem; white-space: nowrap; }
/* Dry-run: show more button */
.hl-dryrun-more-btn {
  display: block;
  width: 100%;
  padding: 0.3rem;
  margin-top: 0.3rem;
  background: var(--surface, #f5f5f5);
  border: 1px solid var(--line, #ddd);
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--accent, #4f89ab);
  cursor: pointer;
  text-align: center;
}
.hl-dryrun-more-btn:hover { background: var(--hover-bg, #eee); }
/* Compare modes */
.hl-dryrun-compare-btn {
  display: inline-block;
  margin: 0.3rem 0 0.5rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.78rem;
  border: 1px solid var(--line, #ccc);
  border-radius: 4px;
  background: none;
  color: var(--muted, #888);
  cursor: pointer;
}
.hl-dryrun-compare-btn:hover { color: var(--accent, #4f89ab); border-color: var(--accent, #4f89ab); }
.hl-dryrun-compare-feeds-btn { margin-left: 0.4rem; }
.hl-cmp-feeds-form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 0.3rem 0 0.5rem;
}
.hl-cmp-feeds-sel {
  padding: 0.2rem 0.3rem;
  font-size: 0.8rem;
  border: 1px solid var(--line, #ccc);
  border-radius: 4px;
  background: var(--field-bg, var(--surface, #fff));
  color: var(--ink, #222);
  flex: 1 1 160px;
  min-width: 120px;
  max-width: 260px;
}
.hl-feed-link {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--link, #2060cc);
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.hl-feed-link:hover { color: var(--link-hover, #1040aa); }
.feed-prop-footer {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line, #ddd);
  display: flex;
  justify-content: flex-end;
}
.feed-prop-unsubscribe-btn {
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  border-radius: 5px;
  border: 1px solid var(--danger, #c0392b);
  background: none;
  color: var(--danger, #c0392b);
  cursor: pointer;
}
.feed-prop-unsubscribe-btn:hover { background: var(--danger, #c0392b); color: #fff; }
.feed-prop-unsubscribe-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.feed-prop-inline-btn {
  padding: 0.15rem 0.5rem;
  font-size: 0.78rem;
  border-radius: 4px;
  border: 1px solid var(--line, #ddd);
  background: var(--bg-secondary, #f5f5f5);
  color: var(--text, #333);
  cursor: pointer;
  white-space: nowrap;
}
.feed-prop-inline-btn:hover { border-color: var(--accent, #3a7abf); color: var(--accent, #3a7abf); }
.feed-prop-inline-btn--primary { border-color: var(--accent, #3a7abf); background: var(--accent, #3a7abf); color: #fff; }
.feed-prop-inline-btn--primary:hover { opacity: 0.85; }
.feed-prop-inline-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.feed-prop-open-btn { text-decoration: none; line-height: 1; }
.feed-prop-url-input {
  font-size: 0.8rem;
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--line, #ddd);
  border-radius: 4px;
  background: var(--bg, #fff);
  color: var(--text, #333);
  width: min(360px, 100%);
}
.feed-prop-inline-status { font-size: 0.78rem; color: var(--danger, #c0392b); }
.hl-compare-table { margin: 0.3rem 0 0.5rem; display: flex; flex-direction: column; gap: 0.15rem; }
.hl-compare-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  background: var(--surface, #f5f5f5);
  font-size: 0.82rem;
}
.hl-compare-row--active { outline: 1px solid var(--accent, #4f89ab); }
.hl-compare-mode { font-weight: 600; min-width: 6rem; }
.hl-compare-groups { color: var(--muted, #888); min-width: 6rem; }
.hl-compare-mark { color: var(--muted, #888); flex: 1; }
.hl-compare-expand {
  margin-left: auto;
  padding: 0.1rem 0.4rem;
  font-size: 0.75rem;
  border: 1px solid var(--line, #ccc);
  border-radius: 3px;
  background: none;
  cursor: pointer;
  color: var(--muted, #888);
}
.hl-compare-expand:hover { color: var(--ink, #222); }
.hl-compare-detail-panel { margin: 0.25rem 0 0.5rem 1rem; }
/* Mode badges in compare */
.hl-cmp-mode-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.hl-cmp-mode-badge--slug    { background: #dbeafe; color: #1e40af; }
.hl-cmp-mode-badge--title   { background: #dcfce7; color: #166534; }
.hl-cmp-mode-badge--both    { background: #ede9fe; color: #5b21b6; }
.hl-cmp-mode-badge--fuzzy   { background: #ffedd5; color: #9a3412; }
/* Overlap analysis */
.hl-compare-wrap { display: flex; flex-direction: column; gap: 0.5rem; }
.hl-compare-overlap-hdr {
  font-size: 0.8rem;
  color: var(--muted, #888);
  border-top: 1px solid var(--line, #eee);
  padding-top: 0.5rem;
  margin-top: 0.2rem;
}
.hl-cmp-bucket {
  border: 1px solid var(--line, #ddd);
  border-radius: 5px;
  overflow: hidden;
}
.hl-cmp-bucket-summary {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.hl-cmp-bucket-summary::-webkit-details-marker { display: none; }
.hl-cmp-bucket-summary::before { content: '▶ '; font-size: 0.65rem; opacity: 0.6; }
.hl-cmp-bucket[open] > .hl-cmp-bucket-summary::before { content: '▼ '; }
.hl-cmp-bucket--4 .hl-cmp-bucket-summary { background: color-mix(in srgb, #166534 12%, transparent); color: #166534; }
.hl-cmp-bucket--3 .hl-cmp-bucket-summary { background: color-mix(in srgb, #1e40af 10%, transparent); color: #1e40af; }
.hl-cmp-bucket--2 .hl-cmp-bucket-summary { background: color-mix(in srgb, #92400e 10%, transparent); color: #92400e; }
.hl-cmp-bucket--1 .hl-cmp-bucket-summary { background: color-mix(in srgb, #991b1b 10%, transparent); color: #991b1b; }
.hl-cmp-pair {
  padding: 0.3rem 0.6rem;
  border-top: 1px solid var(--line, #eee);
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.hl-cmp-entry-modes {
  display: flex;
  gap: 0.2rem;
  flex-wrap: wrap;
  margin-bottom: 0.1rem;
}
.hl-cmp-pair-item {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.hl-cmp-pair-label {
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 5.5rem;
}
.hl-cmp-bucket--1-sub {
  margin: 0.2rem 0.5rem;
  border-color: var(--line, #ddd);
}
.hl-cmp-bucket-summary--sub {
  font-weight: 500;
  background: none;
  color: var(--ink, #222);
}
.highlights-hint {
  font-size: 0.82rem;
  color: var(--muted, #888);
  margin: 0 0 0.9rem;
}
.hl-rules-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  min-height: 1.5rem;
}
.hl-empty {
  font-size: 0.82rem;
  color: var(--muted, #888);
  font-style: italic;
  margin: 0;
}
.hl-rule-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
}
.hl-rule-badge {
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.85rem;
  font-weight: 500;
  flex-shrink: 0;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hl-rule-regex-badge {
  font-family: monospace;
  font-size: 0.72rem;
  background: var(--surface, #eee);
  color: var(--muted, #888);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  flex-shrink: 0;
}
.hl-rule-scope {
  flex: 1;
  font-size: 0.82rem;
  color: var(--muted, #888);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hl-rule-row--disabled .hl-rule-badge,
.hl-rule-row--disabled .hl-rule-scope,
.hl-rule-row--disabled .hl-rule-regex-badge,
.hl-rule-row--disabled .hl-rule-type-chip,
.hl-rule-row--disabled .hl-rule-search-in-badge,
.hl-rule-row--disabled .hl-rule-delivery-badge,
.hl-rule-row--disabled .hl-rule-email-to,
.hl-rule-row--disabled .hl-rule-cc-badge,
.hl-rule-row--disabled .hl-rule-test {
  opacity: 0.4;
}
.hl-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  padding: 0.55rem 0.5rem 0.2rem;
  margin: 0;
}
.hl-section-label:first-child {
  padding-top: 0.1rem;
}
.hl-rule-type-chip {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  flex-shrink: 0;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.hl-rule-type-chip--mark_as_read {
  background: #d4eaf7;
  color: #1a6496;
}
.hl-rule-type-chip--email_article {
  background: #ede0f7;
  color: #6a3d99;
}
.hl-rule-type-chip--deduplicate {
  background: #fef3c7;
  color: #92400e;
}
.hl-rule-type-chip--quire {
  background: #dcf2e8;
  color: #1f7a55;
}
.hl-rule-search-in-badge {
  font-family: monospace;
  font-size: 0.7rem;
  background: var(--surface, #eee);
  color: var(--muted, #888);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  flex-shrink: 0;
}
.hl-rule-delivery-badge {
  font-size: 0.7rem;
  background: #ede0f7;
  color: #6a3d99;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  flex-shrink: 0;
}
.hl-rule-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--accent, #2060cc);
}
.hl-rule-toggle .material-symbols-rounded { font-size: 1.35rem; font-variation-settings: 'FILL' 1; }
.hl-rule-row--disabled .hl-rule-toggle { color: var(--muted, #888); }
.hl-rule-delete {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--muted, #888);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.hl-rule-delete .material-symbols-rounded { font-size: 1rem; }
.hl-rule-delete:hover { color: var(--danger, #c0392b); }
.hl-rule-edit {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--muted, #888);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.hl-rule-edit .material-symbols-rounded { font-size: 1rem; }
.hl-rule-edit:hover { color: var(--accent, #2980b9); }
.hl-rule-test {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--muted, #888);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.hl-rule-test .material-symbols-rounded { font-size: 1rem; }
.hl-rule-test:hover, .hl-rule-test.active { color: #2e7d32; }
.hl-rule-run {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--muted, #888);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.hl-rule-run .material-symbols-rounded { font-size: 1rem; font-variation-settings: 'FILL' 1; }
.hl-rule-run:hover { color: #e65100; }
.hl-rule-run:disabled { cursor: not-allowed; }
.hl-rule-hist {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--muted, #888);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.hl-rule-hist .material-symbols-rounded { font-size: 1rem; }
.hl-rule-hist:hover, .hl-rule-hist.active { color: var(--accent, #2060cc); }
.hl-rule-hist-panel {
  background: var(--surface, #f5f5f5);
  border: 1px solid var(--line, #ddd);
  border-radius: 5px;
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
  margin: 0 0 0.25rem 1.8rem;
  color: var(--ink, #222);
}
.hl-rule-hist-panel--loading { color: var(--muted, #888); font-style: italic; }
.hl-rule-hist-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--line, #eee);
}
.hl-rule-hist-item:last-child { border-bottom: none; }
.hl-rule-hist-time { color: var(--muted, #888); flex-shrink: 0; font-size: 0.83rem; }
.hl-rule-hist-count { flex: 1; font-size: 0.83rem; }
.hl-rule-hist-trigger {
  font-size: 0.72rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  flex-shrink: 0;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.hl-rule-hist-trigger--auto { background: var(--accent-soft, #e8f0ff); color: var(--accent, #2060cc); }
.hl-rule-hist-trigger--manual { background: var(--status-bg, rgba(0,0,0,0.05)); color: var(--muted, #888); }
.hl-hist-expand-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--muted, #888);
  display: flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 1;
}
.hl-hist-expand-btn .material-symbols-rounded { font-size: 1.1rem; }
.hl-hist-expand-btn:hover { color: var(--ink, #222); }
.hl-hist-entry-list {
  flex-basis: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.3rem 0 0.15rem 0.5rem;
  border-left: 2px solid var(--line, #ddd);
  margin-left: 0.1rem;
}
.hl-hist-entry-list[hidden],
.hl-hist-entry-list.is-collapsed { display: none; }
.hl-hist-entry-row {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  font-size: 0.8rem;
}
.hl-hist-entry-feed {
  color: var(--muted, #888);
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hl-hist-entry-title {
  color: var(--ink, #222);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
a.hl-hist-entry-title:hover { text-decoration: underline; color: var(--link, #2060cc); }
.hl-hist-entry-more { margin: 0.2rem 0 0; font-size: 0.75rem; color: var(--muted, #888); font-style: italic; }

/* Draft row */
.hl-draft-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 0.55rem 0.6rem;
  background: var(--surface, #f5f5f5);
  border-radius: 6px;
  margin-bottom: 0.6rem;
}
.hl-draft-pattern {
  flex: 1 1 140px;
  min-width: 80px;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--line, #ccc);
  border-radius: 4px;
  font-size: 0.88rem;
  background: var(--bg, #fff);
  color: var(--ink, #222);
}
textarea.hl-draft-pattern {
  resize: vertical;
  font-family: inherit;
  line-height: 1.4;
  align-self: flex-start;
}
.hl-regex-toggle {
  font-family: monospace;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--line, #ccc);
  border-radius: 4px;
  background: var(--bg, #fff);
  color: var(--muted, #888);
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
}
.hl-regex-toggle.active,
.hl-regex-toggle[aria-pressed="true"] {
  background: var(--accent, #2060cc);
  color: #fff;
  border-color: var(--accent, #2060cc);
}
.hl-draft-select {
  padding: 0.3rem 0.3rem;
  border: 1px solid var(--line, #ccc);
  border-radius: 4px;
  font-size: 0.83rem;
  background: var(--bg, #fff);
  color: var(--ink, #222);
  flex-shrink: 0;
  max-width: 130px;
}
.hl-draft-save {
  padding: 0.3rem 0.7rem;
  font-size: 0.88rem;
  border-radius: 4px;
  flex-shrink: 0;
}
.hl-draft-cancel {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--muted, #888);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.hl-draft-cancel .material-symbols-rounded { font-size: 1.1rem; }
.hl-draft-cancel:hover { color: var(--danger, #c0392b); }

/* Email/batch sub-rows in draft (flex-basis 100% forces new line) */
.hl-draft-form-subrow {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-basis: 100%;
  flex-wrap: wrap;
  padding-top: 0.3rem;
  border-top: 1px solid var(--line, #ddd);
  margin-top: 0.15rem;
}
.hl-draft-field-label {
  font-size: 0.8rem;
  color: var(--muted, #888);
  flex-shrink: 0;
}
.hl-contact-select { max-width: 180px; }
/* Cc me checkbox + label */
.hl-draft-cc-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.83rem;
  color: var(--ink, #222);
  cursor: pointer;
  flex-shrink: 0;
}
.hl-draft-cc-check { cursor: pointer; }
.hl-draft-batch-time {
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--line, #ccc);
  border-radius: 4px;
  font-size: 0.83rem;
  background: var(--bg, #fff);
  color: var(--ink, #222);
  flex-shrink: 0;
}
.hl-draft-batch-count {
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--line, #ccc);
  border-radius: 4px;
  font-size: 0.83rem;
  background: var(--bg, #fff);
  color: var(--ink, #222);
  width: 5rem;
  flex-shrink: 0;
}
/* BCC-self row in Automation modal */
.hl-bcc-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  background: var(--surface, #f5f5f5);
  border-radius: 5px;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}
.hl-bcc-label {
  font-size: 0.82rem;
  color: var(--muted, #888);
  flex-shrink: 0;
}
.hl-bcc-input {
  flex: 1 1 160px;
  min-width: 120px;
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--line, #ccc);
  border-radius: 4px;
  font-size: 0.83rem;
  background: var(--bg, #fff);
  color: var(--ink, #222);
}
.hl-bcc-save {
  padding: 0.25rem 0.6rem;
  font-size: 0.83rem;
  border-radius: 4px;
  flex-shrink: 0;
}
/* Email-to badge on rule row */
.hl-rule-email-to {
  font-size: 0.78rem;
  color: var(--muted, #888);
  flex-shrink: 0;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Cc me badge on rule row */
.hl-rule-cc-badge {
  font-size: 0.7rem;
  background: #d4eaf7;
  color: #1a6496;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  flex-shrink: 0;
}
/* Profile form */
.profile-form {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.25rem 0;
}
.profile-label {
  font-size: 0.85rem;
  color: var(--muted, #888);
  white-space: nowrap;
}
.profile-input {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--line, #ccc);
  border-radius: 4px;
  font-size: 0.88rem;
  background: var(--bg, #fff);
  color: var(--ink, #222);
}
.profile-form .hl-draft-save {
  grid-column: 2;
  justify-self: start;
}

/* Deduplicate match-method select and window hours */
.hl-match-method-select { max-width: 130px; }
.hl-draft-window-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.8rem;
  color: var(--muted, #888);
  flex-shrink: 0;
}
.hl-draft-window-hours { width: 4rem; }

/* Exclude-folder token input sub-row */
.hl-draft-exclude-row { gap: 0.4rem; align-items: flex-start; }
.hl-token-input-wrap {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  min-height: 2rem;
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--line, #ccc);
  border-radius: 4px;
  background: var(--field-bg, var(--surface, #fff));
  cursor: text;
  flex: 1;
}
.hl-token-input-wrap:focus-within {
  border-color: var(--field-focus-border, var(--active-border, #4f89ab));
  box-shadow: 0 0 0 2px var(--field-focus-ring, rgba(79,137,171,0.2));
}
.hl-folder-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  background: var(--accent-soft, #e8f0f8);
  color: var(--ink, #222);
  font-size: 0.8rem;
  white-space: nowrap;
}
.hl-folder-tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  width: 1rem;
  height: 1rem;
  border: none;
  background: transparent;
  color: var(--muted, #888);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 2px;
}
.hl-folder-tag-remove:hover { color: var(--danger, #c00); }
.hl-token-input-field {
  flex: 1;
  min-width: 8rem;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.83rem;
  color: var(--ink, #222);
  padding: 0.1rem 0;
}
.hl-token-input-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 200;
  margin-top: 2px;
  border: 1px solid var(--line, #ccc);
  border-radius: 4px;
  background: var(--surface, #fff);
  box-shadow: var(--shadow, 0 4px 12px rgba(0,0,0,0.15));
  max-height: 180px;
  overflow-y: auto;
}
.hl-token-input-option {
  padding: 0.35rem 0.6rem;
  font-size: 0.83rem;
  cursor: pointer;
  color: var(--ink, #222);
}
.hl-token-input-option:hover { background: var(--hover-bg, #f0f0f0); }
/* Exclusion badge shown in rule row */
.hl-rule-excl-badge {
  color: var(--danger-muted, #a07070);
  font-style: italic;
}

/* Dry-run result panel */
.hl-rule-dryrun-panel {
  background: var(--surface, #f5f5f5);
  border: 1px solid var(--line, #ddd);
  border-radius: 5px;
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  margin: 0 0 0.25rem 1.8rem;
}
.hl-rule-dryrun-panel--loading {
  color: var(--muted, #888);
  font-style: italic;
}
.hl-rule-dryrun-summary {
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--ink, #222);
}
.hl-rule-dryrun-group {
  border-bottom: 1px solid var(--line, #eee);
  padding-bottom: 0.3rem;
  margin-bottom: 0.3rem;
}
.hl-rule-dryrun-group:last-of-type { border-bottom: none; margin-bottom: 0; }
.hl-rule-dryrun-match-by {
  font-size: 0.72rem;
  color: var(--muted, #888);
  margin-bottom: 0.1rem;
  font-style: italic;
}
.hl-rule-dryrun-item {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.1rem 0;
}
.hl-rule-dryrun-item-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink, #222);
  text-decoration: none;
}
.hl-rule-dryrun-item-title:hover { text-decoration: underline; }
.hl-rule-dryrun-item-feed {
  font-size: 0.75rem;
  color: var(--muted, #888);
  flex-shrink: 0;
  white-space: nowrap;
}
.hl-rule-dryrun-item-date {
  font-size: 0.72rem;
  color: var(--muted, #888);
  margin-left: auto;       /* sit at the row end */
  opacity: 0.85;
}
.hl-rule-dryrun-keep-label { color: #2e7d32; }
.hl-rule-dryrun-markread-label { color: var(--danger, #c0392b); }
.hl-rule-dryrun-more {
  font-size: 0.78rem;
  color: var(--muted, #888);
  font-style: italic;
  margin-top: 0.2rem;
}
.hl-rule-dryrun-item--read .hl-rule-dryrun-item-title { opacity: 0.5; }
.hl-rule-dryrun-item--read .hl-rule-dryrun-item-feed { opacity: 0.5; }

/* False match marking */
.hl-cmp-pair--false { opacity: 0.4; }
.hl-cmp-pair--false .hl-rule-dryrun-item-title { text-decoration: line-through; }
.hl-cmp-pair-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  padding: 0.15rem 0 0.25rem;
}
.hl-cmp-pair-false-btn {
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line, #ccc);
  background: transparent;
  color: var(--muted, #888);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.hl-cmp-pair-false-btn:hover { border-color: var(--danger-muted, #907171); color: var(--danger-muted, #907171); }
.hl-cmp-pair-false-btn.active { background: var(--danger-muted, #907171); color: #fff; border-color: transparent; }
.hl-cmp-pair-cmp-btn {
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--accent-soft, #d0e4ff);
  background: transparent;
  color: var(--accent, #2060cc);
  cursor: pointer;
  transition: background 0.12s;
}
.hl-cmp-pair-cmp-btn:hover { background: var(--accent-soft, #e8f0ff); }
.hl-cmp-pair-result {
  margin: 0.2rem 0 0.4rem;
  border-left: 2px solid var(--line, #eee);
  padding-left: 0.5rem;
}

/* Add rule button */
.hl-add-rule-btn {
  display: block;
  width: 100%;
  padding: 0.4rem;
  background: none;
  border: 1px dashed var(--line, #ccc);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--muted, #888);
  text-align: center;
}
.hl-add-rule-btn:hover {
  border-color: var(--accent, #2060cc);
  color: var(--accent, #2060cc);
}


/* ── Topbar avatar + icon buttons ───────────────────────────────────── */
.topbar-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--pane-heading-height);
  height: var(--pane-heading-height);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 0;
  flex-shrink: 0;
}
.topbar-icon-btn:hover { background: var(--hover-bg); color: var(--ink); }
.topbar-overflow-btn { list-style: none; }
.topbar-overflow-btn::-webkit-details-marker { display: none; }
.menu-avatar-img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 1.5px solid var(--line); background: var(--hover-bg); display: block; }

/* ── Settings modal ─────────────────────────────────────────────────── */
.settings-modal-panel {
  min-width: min(520px, 100%);
  max-width: 680px;
  width: 94vw;
  height: min(600px, 88vh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  resize: none;
}
.settings-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
  flex-shrink: 0;
}
.settings-tab-bar { margin-bottom: 0.75rem; overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
.settings-tab-bar::-webkit-scrollbar { display: none; }
.settings-tab-bar .hl-tab-btn { padding: 0.35rem 0.65rem; white-space: nowrap; flex-shrink: 0; }
.settings-tab-panel { display: flex; flex-direction: column; gap: 0; overflow-y: auto; flex: 1; min-height: 0; }
.settings-tab-panel[hidden] { display: none; }
.settings-section {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.45rem 0.75rem;
  padding: 0.1rem 0 0.5rem;
}
.settings-label {
  font-size: 0.84rem;
  color: var(--muted);
  white-space: nowrap;
}
.settings-input {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 0.88rem;
  background: var(--bg);
  color: var(--ink);
  width: 100%;
}
.settings-row-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.settings-row-controls .settings-input { flex: 1 1 4rem; width: auto; min-width: 0; }
.settings-row-controls .settings-save-btn,
.settings-row-controls .settings-secondary-btn,
.settings-row-controls .settings-icon-btn { flex: 0 0 auto; }
.settings-current {
  font-family: var(--mono, monospace);
  font-size: 0.85rem;
  color: var(--ink);
  white-space: nowrap;
  flex: 0 0 auto;
}
.settings-token {
  flex: 0 1 auto;
  white-space: normal;
  word-break: break-all;
}
.settings-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 5px;
  cursor: pointer;
  line-height: 1;
}
.settings-icon-btn:hover { background: var(--hover-bg); }
.settings-icon-btn .material-symbols-rounded { font-size: 1.1rem; }
.settings-label-sub { font-weight: 400; opacity: 0.75; font-size: 0.78rem; }
/* Fixed label column so every field column lines up across all account rows. */
#settings-tab-account .settings-section { grid-template-columns: 6rem 1fr; }
#settings-tab-account .settings-section > .settings-label { white-space: normal; }
/* Account rows with a trailing action column (label | field(s) | action).
   The fixed outer columns make every field column end at the same x — both
   for the indented rows beside the avatar and the full-width rows below. */
#settings-tab-account .settings-section--row { grid-template-columns: 6rem 1fr 5.5rem; padding: 0.3rem 0; }
.settings-section--row > .settings-save-btn { justify-self: center; align-self: center; }
/* Indent a row's hint under the field column rather than the label. */
.settings-section--row > .settings-hint { grid-column: 2 / -1; }
/* Extra breathing room before a section (Password, API token). */
.settings-section--spaced { margin-top: 0.85rem; }
/* API token: stack the hint above the token + action glyphs in the field column. */
.settings-token-col { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.settings-token-col .settings-hint { grid-column: auto; margin: 0; }
/* Name/Email have no action; keep them in the label+field columns so their
   fields still end at the col2/col3 boundary (aligned with the rows below). */
.sett-profile-row > .settings-label { grid-column: 1; }
.sett-profile-row > .settings-input { grid-column: 2; }
/* Avatar on the left, indenting the Name/Email/Username rows beside it. */
.sett-account-head { display: flex; align-items: center; gap: 0.85rem; padding: 0.25rem 0 0; }
.sett-account-head-rows { flex: 1; min-width: 0; }
.sett-account-head .sett-avatar-img { width: 96px; height: 96px; flex-shrink: 0; }
.settings-input--short { max-width: 5rem; }
.settings-input--secret { letter-spacing: 0.05em; }
.settings-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0.8rem 0 0.3rem;
}
.settings-feed-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
  margin-left: 0.3rem;
}
.settings-importexport-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.25rem 0 0.5rem;
}
.settings-hint {
  grid-column: 1 / -1;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.1rem 0 0;
  line-height: 1.4;
}
.settings-maint-last { font-style: italic; }
.settings-inline-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.72rem;
  padding: 0.1rem 0.4rem;
}
.settings-inline-btn:hover { background: var(--hover-bg); }
.settings-inline-status { font-size: 0.72rem; color: var(--muted); margin-left: 0.3rem; }
.settings-da-account {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}
.settings-hint code { word-break: break-all; }
.settings-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
  padding: 0.5rem 0 0.25rem;
  flex-wrap: wrap;
}
.settings-save-btn {
  padding: 0.35rem 0.9rem;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 5px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.settings-save-btn:hover { background: var(--accent-dark, #2a5a7a); }
.settings-secondary-btn {
  padding: 0.35rem 0.8rem;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 0.84rem;
  cursor: pointer;
}
.settings-secondary-btn:hover { background: var(--hover-bg); }
.settings-checkbox-label { display: flex; align-items: center; gap: 0.45rem; font-size: 0.88rem; cursor: pointer; }
.sett-avatar-row { display: flex; justify-content: center; padding: 0.75rem 0 0.5rem; }
.sett-avatar-img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 2px solid var(--line); background: var(--hover-bg); flex-shrink: 0; }
.sett-theme-btns { display: flex; gap: 0.3rem; }
.sett-theme-btn { display: flex; align-items: center; padding: 0.25rem 0.45rem; border: 1px solid var(--line); border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; }
.sett-theme-btn .material-symbols-rounded { font-size: 1.2rem; }
.sett-theme-btn--active { background: var(--hover-bg); color: var(--ink); border-color: var(--accent); }
.sett-theme-btn:hover:not(.sett-theme-btn--active) { background: var(--hover-bg); color: var(--ink); }

/* Automation tab inside Settings */
#settings-tab-automation { overflow-y: auto; }
#settings-tab-automation .hl-tab-bar { flex-shrink: 0; }
#settings-tab-automation .hl-tab-panel { overflow-y: visible; }

/* Contacts list */
.sett-contacts-list { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 0.5rem; min-height: 1rem; }
.sett-contact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 0.85rem;
  background: var(--surface);
}
.sett-contact-label { flex: 1; display: flex; align-items: center; gap: 0.4rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sett-contact-default-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--accent);
  color: #fff;
  border-radius: 3px;
  padding: 0.1rem 0.3rem;
  flex-shrink: 0;
}
.sett-contact-del { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0.1rem; display: flex; align-items: center; }
.sett-contact-del:hover { color: var(--danger, #c00); }
.sett-contact-del .material-symbols-rounded { font-size: 1rem; }
.sett-contact-set-default { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0.1rem 0.25rem; font-size: 1rem; line-height: 1; }
.sett-contact-set-default--active { color: var(--accent); }
.sett-contact-set-default:not(.sett-contact-set-default--active):hover { color: var(--accent); opacity: 0.6; }
.sett-contact-row--me { font-style: italic; }
.sett-contact-form { display: flex; flex-direction: column; gap: 0.35rem; padding: 0.5rem 0 0; }

/* YouTube "Add to playlist" control injected beneath each video embed. */
.lectio-yt-actions { position: relative; display: flex; align-items: center; gap: 0.5rem; margin: 0.35rem 0 1rem; flex-wrap: wrap; }
.lectio-yt-pl-btn { background: var(--field-bg); color: var(--fg); border: 1px solid var(--field-border); border-radius: 6px; padding: 0.3rem 0.6rem; font-size: 0.85rem; cursor: pointer; }
.lectio-yt-pl-btn:hover { border-color: var(--accent); color: var(--accent); }
.lectio-yt-pl-menu { position: fixed; z-index: 1000; min-width: 220px; max-height: 320px; overflow-y: auto; background: var(--elevated-bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 0.25rem; }
.lectio-yt-pl-item { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--fg); padding: 0.4rem 0.55rem; border-radius: 5px; font-size: 0.85rem; cursor: pointer; text-decoration: none; }
.lectio-yt-pl-item:hover { background: var(--hover-bg); }
.lectio-yt-pl-new { border-top: 1px solid var(--border); margin-top: 0.25rem; color: var(--accent); }
.lectio-yt-pl-loading { padding: 0.4rem 0.55rem; color: var(--muted); font-size: 0.85rem; }
.lectio-yt-pl-status { color: var(--muted); font-size: 0.8rem; }
.entry-share-wrap { position: relative; display: inline-flex; }
.entry-share-menu { position: absolute; bottom: calc(100% + 6px); right: 0; z-index: 1000; min-width: 160px; background: var(--elevated-bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 0.25rem; }
.share-menu-item { display: flex; align-items: center; gap: 0.5rem; width: 100%; text-align: left; background: none; border: 0; color: var(--fg); padding: 0.4rem 0.55rem; border-radius: 5px; font-size: 0.85rem; cursor: pointer; white-space: nowrap; }
.share-menu-item:hover:not(:disabled) { background: var(--hover-bg); }
.share-menu-item--unavail, .share-menu-item:disabled { opacity: 0.45; cursor: not-allowed; }
.share-menu-item .material-symbols-rounded { font-size: 1rem; flex-shrink: 0; }
.lectio-pin-menu { position: absolute; z-index: 1000; min-width: 200px; max-height: 320px; overflow-y: auto; background: var(--elevated-bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 0.25rem; }
.lectio-pin-item { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--fg); padding: 0.4rem 0.55rem; border-radius: 5px; font-size: 0.85rem; cursor: pointer; text-decoration: none; }
.lectio-pin-item:hover { background: var(--hover-bg); }
.lectio-pin-loading { padding: 0.4rem 0.55rem; color: var(--muted); font-size: 0.85rem; }
.lectio-quire-menu { position: absolute; z-index: 1000; min-width: 200px; max-height: 320px; overflow-y: auto; background: var(--elevated-bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 0.25rem; }
.lectio-quire-item { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--fg); padding: 0.4rem 0.55rem; border-radius: 5px; font-size: 0.85rem; cursor: pointer; }
.lectio-quire-item:hover { background: var(--hover-bg); }
.lectio-quire-loading { padding: 0.4rem 0.55rem; color: var(--muted); font-size: 0.85rem; }

/* Pin the Save / action footer to the bottom of the scrolling settings panel so
   it's always reachable without scrolling to the end of a long tab. */
.settings-tab-panel .settings-actions {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  background: var(--elevated-bg);
  border-top: 1px solid var(--line);
  padding-bottom: 0.4rem;
  z-index: 5;
}
/* Automation: pin "+ Add Rule" to the bottom, and actually hide it when a draft
   row is open (the JS sets [hidden], but `.hl-add-rule-btn{display:block}` was
   overriding the attribute, so the button never disappeared). */
#settings-tab-automation .hl-add-rule-btn {
  position: sticky;
  bottom: 0;
  background: var(--elevated-bg);
  z-index: 5;
}
.hl-add-rule-btn[hidden] { display: none; }

/* Pin the Automation tab's Rules/History subtab bar to the top of the scrolling
   settings panel (mirrors the pinned Save/Add footer at the bottom). */
.settings-tab-panel .hl-tab-bar {
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--elevated-bg);
}

/* Rule-builder feed picker: searchable chips multi-select (scales to many feeds). */
.hl-feed-pick { display: flex; flex-direction: column; gap: 0.3rem; flex: 1 1 220px; min-width: 200px; }
.hl-feed-chips { display: flex; flex-wrap: wrap; gap: 0.25rem; align-items: center; }
.hl-feed-chips-empty { color: var(--muted, #888); font-size: 0.85rem; font-style: italic; }
.hl-feed-search-wrap { min-height: auto; }
.hl-token-input-more { color: var(--muted, #888); font-style: italic; cursor: default; }
.hl-token-input-more:hover { background: none; }

/* Integrations: lay each section's fields out in a wrapping row (label above
   input per field), with full-width description/toggle/account rows. */
.settings-section--inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.5rem 0.75rem; }
.settings-section--inline > .settings-hint,
.settings-section--inline > .settings-toggle-row,
.settings-section--inline > .settings-da-account,
.settings-section--inline > .settings-actions { flex: 0 0 100%; }
.settings-section--inline .settings-field { display: flex; flex-direction: column; gap: 0.2rem; flex: 1 1 150px; min-width: 140px; }
.settings-section--inline .settings-field .settings-label { margin: 0; }
.settings-section--inline .settings-field .settings-input { width: 100%; }

/* YouTube API quota meter (Integrations → YouTube). */
.settings-yt-quota { font-size: 0.85rem; padding: 0.3rem 0.5rem; border-radius: 6px; border: 1px solid var(--border); color: var(--fg); }
.settings-yt-quota--low { border-color: var(--accent); color: var(--accent); }
.settings-yt-quota--exhausted { border-color: var(--danger, #c0392b); color: var(--danger, #c0392b); }
