:root {
    --mai-bg: #0b0d10;
    --mai-bg-elevated: #14181d;
    --mai-bg-elevated-2: #1c2128;
    --mai-border: #2d333b;
    --mai-text: #e6edf3;
    --mai-text-muted: #8b949e;
    --mai-text-faint: #6e7681;
    --mai-accent: #5b9dff;
    --mai-success: #3fb950;
    --mai-warn: #d29922;
    --mai-danger: #f85149;
}

html {
    background: var(--mai-bg);
}

body {
    background: var(--mai-bg);
    color: var(--mai-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    /* Full-width chrome (background + border) so the header reads as a
     * page-spanning band matching the footer; the inner <nav> below
     * constrains the content to the same width as the main column.
     * padding: 0 cancels Pico's 1rem default on <header>. */
    background: var(--mai-bg-elevated);
    border-bottom: 1px solid var(--mai-border);
    margin: 0;
    padding: 0;
}

/* Cancel Pico's `--pico-nav-link-spacing-vertical: 0.5rem` padding on
 * links inside <nav>, plus the matching negative margin it applies to
 * offset that padding. Scoped to the header only so we don't disturb
 * the footer. The .nav-links a / .nav-extras a rules below provide
 * our own intentional padding for the icon buttons + Feedback link. */
.app-header .brand {
    margin: 0;
    padding: 0;
}

.app-header > nav {
    display: flex;
    align-items: center;
    justify-content: flex-start;  /* override pico's space-between so
                                   * brand + nav-links sit flush-left
                                   * and Feedback is pushed right by
                                   * .nav-extras { margin-left: auto } */
    flex-wrap: wrap;
    gap: 0;
    max-width: 1450px;
    margin-left: auto;
    margin-right: auto;
    padding: 0.45rem 1rem;
}

@media (min-width: 576px)  { .app-header > nav { max-width: 510px; } }
@media (min-width: 768px)  { .app-header > nav { max-width: 700px; } }
@media (min-width: 1024px) { .app-header > nav { max-width: 950px; } }
@media (min-width: 1280px) { .app-header > nav { max-width: 1200px; } }
@media (min-width: 1536px) { .app-header > nav { max-width: 1450px; } }

.app-header nav ul {
    align-items: center;
    margin: 0;
    padding: 0;
}

.app-header .nav-links {
    margin-left: 0.4rem;
}

.app-header .brand {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
    color: var(--mai-text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.app-header .brand strong {
    font-weight: 600;
}

.app-header .version {
    color: var(--mai-text-faint);
    font-size: 0.72rem;
}

.nav-links a {
    color: var(--mai-text-muted);
    text-decoration: none;
    padding: 0.3rem 0.55rem;
    border-radius: 0.3rem;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    transition: color 0.1s, background 0.1s;
}

.nav-links a:hover {
    color: var(--mai-text);
    background: var(--mai-bg-elevated-2);
}

.nav-links a.active {
    color: var(--mai-accent);
    background: var(--mai-bg-elevated-2);
}

.nav-links a:focus-visible {
    outline: 2px solid var(--mai-accent);
    outline-offset: 2px;
}

/* SVG icon buttons inside the nav (Home, Search, Hidden). The path
 * uses stroke="currentColor" so hover/active recolouring flows through. */
.nav-icon {
    display: block;
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
}

/* Star glyph for the Saved nav button. Uses the same U+2605 character
 * as the per-item action-btn so the icon is literally the same shape. */
.nav-icon-glyph {
    display: inline-block;
    font-size: 1.4rem;
    line-height: 1;
    color: inherit;
}

/* ---- right-side extras (Feedback) — pushed to the far right of nav ---- */
.nav-extras {
    margin-left: auto;
}

.nav-extras a {
    color: var(--mai-text-muted);
    text-decoration: none;
    padding: 0.3rem 0.55rem;
    border-radius: 0.3rem;
    font-size: 0.85rem;
}

.nav-extras a:hover {
    color: var(--mai-text);
    background: var(--mai-bg-elevated-2);
}

/* ---- help button (? in the top nav) ----
   Styled to match the surrounding nav-links a tags, but rendered as a
   <button> for semantics (it doesn't navigate, it opens a modal). The
   hover / focus-visible states mirror the link version. */
.nav-help-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--mai-text-muted);
    cursor: pointer;
    padding: 0.3rem 0.55rem;
    border-radius: 0.3rem;
    font: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    transition: color 0.1s, background 0.1s;
}
.nav-help-btn:hover {
    color: var(--mai-text);
    background: var(--mai-bg-elevated-2);
}
.nav-help-btn:focus-visible {
    outline: 2px solid var(--mai-accent);
    outline-offset: 2px;
}

.app-main {
    flex: 1;
    padding: 1rem;
}

.app-footer {
    flex: 0 0 auto;
    background: var(--mai-bg-elevated);
    padding: 0.6rem 0 0.5rem;
    border-top: 1px solid var(--mai-border);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
    margin-top: 0.5rem;
}

.footer-extras {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-size: 12px;
    width: 100%;
    max-width: 1450px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
    box-sizing: border-box;
}

@media (min-width: 576px)  { .footer-extras { max-width: 510px; } }
@media (min-width: 768px)  { .footer-extras { max-width: 700px; } }
@media (min-width: 1024px) { .footer-extras { max-width: 950px; } }
@media (min-width: 1280px) { .footer-extras { max-width: 1200px; } }
@media (min-width: 1536px) { .footer-extras { max-width: 1450px; } }

.footer-promo-row {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.footer-promo {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.45), rgba(59, 130, 246, 0.2));
    border: 1px solid rgba(96, 165, 250, 0.35);
    border-radius: 999px;
    text-decoration: none;
    color: #e5e7eb;
    line-height: 1.2;
    transition: background 0.15s, border-color 0.15s, transform 0.12s;
    white-space: nowrap;
}

.footer-promo:hover {
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.65), rgba(59, 130, 246, 0.32));
    border-color: #60a5fa;
}

.footer-promo-name {
    font-weight: 700;
    color: #f9fafb;
    letter-spacing: -0.01em;
}

.footer-promo-sep {
    color: #6b7280;
    font-weight: 400;
}

.footer-promo-tag {
    color: #cbd5e1;
}

.footer-links {
    list-style: none;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.15rem 0.3rem;
    margin: 0;
    padding: 0;
}

.footer-links li {
    display: inline-flex;
    align-items: center;
}

.footer-links li + li::before {
    content: "\00B7";
    color: #4b5563;
    margin-right: 0.3rem;
}

.footer-links a {
    display: inline-block;
    padding: 0.25rem 0.45rem;
    color: #60a5fa;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    transition: color 0.1s;
}

.footer-links a:hover {
    color: #93c5fd;
    text-decoration: underline;
}

.footer-links a:visited {
    color: #60a5fa;
}

.footer-links li.footer-link-credits-li::before {
    content: none;
}
.footer-link-credits-li {
    margin-left: 0.4rem;
    padding-left: 0.7rem;
    border-left: 1px solid #4b5563;
}
#footer-credits-link {
    color: #9ca3af;
}
#footer-credits-link:hover {
    color: #e5e7eb;
}

/* ---- Footer Feedback link: separated section between LinkedIn and
 * Credits. Matches Credits' border treatment so the footer reads as
 * "LinkedIn | Feedback | Credits" with two vertical separators. */
.footer-links li.footer-link-feedback-li::before {
    content: none;
}
.footer-link-feedback-li {
    margin-left: 0.4rem;
    padding-left: 0.7rem;
    border-left: 1px solid #4b5563;
}

.credits-list {
    list-style: none;
    padding: 0;
    margin: 0 0 0.6rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.78rem;
    color: var(--mai-text-faint);
}
.credits-list li {
    color: var(--mai-text-faint);
    line-height: 1.45;
}
.credits-list a {
    color: var(--mai-text-muted);
    text-decoration: none;
}
.credits-list a:hover {
    color: var(--mai-text);
    text-decoration: underline;
}

.footer-toggle {
    display: none;
    background: transparent;
    border: 1px solid transparent;
    color: #9ca3af;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.18s;
}

.footer-toggle:hover {
    background: #1c2128;
    border-color: #2d333b;
    color: #e6edf3;
}

.footer-toggle-chevron {
    display: inline-block;
    font-size: 12px;
    line-height: 1;
    transition: transform 0.18s ease;
}

.footer-toggle[aria-expanded="true"] .footer-toggle-chevron {
    transform: rotate(180deg);
}

.dot {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--source-color, var(--pico-muted-color));
    flex-shrink: 0;
}

.feed {
    min-width: 0;
}

.feed-header {
    margin-bottom: 0.7rem;
    padding-bottom: 0.5rem;
}

.feed-header h2 {
    margin: 0;
    font-size: 1.3rem;
}

.feed-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* pico's ul li{list-style:square} leaks through on tile lists — kill it */
.feed-list > li {
    list-style: none;
}

.feed-more {
    list-style: none;
    text-align: center;
    padding: 1rem;
    color: var(--mai-text-faint);
    font-size: 0.85rem;
    background: transparent;
    border: 1px dashed var(--mai-border);
    border-radius: 0.5rem;
}

.feed-end {
    list-style: none;
    text-align: center;
    padding: 0.8rem;
    color: var(--mai-text-faint);
    font-size: 0.8rem;
}

.feed-item {
    background: var(--mai-bg-elevated);
    border: 1px solid var(--mai-border);
    border-radius: 0.5rem;
    padding: 0.8rem 1rem;
    transition: background 0.1s ease;
}

.feed-item:hover {
    background: var(--mai-bg-elevated-2);
}

.feed-item.unread {
    border-left: 3px solid var(--mai-accent);
}

.feed-item.saved {
    border-left-color: var(--mai-warn);
}

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

.feed-item-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    font-size: 0.82rem;
    color: var(--mai-text-faint);
}

/* ---- meta pills (source / domain / tag) on each item ------------------
 * Each pill is an <a> that links to the source / domain / tag page.
 * Clicking it (plain left-click) opens a small popup anchored under
 * the pill offering two actions side by side: "Hide" and "Go to"
 * (see .pill-popover below). Modifier-clicks (Cmd/Ctrl/Shift/Alt),
 * middle-click and right-click bypass the popup and let the browser
 * handle navigation / context menu as normal — so "open in new tab"
 * still works. All three pill kinds share the same shape and differ
 * only in accent colour: source = primary blue, domain = neutral gray,
 * tag = warm orange. The colour values match the recovery-bar pills
 * so a pill looks identical wherever it appears. */
.meta-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.08rem 0.55rem;
    border-radius: 0.7rem;
    border: 1px solid var(--mai-border);
    background: var(--mai-bg-elevated-2);
    color: var(--mai-text-muted);
    font-size: 0.78rem;
    line-height: 1.3;
    font-weight: 500;
    text-decoration: none;
    position: relative;
    cursor: pointer;
    transition: background 0.1s, color 0.1s, border-color 0.1s;
    white-space: nowrap;
}
.meta-pill:hover {
    color: var(--mai-text);
    border-color: var(--mai-accent);
}
.meta-pill.popover-open {
    color: var(--mai-text);
    border-color: var(--mai-accent);
}
.meta-pill-source {
    background: rgba(106, 169, 255, 0.10);
    border-color: rgba(106, 169, 255, 0.35);
    color: #b9d5ff;
}
.meta-pill-source:hover,
.meta-pill-source.popover-open {
    background: rgba(106, 169, 255, 0.18);
    border-color: #6aa9ff;
    color: #e4eeff;
}
.meta-pill-domain {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--mai-border);
    color: var(--mai-text-muted);
}
.meta-pill-domain:hover,
.meta-pill-domain.popover-open {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--mai-text-faint);
    color: var(--mai-text);
}
.meta-pill-tag {
    background: rgba(210, 153, 34, 0.10);
    border-color: rgba(210, 153, 34, 0.35);
    color: #e3c47e;
}
.meta-pill-tag:hover,
.meta-pill-tag.popover-open {
    background: rgba(210, 153, 34, 0.18);
    border-color: #d29922;
    color: #f0d99a;
}

.tag-pills-grid {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag-pill-grid-item {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.tag-pill-grid-item[hidden] {
    display: none;
}

.tag-pill-grid-item .muted {
    color: var(--mai-text-faint);
    font-size: 0.72rem;
}

.tag-toggle {
    cursor: pointer;
}

.tag-search {
    margin: 0.5rem 0 1rem 0;
    max-width: 480px;
}

.feed-item-video {
    margin: 0.5rem 0;
}

.feed-item-video iframe,
.feed-item-video video {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: 0.4rem;
    background: #000;
}

.feed-item-audio {
    margin: 0.4rem 0;
}

.feed-item-audio audio {
    width: 100%;
}

.search-results {
    list-style: none;
    padding: 0;
    margin: 0;
}

.search-hit {
    padding: 0.5rem 0.7rem;
    border-bottom: 1px solid var(--mai-border);
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 0.4rem 0.8rem;
    align-items: baseline;
}

.search-hit-type {
    color: var(--mai-text-faint);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.search-hit-title {
    color: var(--mai-text);
    text-decoration: none;
    font-weight: 500;
}

.search-hit-title:hover {
    color: var(--mai-accent);
}

.search-hit-snippet {
    grid-column: 2;
    color: var(--mai-text-muted);
    font-size: 0.9rem;
}

.search-hit-snippet mark {
    background: var(--mai-bg-elevated-2);
    color: var(--mai-accent);
    padding: 0 0.15rem;
    border-radius: 0.15rem;
}

.feed-item-date {
    color: var(--mai-text-faint);
    margin-left: 0.3rem;
}

.feed-item-actions {
    display: flex;
    gap: 0.2rem;
}

.action-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--mai-text-faint);
    padding: 0.15rem 0.5rem;
    border-radius: 0.3rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.action-btn:hover {
    color: var(--mai-text);
    background: var(--mai-bg-elevated-2);
    border-color: var(--mai-border);
}

/* Save button: empty star by default, filled gold when the item is
   saved. The `.saved` class is toggled both by the client-side
   click handler and by `applyVisibilityToDom`, so the icon flips
   immediately on click. */
.action-btn-save .action-btn-icon::before {
    content: "\2606";  /* ☆ */
    font-size: 1.05em;
    line-height: 1;
}
.feed-item.saved .action-btn-save {
    color: var(--mai-warn);
}
.feed-item.saved .action-btn-save .action-btn-icon::before {
    content: "\2605";  /* ★ */
}

.feed-item-title {
    margin: 0.2rem 0 0.3rem 0;
    font-size: 1.05rem;
    line-height: 1.3;
    display: flex;
    gap: 0.4rem;
    align-items: baseline;
    flex-wrap: wrap;
}

.feed-item-title a,
.title-toggle {
    color: var(--mai-text);
    text-decoration: none;
    font-weight: 600;
}

.feed-item-title a:hover,
.title-toggle:hover {
    color: var(--mai-accent);
}

.title-toggle {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    line-height: inherit;
    text-align: left;
    cursor: pointer;
    width: 100%;
    display: inline;
}

.external-link {
    color: var(--mai-text-faint);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: normal;
}

.external-link:hover {
    color: var(--mai-accent);
}

.feed-item-body {
    cursor: pointer;
}

.feed-item-body:hover .title-toggle {
    color: var(--mai-accent);
}

.feed-item-preview {
    cursor: pointer;
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--mai-border);
    line-height: 1.6;
    color: var(--mai-text);
    overflow: hidden;
}

.feed-item-preview[hidden] {
    display: none;
}

.preview-content > *:first-child {
    margin-top: 0;
}

.preview-content > *:last-child {
    margin-bottom: 0;
}

.preview-content img,
.preview-content video,
.preview-content iframe {
    max-width: 100%;
    height: auto;
    border-radius: 0.3rem;
}

.preview-content pre {
    background: var(--mai-bg-elevated-2);
    padding: 0.6rem 0.8rem;
    border-radius: 0.3rem;
    overflow-x: auto;
}

.preview-content code {
    background: var(--mai-bg-elevated-2);
    padding: 0.1rem 0.4rem;
    border-radius: 0.2rem;
    font-size: 0.9em;
}

.preview-content blockquote {
    border-left: 3px solid var(--mai-border);
    margin-left: 0;
    padding-left: 0.8rem;
    color: var(--mai-text-muted);
}

.preview-content a {
    color: var(--mai-accent);
}

.preview-placeholder {
    color: var(--mai-text-faint);
    font-style: italic;
}

.feed-item-summary {
    margin: 0.3rem 0 0 0;
    color: var(--mai-text-muted);
    font-size: 0.95rem;
    line-height: 1.45;
}

.feed-item-image {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto 0.6rem auto;
    border-radius: 0.3rem;
    border: 1px solid var(--mai-border);
}

/* ---- YouTube preview link (rendered inside .feed-item-preview) -------
 * YouTube items don't embed an iframe in the body any more — the
 * preview area shows a clickable "Watch on YouTube" link instead. The
 * card uses YouTube's red as the accent on hover so it reads as a
 * video affordance. The whole link is a single anchor so it works
 * with middle-click, right-click → open in new tab, etc. The play
 * overlay on the thumbnail is decorative (aria-hidden) — the link
 * itself is the click target. */
.preview-content-youtube {
    padding: 0;
    margin-top: 0.6rem;
}
.youtube-preview-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.8rem;
    background: var(--mai-bg-elevated-2);
    border: 1px solid var(--mai-border);
    border-radius: 0.5rem;
    color: var(--mai-text);
    text-decoration: none;
    transition: background 0.12s, border-color 0.12s, transform 0.08s;
}
.youtube-preview-link:hover,
.youtube-preview-link:focus-visible {
    background: #1a1416;                /* very subtle warm wash */
    border-color: #ff0033;              /* YouTube red */
    color: var(--mai-text);
    transform: translateY(-1px);
    outline: none;
}
.youtube-preview-thumb {
    flex: 0 0 auto;
    display: block;
    width: 120px;
    height: 68px;
    object-fit: cover;
    border-radius: 0.3rem;
    border: 1px solid var(--mai-border);
    background: #000;
}
.youtube-preview-overlay {
    position: absolute;
    width: 120px;
    height: 68px;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 0.3rem;
    pointer-events: none;
    line-height: 1;
}
.youtube-preview-link:hover .youtube-preview-overlay,
.youtube-preview-link:focus-visible .youtube-preview-overlay {
    background: rgba(0, 0, 0, 0.5);
}
.youtube-preview-label {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1 1 auto;
    min-width: 0;
}
.youtube-preview-label-main {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.2;
}
.youtube-preview-link:hover .youtube-preview-label-main,
.youtube-preview-link:focus-visible .youtube-preview-label-main {
    color: #ff5577;
}
.youtube-preview-label-sub {
    font-size: 0.78rem;
    color: var(--mai-text-faint);
    line-height: 1.2;
}

.empty {
    text-align: center;
    padding: 2rem;
    background: var(--mai-bg-elevated);
    border: 1px dashed var(--mai-border);
}

.item-detail {
    max-width: 760px;
    margin: 0 auto;
    background: var(--mai-bg-elevated);
    border: 1px solid var(--mai-border);
    border-radius: 0.5rem;
    padding: 1.2rem 1.4rem;
}

.item-detail header h2 {
    margin: 0.4rem 0;
    line-height: 1.3;
}

.item-detail-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--mai-text-faint);
}

.item-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin: 1rem 0;
    padding-top: 0.8rem;
    border-top: 1px solid var(--mai-border);
}

.item-detail #item-content {
    line-height: 1.6;
    color: var(--mai-text);
}

.page-header {
    margin-bottom: 1.2rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--mai-border);
}

.page-header h2 {
    margin: 0 0 0.2rem 0;
}

.source-grid {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.6rem;
}

.source-card {
    display: block;
    background: var(--mai-bg-elevated);
    border: 1px solid var(--mai-border);
    border-left: 3px solid var(--source-color, var(--pico-muted-color));
    border-radius: 0.4rem;
    padding: 0.6rem 0.8rem;
    text-decoration: none;
    color: var(--mai-text);
    font-size: 0.9rem;
}

.source-card:hover {
    background: var(--mai-bg-elevated-2);
}

.source-card .dot {
    margin-right: 0.3rem;
}

.category-pills {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.category-pills li a {
    background: var(--mai-bg-elevated);
    border: 1px solid var(--cat-color, var(--mai-border));
    color: var(--cat-color, var(--mai-text-muted));
    border-radius: 1rem;
    padding: 0.25rem 0.8rem;
    font-size: 0.85rem;
    text-decoration: none;
}

.category-pills li a:hover {
    background: var(--cat-color, var(--mai-bg-elevated-2));
    color: var(--mai-bg);
}

.tabs-nav {
    display: flex;
    gap: 0.4rem;
    border-bottom: 1px solid var(--mai-border);
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
}

.tabs-nav a {
    padding: 0.5rem 0.9rem;
    color: var(--mai-text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    font-size: 0.9rem;
}

.tabs-nav a:hover {
    color: var(--mai-text);
}

.tabs-nav a.active {
    color: var(--mai-accent);
    border-bottom-color: var(--mai-accent);
}

table {
    font-size: 0.9rem;
}

table th, table td {
    padding: 0.5rem 0.6rem;
}

form input[type="search"] {
    margin: 0;
}

#discover-results, #add-results, #opml-import-result {
    margin-top: 0.5rem;
}

article > header strong {
    color: var(--mai-text);
}

mark {
    background: var(--mai-bg-elevated-2);
    color: var(--mai-text);
    padding: 0.2rem 0.4rem;
    border-radius: 0.3rem;
}

.htmx-indicator {
    color: var(--mai-text-faint);
    font-size: 0.85rem;
    margin-left: 0.4rem;
}

.feed-item { position: relative; }
.feed-item.hidden-locally { display: none; }
.hamburger-menu {
    position: absolute; right: 0.5rem; top: 2.4rem; z-index: 50;
    min-width: 240px; background: var(--mai-bg-elevated);
    border: 1px solid var(--mai-border); border-radius: 0.4rem;
    padding: 0.3rem; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.hamburger-menu button {
    display: block; width: 100%; text-align: left; background: transparent;
    border: none; color: var(--mai-text); padding: 0.45rem 0.6rem;
    border-radius: 0.3rem; cursor: pointer; font: inherit;
}
.hamburger-menu button:hover { background: var(--mai-bg-elevated-2); }
.hamburger-menu hr { border: none; border-top: 1px solid var(--mai-border); margin: 0.3rem 0; }

.toast-container { position: fixed; bottom: 1rem; right: 1rem; display: flex; flex-direction: column; gap: 0.4rem; z-index: 100; }
.toast {
    background: var(--mai-bg-elevated); border: 1px solid var(--mai-border);
    border-left: 3px solid var(--mai-accent); border-radius: 0.4rem;
    padding: 0.6rem 0.8rem; min-width: 240px; color: var(--mai-text);
}
.toast-actions { margin-top: 0.4rem; display: flex; gap: 0.4rem; justify-content: flex-end; }
.toast button {
    background: transparent; border: 1px solid var(--mai-border); color: var(--mai-text);
    padding: 0.15rem 0.6rem; border-radius: 0.3rem; cursor: pointer; font-size: 0.85rem;
}
.toast button:hover { background: var(--mai-bg-elevated-2); }

.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center; z-index: 200;
    animation: modal-fade-in 0.15s ease;
}
@keyframes modal-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-pop-in  {
    from { opacity: 0; transform: translateY(-6px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}
.modal {
    background: var(--mai-bg-elevated);
    border: 1px solid var(--mai-border);
    border-radius: 0.6rem;
    width: 520px; max-width: calc(100vw - 2rem);
    box-shadow: 0 12px 40px rgba(0,0,0,0.55);
    animation: modal-pop-in 0.18s ease;
    overflow: hidden;
    display: flex; flex-direction: column;
}
.modal-header { padding: 1.25rem 1.5rem 0.75rem 1.5rem; }
.modal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0 0 0.7rem 0;
    border-radius: 0.5rem;
    background: var(--mai-bg-elevated-2);
    border: 1px solid var(--mai-border);
    color: var(--mai-text-muted);
}
.modal-icon svg {
    display: block;
    width: 22px;
    height: 22px;
}
.modal-header h3 {
    margin: 0 0 0.4rem 0;
    font-size: 1.15rem; font-weight: 600; line-height: 1.3;
    color: var(--mai-text);
}
.modal-subtitle {
    margin: 0; color: var(--mai-text-muted);
    font-size: 0.875rem; line-height: 1.45;
}
.modal-body { padding: 0.25rem 1.5rem 0.75rem 1.5rem; }
.modal-body textarea {
    width: 100%; min-height: 96px; resize: vertical;
    background: var(--mai-bg); color: var(--mai-text);
    border: 1px solid var(--mai-border); border-radius: 0.4rem;
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem; line-height: 1.5; font-family: inherit;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.modal-body textarea:focus {
    outline: none;
    border-color: var(--mai-accent);
    box-shadow: 0 0 0 3px rgba(91, 157, 255, 0.18);
}
.modal-body .char-count {
    color: var(--mai-text-faint); font-size: 0.75rem;
    margin-top: 0.4rem; text-align: right;
}
.modal-body .char-count.over { color: var(--mai-danger); }
.modal-footer {
    display: flex; gap: 0.5rem; justify-content: flex-end;
    padding: 0.85rem 1.5rem 1.1rem 1.5rem;
    background: var(--mai-bg-elevated-2);
    border-top: 1px solid var(--mai-border);
}
.modal-footer button {
    background: transparent;
    border: 1px solid var(--mai-border);
    color: var(--mai-text);
    padding: 0.5rem 1.1rem; border-radius: 0.4rem;
    font-size: 0.875rem; font-weight: 500; cursor: pointer;
    transition: background 0.1s ease, border-color 0.1s ease, color 0.1s ease;
}
.modal-footer button:hover {
    background: var(--mai-bg-elevated);
    border-color: var(--mai-text-faint);
}
.modal-footer button.primary {
    background: var(--mai-accent);
    border-color: var(--mai-accent);
    color: #fff;
}
.modal-footer button.primary:hover {
    background: #4a8ce8;
    border-color: #4a8ce8;
}

/* ---- help / "How to use" popup ----
   Reads as a small reference card. The base .modal styles above give
   the dialog shape; this block adds the wider variant and the inner
   content layout (lede + sectioned lists + keyboard table). */
.modal-help {
    width: 640px;
    max-height: calc(100vh - 3rem);
}
.modal-body-help {
    overflow-y: auto;
    padding: 0.5rem 1.5rem 0.75rem 1.5rem;
}
.help-content {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    color: var(--mai-text);
    font-size: 0.9rem;
    line-height: 1.5;
}
.help-lede {
    margin: 0;
    color: var(--mai-text-muted);
    font-size: 0.9rem;
}
.help-section {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.help-section h4 {
    margin: 0 0 0.1rem 0;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--mai-text-muted);
}
.help-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.help-list li {
    padding-left: 0.4rem;
}
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: -2px;
    color: var(--mai-text-muted);
    margin: 0 0.15rem;
}
.help-glyph {
    display: inline-block;
    font-size: 0.95rem;
    line-height: 1;
    color: var(--mai-warn);
    transform: translateY(1px);
}
.help-kbd-list li {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.help-note {
    margin: 0.25rem 0 0 0;
    color: var(--mai-text-faint);
    font-size: 0.82rem;
    font-style: italic;
}
kbd {
    display: inline-block;
    min-width: 1.4rem;
    padding: 0.05rem 0.4rem;
    font: inherit;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--mai-text);
    background: var(--mai-bg-elevated-2);
    border: 1px solid var(--mai-border);
    border-bottom-width: 2px;
    border-radius: 0.3rem;
    text-align: center;
}

.settings-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.settings-list li {
    background: var(--mai-bg-elevated); border: 1px solid var(--mai-border);
    border-radius: 0.4rem; padding: 0.7rem 0.9rem;
}
.settings-list textarea {
    width: 100%; min-height: 70px; resize: vertical;
    background: var(--mai-bg); color: var(--mai-text);
    border: 1px solid var(--mai-border); border-radius: 0.3rem; padding: 0.4rem;
    font: inherit; margin-top: 0.4rem;
}
.settings-list .row { display: flex; gap: 0.5rem; justify-content: space-between; align-items: baseline; flex-wrap: wrap; }
.settings-list .actions { display: flex; gap: 0.4rem; margin-top: 0.4rem; }
.settings-list .actions button {
    background: var(--mai-bg-elevated-2); border: 1px solid var(--mai-border);
    color: var(--mai-text); padding: 0.3rem 0.7rem; border-radius: 0.3rem; cursor: pointer; font-size: 0.85rem;
}
.danger-zone { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--mai-border); }
.danger-zone button { background: transparent; border: 1px solid var(--mai-danger); color: var(--mai-danger); padding: 0.4rem 0.9rem; border-radius: 0.3rem; cursor: pointer; }

/* /hidden page — controls appended below each hidden item row. */
.hidden-item-controls {
    margin: 0.6rem 0.8rem 0.8rem;
    padding: 0.6rem 0.7rem;
    background: var(--mai-bg-elevated);
    border: 1px solid var(--mai-border);
    border-radius: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.hidden-item-feedback { display: flex; flex-direction: column; gap: 0.3rem; }
.hidden-item-feedback textarea {
    width: 100%; min-height: 60px; resize: vertical;
    background: var(--mai-bg); color: var(--mai-text);
    border: 1px solid var(--mai-border); border-radius: 0.3rem; padding: 0.4rem;
    font: inherit;
}
.hidden-item-feedback .char-count { color: var(--mai-text-faint); font-size: 0.8rem; align-self: flex-end; }
.hidden-item-feedback .char-count.over { color: var(--mai-danger); }
.hidden-item-actions { display: flex; gap: 0.4rem; justify-content: flex-end; }
.hidden-item-actions button {
    background: var(--mai-bg-elevated-2); border: 1px solid var(--mai-border);
    color: var(--mai-text); padding: 0.3rem 0.7rem; border-radius: 0.3rem;
    cursor: pointer; font: inherit; font-size: 0.85rem;
}
.hidden-item-actions button:hover { background: var(--mai-bg); }
.hidden-item-actions button.primary { border-color: var(--mai-accent); color: var(--mai-accent); }
.hidden-item-actions button.primary:hover { background: var(--mai-bg-elevated); }
.hidden-list-error { padding: 1rem; color: var(--mai-danger); }

@media (min-width: 801px) {
    .app-header {
        position: sticky;
        top: 0;
        z-index: 100;
    }
    .app-footer {
        position: sticky;
        bottom: 0;
        z-index: 100;
    }
}

@media (max-width: 800px) {
    .footer-extras {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    .footer-promo-row {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    .footer-promo {
        flex: 1 1 auto;
        justify-content: center;
        padding: 0.55rem 0.8rem;
        font-size: 13px;
        white-space: normal;
        text-align: center;
    }
    .footer-toggle {
        display: inline-flex;
        flex: 0 0 auto;
    }
    .footer-links {
        display: none;
        flex-direction: column;
        gap: 0;
        padding: 0.25rem 0.25rem 0;
        border-top: 1px solid var(--mai-border);
    }
    .footer-links.expanded {
        display: flex;
    }
    .footer-links li + li::before {
        content: none;
        margin-right: 0;
    }
    .footer-links a {
        display: block;
        padding: 0.55rem 0.6rem;
        font-size: 14px;
    }
    .footer-link-credits-li {
        margin-left: 0;
        padding-left: 0.6rem;
        border-left: none;
        border-top: 1px solid #2d333b;
        margin-top: 0.4rem;
    }
}

/* ---- filter bar (generic show/hide for tags/sources/domains) ----
 * Minimal: no border or background on the wrapper. The toggle is just
 * the chevron + count, left-aligned, sitting on the page background.
 * The body (when expanded) has a top hairline so it visually detaches
 * from the toggle row above it. */
.filter-bar {
    margin-bottom: 0.4rem;
}
.filter-bar-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0.2rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--mai-text-muted);
    font: inherit;
    font-size: 0.85rem;
    text-align: left;
}
.filter-bar-toggle:hover { color: var(--mai-text); }
.filter-bar-toggle:focus,
.filter-bar-toggle:focus-visible {
    color: var(--mai-text);
    outline: none;
    box-shadow: none;
}
.filter-bar-toggle-chevron {
    display: inline-block;
    transition: transform 0.15s ease;
    font-size: 0.75rem;
    color: var(--mai-text-faint);
}
.filter-bar-toggle[aria-expanded="false"] .filter-bar-toggle-chevron { transform: rotate(-90deg); }
.filter-bar-toggle-count {
    color: var(--mai-text-faint);
    font-weight: 400;
}

.filter-bar-body {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.45rem 0 0.6rem;
    border-top: 1px solid var(--mai-border);
    margin-top: 0.2rem;
}
.filter-bar.collapsed .filter-bar-body { display: none; }

/* ---- hidden page empty placeholder — flat text, no box ---- */
.hidden-empty {
    color: var(--mai-text-faint);
    font-size: 0.9rem;
    margin: 0.4rem 0.2rem;
}

.filter-bar-bulk { display: inline-flex; gap: 0.35rem; align-self: flex-start; }
.filter-pills {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.filter-pills-section {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}
.filter-pills-section-label {
    flex: 0 0 auto;
    font-size: 0.72rem;
    color: var(--mai-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-top: 0.28rem;
    min-width: 4.5rem;
    font-weight: 600;
}
.filter-pills-section-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.35rem;
    align-items: center;
    flex: 1 1 auto;
}
.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 0.9rem;
    border: 1px solid var(--mai-border);
    background: var(--mai-bg-elevated-2);
    color: var(--mai-text);
    font: inherit;
    font-size: 0.82rem;
    line-height: 1.3;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.1s, color 0.1s, border-color 0.1s, opacity 0.1s;
}
.filter-pill:hover { border-color: var(--mai-accent); color: var(--mai-text); }
.filter-pill:focus-visible { outline: 2px solid var(--mai-accent); outline-offset: 1px; }
.filter-pill.disabled {
    opacity: 0.55;
    text-decoration: line-through;
    color: var(--mai-text-muted);
}
/* ---- per-section visual distinction (no dots, styling instead) ----
 * All three sections share the same pill shape — identical font, size,
 * weight, padding, border-radius, border-width. They differ ONLY in
 * accent colour: Sources = primary blue, Domains = neutral gray,
 * Tags = warm orange (warn). Disabled state uniformly applies the
 * `.filter-pill.disabled` strikethrough + 0.55 opacity from the base
 * rule; the section-specific `.disabled` overrides below just dim the
 * background/border/text for that section's accent. */
.filter-pills-section[data-section-type="source"] .filter-pills-section-label { color: #6aa9ff; }
.filter-pills-section[data-section-type="domain"] .filter-pills-section-label { color: var(--mai-text-muted); }
.filter-pills-section[data-section-type="tag"]    .filter-pills-section-label { color: #d29922; }

.filter-pills-section[data-section-type="source"] .filter-pill {
    background: rgba(106, 169, 255, 0.10);
    border-color: rgba(106, 169, 255, 0.35);
    color: #b9d5ff;
}
.filter-pills-section[data-section-type="source"] .filter-pill:hover {
    background: rgba(106, 169, 255, 0.18);
    border-color: #6aa9ff;
    color: #e4eeff;
}
.filter-pills-section[data-section-type="source"] .filter-pill.disabled {
    background: rgba(106, 169, 255, 0.05);
    border-color: rgba(106, 169, 255, 0.18);
    color: rgba(185, 213, 255, 0.55);
}

.filter-pills-section[data-section-type="domain"] .filter-pill {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--mai-border);
    color: var(--mai-text-muted);
}
.filter-pills-section[data-section-type="domain"] .filter-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--mai-text-faint);
    color: var(--mai-text);
}
.filter-pills-section[data-section-type="domain"] .filter-pill.disabled {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.05);
    color: rgba(230, 237, 243, 0.30);
}

.filter-pills-section[data-section-type="tag"] .filter-pill {
    background: rgba(210, 153, 34, 0.10);
    border-color: rgba(210, 153, 34, 0.35);
    color: #e3c47e;
}
.filter-pills-section[data-section-type="tag"] .filter-pill:hover {
    background: rgba(210, 153, 34, 0.18);
    border-color: #d29922;
    color: #f0d99a;
}
.filter-pills-section[data-section-type="tag"] .filter-pill.disabled {
    background: rgba(210, 153, 34, 0.04);
    border-color: rgba(210, 153, 34, 0.15);
    color: rgba(227, 196, 126, 0.55);
}

.filter-pill-bulk {
    border-width: 1px;
    font-weight: 600;
}
.filter-pill-bulk.filter-pill-all {
    color: #4caf82;
    border-color: #2c6b50;
}
.filter-pill-bulk.filter-pill-all:hover {
    background: #1f3b30;
    color: #6fdcaa;
    border-color: #4caf82;
}
.filter-pill-bulk.filter-pill-all.active {
    background: #2c6b50;
    color: #eafff5;
    border-color: #4caf82;
}


.filter-pill-flash {
    animation: filter-pill-flash-anim 0.7s ease;
}
@keyframes filter-pill-flash-anim {
    0%   { box-shadow: 0 0 0 0   rgba(255, 220, 100, 0.85); }
    40%  { box-shadow: 0 0 0 0.35rem rgba(255, 220, 100, 0.55); }
    100% { box-shadow: 0 0 0 0   rgba(255, 220, 100, 0); }
}

.filter-bar-empty {
    color: var(--mai-text-faint);
    font-size: 0.85rem;
    font-style: italic;
    padding: 0.2rem 0.4rem;
}

/* ---- pill popover (click-popup for source/domain/tag pills) ----
 * Clicking a pill opens this small popup with two buttons side by
 * side: "Hide" (eye-with-cross icon) and "Go to" (page-with-arrow
 * icon). Modifier-clicks and middle-clicks on the pill bypass the
 * popup and let the browser navigate (e.g. open in new tab). The
 * popup stays put until the user picks an action, presses Escape,
 * or clicks outside it. */
.pill-popover {
    position: absolute;
    z-index: 1000;
    min-width: 16rem;
    background: var(--mai-bg-elevated-2);
    border: 1px solid var(--mai-border);
    border-radius: 0.55rem;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
    padding: 0.45rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.pill-popover-heading {
    font-size: 0.78rem;
    color: var(--mai-text-muted);
    padding: 0.1rem 0.35rem 0.3rem;
    border-bottom: 1px solid var(--mai-border);
    word-break: break-word;
}
.pill-popover-actions {
    display: flex;
    gap: 0.4rem;
}
.pill-popover-action {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    background: transparent;
    border: 1px solid var(--mai-border);
    color: var(--mai-text);
    font: inherit;
    font-size: 0.85rem;
    padding: 0.45rem 0.6rem;
    border-radius: 0.4rem;
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.pill-popover-action svg {
    flex-shrink: 0;
}
.pill-popover-action:hover,
.pill-popover-action:focus-visible {
    background: var(--mai-bg);
    border-color: var(--mai-text-faint);
    color: var(--mai-text);
    outline: none;
}
.pill-popover-hide:hover,
.pill-popover-hide:focus-visible {
    background: rgba(255, 107, 107, 0.10);
    border-color: var(--mai-danger, #ff6b6b);
    color: var(--mai-danger, #ff6b6b);
}
.pill-popover-goto:hover,
.pill-popover-goto:focus-visible {
    background: rgba(106, 169, 255, 0.10);
    border-color: var(--mai-accent, #6aa9ff);
    color: var(--mai-accent, #6aa9ff);
}

/* ---- related articles (trending mode) ---- */
.feed-item-related {
    padding: 0.4rem 0.9rem 0.6rem;
    border-top: 1px dashed var(--mai-border);
    margin-top: 0.4rem;
}
.related-toggle {
    background: none;
    border: none;
    color: var(--mai-text-muted);
    font-size: 0.78rem;
    cursor: pointer;
    padding: 0.15rem 0;
    text-decoration: underline dotted;
    text-underline-offset: 3px;
}
.related-toggle:hover { color: var(--mai-accent); }
.related-toggle[aria-expanded="true"] { color: var(--mai-text); }
.related-list {
    list-style: none;
    padding: 0.35rem 0 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.related-item {
    font-size: 0.82rem;
    color: var(--mai-text-muted);
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.related-item a {
    color: var(--mai-text);
    text-decoration: none;
}
.related-item a:hover { color: var(--mai-accent); text-decoration: underline; }
.related-source {
    color: var(--mai-text-faint);
    font-size: 0.72rem;
}
