:root {
    color-scheme: dark;
    --bg: #111315;
    --sidebar: #171a1d;
    --surface: #1c2024;
    --surface-hover: #23282d;
    --border: #2b3035;
    --text: #f1f3f5;
    --muted: #929aa3;
    --accent: #79c99e;
    --sidebar-width: 260px;
    --preview-width: minmax(360px, 0.85fr);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    min-width: 320px;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

button {
    color: inherit;
}

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 0;
    outline: none;
    background: #131619;
    color: var(--text);
}

select,
input[type="url"],
input[type="number"],
input[type="file"] {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 0;
    outline: none;
    background: #131619;
    color: var(--text);
}

select:focus,
input[type="url"]:focus,
input[type="number"]:focus,
input[type="file"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.primary-button,
.secondary-button,
.danger-button {
    min-height: 40px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: 0;
    cursor: pointer;
    font-weight: 700;
}

.primary-button {
    background: var(--accent);
    color: #0d1b13;
}

.secondary-button {
    border-color: var(--border);
    background: var(--surface);
}

.danger-button {
    border-color: #814646;
    background: #412525;
    color: #ffd6d6;
}

.app-shell {
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
}

.sidebar,
.preview-pane {
    display: none;
}

.mobile-header {
    height: calc(58px + env(safe-area-inset-top));
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: env(safe-area-inset-top) calc(16px + env(safe-area-inset-right)) 0 calc(16px + env(safe-area-inset-left));
    border-bottom: 1px solid var(--border);
    background: var(--sidebar);
}

.mobile-back,
.mobile-header-spacer {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
}

.mobile-back {
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 1.75rem;
    line-height: 1;
}

.mobile-back:hover,
.mobile-back:focus-visible {
    color: var(--text);
}

.mobile-brand,
.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 750;
}

.brand-mark,
.user-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

.mobile-header .brand-mark,
.auth-brand .brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: cover;
}

.mobile-user-menu {
    position: relative;
}

.mobile-user-menu summary,
.user-menu summary {
    list-style: none;
    cursor: pointer;
}

.mobile-user-menu summary::-webkit-details-marker,
.user-menu summary::-webkit-details-marker {
    display: none;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
}

.mobile-user-menu .user-menu-panel {
    position: absolute;
    top: 42px;
    right: 0;
    z-index: 20;
    width: 210px;
}

.user-menu-panel {
    max-height: calc(100dvh - 90px);
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.user-menu-panel > a,
.user-menu-panel button,
.user-menu-panel > strong {
    width: 100%;
    display: block;
    padding: 9px 10px;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
}

.user-menu-panel > strong {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.78rem;
    text-overflow: ellipsis;
}

.user-menu-panel button {
    cursor: pointer;
}

.user-menu-panel > a:hover,
.user-menu-panel button:hover {
    background: var(--surface-hover);
}

.story-list {
    min-height: calc(100vh - 122px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    min-height: calc(100dvh - 122px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}

.list-header {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}

.list-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.bulk-read-form .secondary-button {
    min-height: 36px;
    padding: 6px 11px;
    white-space: nowrap;
}

.queue-mode-toggle {
    min-height: 36px;
    padding: 6px 11px;
    white-space: nowrap;
}

.queue-mode-label {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.7rem;
}

.story-list.is-read-mode .story-source,
.story-list.is-read-mode .story-time {
    color: #78818a;
}

.eyebrow {
    margin: 0 0 3px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: 1.35rem;
    line-height: 1.2;
}

.unread-count {
    min-width: 28px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.empty-state {
    min-height: calc(100vh - 199px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    min-height: calc(100dvh - 199px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    display: grid;
    align-content: center;
    justify-items: center;
    padding: 40px 28px;
    text-align: center;
}

.empty-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    margin-bottom: 20px;
    border: 1px solid #3c6e55;
    border-radius: 50%;
    color: var(--accent);
    font-size: 1.2rem;
}

.empty-state h2 {
    margin-bottom: 8px;
    font-size: 1.15rem;
}

.empty-state p {
    max-width: 390px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.55;
}

.bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10;
    height: calc(64px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 5px calc(8px + env(safe-area-inset-right)) env(safe-area-inset-bottom) calc(8px + env(safe-area-inset-left));
    border-top: 1px solid var(--border);
    background: var(--sidebar);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--muted);
    font-size: 0.68rem;
}

.bottom-nav-item > span:first-child {
    min-height: 18px;
    font-size: 1rem;
    line-height: 1;
}

.bottom-nav-item.is-active {
    color: var(--accent);
}

.bottom-nav-item.is-disabled {
    opacity: 0.55;
}

.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 18px;
}

.auth-panel {
    width: 100%;
    max-width: 390px;
    padding: 30px 24px;
    border: 1px solid var(--border);
    background: var(--sidebar);
}

.auth-panel-wide {
    max-width: 440px;
}

.auth-brand {
    margin-bottom: 34px;
}

.auth-panel h1 {
    margin-bottom: 22px;
    font-size: 1.5rem;
}

.user-form {
    display: grid;
    gap: 10px;
}

.user-preference-form {
    max-width: 620px;
    padding: 18px;
    border: 1px solid var(--border);
    background: var(--sidebar);
}

.user-preference-form .check-row span {
    display: grid;
    gap: 4px;
}

.user-preference-form .check-row strong {
    color: var(--text);
    font-size: 0.84rem;
}

.user-preference-form .check-row small {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 400;
}

.user-preference-form .secondary-button {
    justify-self: start;
}

.user-form label {
    color: #c4c9ce;
    font-size: 0.82rem;
    font-weight: 650;
}

.auth-form {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
}

.auth-field {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
}

.auth-field label,
.auth-form .check-row {
    color: #c4c9ce;
    font-size: 0.82rem;
    font-weight: 650;
}

.auth-field input {
    display: block;
    width: 100%;
}

.auth-form .primary-button {
    width: 100%;
    margin-top: 2px;
}

.check-row {
    display: flex !important;
    align-items: flex-start;
    gap: 9px;
    line-height: 1.4;
}

.check-row input {
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    accent-color: var(--accent);
}

.field-help,
.auth-footnote {
    color: var(--muted);
    font-size: 0.78rem;
}

.field-help {
    margin: 0;
    line-height: 1.45;
}

.auth-footnote {
    margin: 22px 0 0;
    text-align: center;
}

.auth-footnote a {
    color: var(--accent);
}

.auth-footnote a:hover {
    text-decoration: underline;
}

@media (max-width: 420px) {
    .auth-page {
        align-items: flex-start;
        padding: 18px 12px;
    }

    .auth-panel {
        padding: 24px 18px;
    }

    .auth-brand {
        margin-bottom: 28px;
    }
}

.alert {
    margin-bottom: 18px;
    padding: 11px 13px;
    border: 1px solid var(--border);
    font-size: 0.84rem;
    line-height: 1.45;
}

.alert p {
    margin-bottom: 0;
}

.alert p + p {
    margin-top: 5px;
}

.alert-error {
    border-color: #704242;
    background: #2b1d1d;
    color: #ffd1d1;
}

.alert-success {
    border-color: #3c6e55;
    background: #17271f;
    color: #bce8ce;
}

.management-page {
    min-width: 0;
    min-height: calc(100vh - 122px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    min-height: calc(100dvh - 122px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}

.management-content {
    width: min(100%, 980px);
    margin: 0 auto;
    padding: 22px 16px 48px;
}

.management-section + .management-section {
    margin-top: 34px;
}

.management-section > h2 {
    margin-bottom: 14px;
    font-size: 1rem;
}

.profile-content {
    max-width: 760px;
}

.profile-section {
    padding: 18px;
    border: 1px solid var(--border);
    background: var(--sidebar);
}

.profile-form {
    max-width: 620px;
}

.profile-form > .secondary-button {
    justify-self: start;
}

.profile-section .user-preference-form {
    padding: 0;
    border: 0;
    background: transparent;
}

.profile-details {
    max-width: 620px;
    border-top: 1px solid var(--border);
}

.profile-details:first-of-type {
    margin-top: 18px;
}

.profile-details > summary {
    padding: 13px 0;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 650;
}

.profile-details[open] > summary {
    color: var(--text);
}

.profile-details .profile-form {
    padding-bottom: 16px;
}

.profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.user-create-form,
.user-record {
    padding: 18px;
    border: 1px solid var(--border);
    background: var(--sidebar);
}

.user-create-form {
    grid-template-columns: 1fr;
}

.user-form label input {
    margin-top: 6px;
}

.user-list {
    display: grid;
    gap: 12px;
}

.user-record > header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 12px;
}

.user-record h3 {
    margin: 0 0 4px;
    font-size: 0.98rem;
}

.user-record header p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.8rem;
}

.current-badge {
    padding: 3px 7px;
    border: 1px solid #3c6e55;
    color: var(--accent);
    font-size: 0.68rem;
    white-space: nowrap;
}

.user-record details {
    border-top: 1px solid var(--border);
}

.user-record details > summary {
    padding: 12px 2px;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 650;
}

.user-record details[open] > summary {
    color: var(--text);
}

.user-record .user-form {
    padding: 4px 2px 16px;
}

.compact-form p {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 0.8rem;
}

.danger-details summary {
    color: #d99b9b !important;
}

.nav-count {
    min-width: 2ch;
    flex: 0 0 auto;
    margin-left: auto;
    color: var(--muted);
    font-size: 0.7rem;
    font-variant-numeric: tabular-nums;
}

.nav-icon-muted {
    color: var(--muted) !important;
}

.folder-tree {
    margin: 0 -10px;
}

.folder-row {
    min-width: 0;
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: stretch;
}

.folder-toggle {
    min-width: 24px;
    min-height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: #737c84;
    cursor: pointer;
}

.folder-toggle span {
    display: block;
    font-size: 1rem;
    line-height: 1;
    transition: transform 150ms ease;
}

.folder-group.is-expanded .folder-toggle span {
    transform: rotate(90deg);
}

.folder-toggle:hover,
.folder-toggle:focus-visible {
    color: var(--text);
}

.folder-link,
.feed-link {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
}

.folder-link > span:first-child,
.feed-link > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.folder-link {
    padding-left: 1px;
    font-weight: 700;
}

.feed-tree-wrapper {
    display: grid;
    grid-template-rows: 0fr;
    visibility: hidden;
    transition: grid-template-rows 150ms ease, visibility 0s linear 150ms;
}

.folder-group.is-expanded .feed-tree-wrapper {
    grid-template-rows: 1fr;
    visibility: visible;
    transition: grid-template-rows 150ms ease;
}

.feed-tree {
    min-height: 0;
    padding: 0 0 0 24px;
    overflow: hidden;
}

.folder-group.is-expanded .feed-tree {
    padding-bottom: 5px;
}

.feed-link {
    color: var(--muted);
    font-size: 0.76rem;
}

.folder-link:hover,
.folder-link.is-active,
.feed-link:hover,
.feed-link.is-active {
    background: var(--surface);
    color: var(--text);
}

.unfiled-feeds {
    padding: 5px 0 0 24px;
}

.story-row {
    position: relative;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.story-row:hover,
.story-row.is-selected {
    background: var(--surface);
}

.story-row.is-selected {
    box-shadow: inset 3px 0 0 var(--accent);
}

.story-select {
    min-width: 0;
    display: flex;
    gap: 13px;
    padding: 15px 70px 15px 18px;
}

.story-thumbnail {
    width: 74px;
    height: 74px;
    flex: 0 0 auto;
    object-fit: cover;
    background: var(--surface);
}

.story-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.story-source {
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.03em;
}

.story-headline {
    overflow: hidden;
    font-size: 0.95rem;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.story-excerpt {
    display: -webkit-box;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.story-time {
    color: #717981;
    font-size: 0.7rem;
}

.story-row > .story-state-form {
    position: absolute;
    top: 15px;
    right: 14px;
}

.story-row > .story-state-form button {
    padding: 5px 7px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.7rem;
}

.story-row > .story-state-form button:hover {
    border-color: var(--border);
    color: var(--text);
}

.preview-empty {
    min-height: 100%;
    display: grid;
    place-items: center;
    padding: 30px;
    color: var(--muted);
    font-size: 0.82rem;
    text-align: center;
}

.story-preview {
    position: relative;
    max-width: 760px;
    margin: 0 auto;
    padding: 34px 30px 60px;
}

.story-preview h2 {
    margin-bottom: 12px;
    font-size: clamp(1.35rem, 2.4vw, 2rem);
    line-height: 1.25;
}

.preview-close {
    position: absolute;
    top: 18px;
    right: 20px;
    color: var(--muted);
    font-size: 1.45rem;
}

.preview-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 16px;
    margin-bottom: 24px;
    color: var(--muted);
    font-size: 0.76rem;
}

.preview-image {
    width: 100%;
    max-height: 320px;
    margin-bottom: 24px;
    object-fit: cover;
}

.preview-summary {
    color: #cbd0d5;
    font-size: 0.92rem;
    line-height: 1.7;
}

.preview-summary-empty {
    color: var(--muted);
}

.preview-actions,
.feed-record-actions,
.folder-row-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.preview-actions {
    margin-top: 28px;
}

.preview-actions .primary-button {
    display: inline-grid;
    place-items: center;
}

.readit-capture-link {
    display: inline-grid;
    place-items: center;
}

.readit-capture-link[aria-disabled="true"] {
    cursor: wait;
    opacity: 0.68;
}

.readit-capture-status {
    flex-basis: 100%;
    color: var(--muted);
    font-size: 0.76rem;
}

.readit-capture-status:empty {
    display: none;
}

.management-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 13px;
    padding: 18px;
    border: 1px solid var(--border);
    background: var(--sidebar);
}

.management-form label {
    color: #c4c9ce;
    font-size: 0.8rem;
    font-weight: 650;
}

.management-form label input,
.management-form label select {
    margin-top: 6px;
}

.folder-management-list,
.feed-management-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.folder-management-row,
.feed-record {
    padding: 16px;
    border: 1px solid var(--border);
    background: var(--sidebar);
}

.folder-management-row {
    display: grid;
    gap: 10px;
}

.folder-rename-form {
    display: flex;
    gap: 8px;
}

.folder-rename-form label {
    flex: 1;
}

.folder-feed-count,
.management-empty {
    color: var(--muted);
    font-size: 0.76rem;
}

.icon-button,
.text-danger-button {
    min-height: 34px;
    padding: 5px 9px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.text-danger-button {
    color: #d99b9b;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.feed-record.is-disabled {
    opacity: 0.72;
}

.feed-record > header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
}

.feed-record h3 {
    margin: 0 0 5px;
    font-size: 1rem;
}

.feed-record header p {
    max-width: 650px;
    overflow: hidden;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.75rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-badge {
    align-self: flex-start;
    padding: 3px 7px;
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.68rem;
}

.status-badge.is-enabled {
    border-color: #3c6e55;
    color: var(--accent);
}

.feed-status-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.feed-status-grid dt {
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 0.68rem;
    text-transform: uppercase;
}

.feed-status-grid dd {
    margin: 0;
    overflow: hidden;
    font-size: 0.77rem;
    text-overflow: ellipsis;
}

.feed-error {
    margin-bottom: 14px;
    padding: 9px 11px;
    border-left: 2px solid #814646;
    background: #2b1d1d;
    color: #ffd1d1;
    font-size: 0.76rem;
}

.feed-record details {
    margin: 12px 0;
    border-top: 1px solid var(--border);
}

.feed-record details > summary {
    padding: 12px 0;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 650;
}

.feed-record .compact-form {
    display: grid;
    justify-items: start;
    gap: 12px;
    padding-bottom: 8px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.management-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 20px;
}

.management-toolbar .secondary-button,
.opml-confirm-actions > a {
    display: inline-grid;
    place-items: center;
}

.section-guidance {
    max-width: 680px;
    margin-bottom: 16px;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.55;
}

.empty-action {
    display: inline-grid;
    place-items: center;
    margin-top: 20px;
}

.opml-summary,
.result-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    border: 1px solid var(--border);
    background: var(--border);
}

.opml-summary > div,
.result-grid > div {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px;
    background: var(--sidebar);
}

.opml-summary strong,
.result-grid strong {
    font-size: 1.15rem;
    font-variant-numeric: tabular-nums;
}

.opml-summary span,
.result-grid span {
    color: var(--muted);
    font-size: 0.7rem;
}

.opml-structure {
    display: grid;
    gap: 12px;
}

.opml-folder {
    border: 1px solid var(--border);
    background: var(--sidebar);
}

.opml-folder > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 15px;
    border-bottom: 1px solid var(--border);
}

.opml-folder h3 {
    margin: 0;
    font-size: 0.88rem;
}

.flattened-note {
    margin: 0;
    padding: 9px 15px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.7rem;
}

.opml-feed-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 15px;
    border-bottom: 1px solid var(--border);
}

.opml-feed-row:last-child {
    border-bottom: 0;
}

.opml-feed-row > div {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.opml-feed-row strong {
    font-size: 0.8rem;
}

.opml-feed-row span:not(.status-badge),
.opml-feed-row small {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.68rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.opml-feed-row small,
.opml-feed-row.is-invalid strong {
    color: #d99b9b;
}

.opml-confirm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 20px;
}

.import-progress progress {
    width: 100%;
    height: 10px;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: var(--surface);
    color: var(--accent);
}

.import-progress progress::-webkit-progress-bar {
    background: var(--surface);
}

.import-progress progress::-webkit-progress-value {
    background: var(--accent);
}

.import-progress progress::-moz-progress-bar {
    background: var(--accent);
}

.progress-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    margin: 16px 0;
    color: var(--muted);
    font-size: 0.76rem;
}

.progress-counts strong {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.current-feed {
    margin-bottom: 16px;
    color: var(--muted);
    font-size: 0.8rem;
}

.import-warnings {
    margin: 20px 0;
    border: 1px solid var(--border);
}

.import-warnings > summary {
    padding: 12px 14px;
    color: #d99b9b;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
}

.warning-list > div {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border-top: 1px solid var(--border);
}

.warning-list strong {
    font-size: 0.8rem;
}

.warning-list span,
.warning-list p {
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--muted);
    font-size: 0.7rem;
}

.refresh-detail-grid,
.refresh-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    margin: 0;
    border: 1px solid var(--border);
    background: var(--border);
}

.refresh-detail-grid > div,
.refresh-summary-grid > div {
    min-width: 0;
    padding: 14px;
    background: var(--sidebar);
}

.refresh-detail-grid dt,
.refresh-summary-grid dt {
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.refresh-detail-grid dd,
.refresh-summary-grid dd {
    margin: 0;
    font-size: 0.84rem;
    font-variant-numeric: tabular-nums;
}

.refresh-summary-grid dd {
    font-size: 1.2rem;
    font-weight: 750;
}

.run-status {
    color: var(--text);
    white-space: nowrap;
}

.run-status-completed {
    color: var(--accent);
}

.run-status-completed_with_warnings,
.run-status-failed {
    color: #e2abab;
}

.refresh-failures {
    border: 1px solid var(--border);
    background: var(--sidebar);
}

.refresh-failures > summary {
    padding: 12px 14px;
    color: #e2abab;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
}

.refresh-failure-list article {
    display: grid;
    gap: 5px;
    padding: 13px 14px;
    border-top: 1px solid var(--border);
}

.refresh-failure-list h3,
.refresh-failure-list p {
    margin: 0;
}

.refresh-failure-list h3 {
    font-size: 0.84rem;
}

.refresh-failure-list a,
.refresh-failure-list p,
.refresh-failure-list small {
    overflow-wrap: anywhere;
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.45;
}

.refresh-failure-list a:hover {
    color: var(--accent);
}

.refresh-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
}

.refresh-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    background: var(--sidebar);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.refresh-table th,
.refresh-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.refresh-table th {
    color: var(--muted);
    font-size: 0.66rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.refresh-table tbody tr:last-child td {
    border-bottom: 0;
}

.refresh-empty {
    padding: 28px;
    border: 1px solid var(--border);
    background: var(--sidebar);
}

.refresh-empty h2 {
    margin-bottom: 7px;
    font-size: 1rem;
}

.refresh-empty p,
.secondary-link {
    color: var(--muted);
    font-size: 0.8rem;
}

.secondary-link:hover {
    color: var(--text);
}

.sidebar-close,
.mobile-sidebar-toggle,
.sidebar-backdrop {
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.sidebar-close {
    display: none;
}

.mobile-sidebar-toggle {
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 1rem;
}

.sidebar-backdrop {
    display: none;
}

.bottom-nav button.bottom-nav-item {
    border: 0;
    background: transparent;
}

.mobile-folders-page {
    min-height: calc(100vh - 122px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    min-height: calc(100dvh - 122px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}

.mobile-folder-navigation {
    padding: 12px 16px 36px;
}

.mobile-unread-row {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    padding: 0 12px;
    border: 1px solid var(--border);
    background: var(--sidebar);
    font-size: 0.9rem;
    font-weight: 700;
}

.mobile-unread-row:hover,
.mobile-unread-row:focus-visible {
    background: var(--surface);
}

.mobile-folder-navigation > h2 {
    margin: 0 0 9px;
    color: var(--muted);
    font-size: 0.68rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.mobile-folder-navigation .folder-tree {
    margin: 0;
}

.mobile-folder-navigation .folder-row,
.mobile-folder-navigation .feed-link {
    border-bottom: 1px solid var(--border);
}

.navigation-empty {
    padding: 44px 18px;
    color: var(--muted);
    text-align: center;
}

.navigation-empty h2 {
    margin-bottom: 7px;
    color: var(--text);
    font-size: 0.95rem;
}

.navigation-empty p,
.navigation-empty-inline {
    color: var(--muted);
    font-size: 0.78rem;
}

.navigation-empty-inline {
    margin: 8px 9px;
}

@media (max-width: 759px) {
    body.has-sidebar-open {
        overflow: hidden;
    }

    .sidebar.is-open {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 30;
        width: min(88vw, 320px);
        display: flex;
        flex-direction: column;
        border-right: 1px solid var(--border);
        background: var(--sidebar);
    }

    body.has-sidebar-open .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 29;
        display: block;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.58);
    }

    .sidebar .brand {
        height: calc(58px + env(safe-area-inset-top));
        display: flex;
        align-items: center;
        gap: 10px;
        padding: env(safe-area-inset-top) calc(14px + env(safe-area-inset-right)) 0 calc(14px + env(safe-area-inset-left));
        border-bottom: 1px solid var(--border);
        font-weight: 750;
    }

    .sidebar .brand-mark {
        width: 28px;
        height: 28px;
        border-radius: 6px;
        object-fit: cover;
    }

    .sidebar-close {
        width: 38px;
        height: 38px;
        display: grid;
        place-items: center;
        margin-left: auto;
        padding: 0;
        font-size: 1.35rem;
    }

    .sidebar .primary-nav {
        padding: 10px 12px 13px;
    }

    .sidebar .nav-item {
        min-height: 42px;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 0 10px;
        color: var(--muted);
        font-size: 0.86rem;
    }

    .sidebar .nav-item.is-active,
    .sidebar .nav-item:hover {
        background: var(--surface);
        color: var(--text);
    }

    .sidebar .folder-section {
        min-height: 0;
        flex: 1;
        padding: 4px 16px 16px;
        overflow-y: auto;
    }

    .sidebar .folder-section h2 {
        margin-bottom: 9px;
        color: var(--muted);
        font-size: 0.68rem;
        letter-spacing: 0.09em;
        text-transform: uppercase;
    }

    .sidebar .folder-placeholder {
        color: var(--muted);
        font-size: 0.78rem;
    }

    .folder-toggle,
    .folder-link,
    .feed-link {
        min-height: 44px;
    }

    .folder-row {
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .folder-toggle {
        min-width: 44px;
    }

    .feed-tree {
        padding-left: 44px;
    }

    .unfiled-feeds {
        padding-left: 44px;
    }

    .sidebar .user-menu {
        position: relative;
        margin: auto 12px 12px;
        border-top: 1px solid var(--border);
    }

    .sidebar .user-menu > summary {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 8px 0;
    }

    .sidebar .user-summary {
        min-width: 0;
        display: grid;
    }

    .sidebar .user-summary strong,
    .sidebar .user-summary small {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .sidebar .user-summary small {
        color: var(--muted);
        font-size: 0.7rem;
    }

    .sidebar .user-menu-panel {
        position: absolute;
        right: 0;
        bottom: 48px;
        left: 0;
        z-index: 2;
    }

    .list-header {
        align-items: flex-start;
    }

    .list-header-actions {
        flex-direction: column-reverse;
        align-items: flex-end;
        gap: 7px;
    }

    .bulk-read-form .secondary-button {
        min-height: 40px;
    }

    .queue-mode-toggle {
        min-height: 40px;
    }
}

@media (max-width: 1179px) {
    .preview-pane.has-story {
        position: fixed;
        top: calc(58px + env(safe-area-inset-top));
        right: 0;
        bottom: calc(64px + env(safe-area-inset-bottom));
        left: 0;
        z-index: 9;
        display: block;
        overflow-y: auto;
        background: var(--bg);
    }
}

@media (min-width: 760px) {
    .app-shell {
        display: grid;
        grid-template-columns: var(--sidebar-width) minmax(380px, 1fr);
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        overflow: hidden;
        padding-bottom: 0;
    }

    .sidebar {
        display: flex;
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        max-height: 100vh;
        max-height: 100dvh;
        flex-direction: column;
        overflow: hidden;
        border-right: 1px solid var(--border);
        background: var(--sidebar);
    }

    .mobile-header {
        display: none;
    }

    .brand {
        height: 76px;
        display: flex;
        align-items: center;
        gap: 11px;
        padding: 0 22px;
        border-bottom: 1px solid var(--border);
        font-size: 1.05rem;
        font-weight: 750;
        letter-spacing: -0.01em;
    }

    .brand-mark {
        width: 28px;
        height: 28px;
        display: grid;
        place-items: center;
        border-radius: 6px;
        object-fit: cover;
    }

    .primary-nav {
        padding: 14px 12px 18px;
    }

    .nav-item {
        display: flex;
        align-items: center;
        gap: 11px;
        min-height: 40px;
        padding: 0 11px;
        color: var(--muted);
        font-size: 0.9rem;
        font-weight: 600;
    }

    .nav-item:hover {
        background: var(--surface-hover);
        color: var(--text);
    }

    .nav-item.is-active {
        background: var(--surface);
        color: var(--text);
    }

    .nav-icon {
        color: var(--accent);
        font-size: 0.6rem;
    }

    .folder-section {
        min-height: 0;
        flex: 1 1 auto;
        padding: 0 22px;
        overflow-y: auto;
    }

    .folder-section h2 {
        margin-bottom: 10px;
        color: var(--muted);
        font-size: 0.7rem;
        letter-spacing: 0.09em;
        text-transform: uppercase;
    }

    .folder-placeholder {
        color: #707880;
        font-size: 0.79rem;
        line-height: 1.45;
    }

    .user-menu {
        position: relative;
        flex: 0 0 auto;
        margin: 0 12px 14px;
        border-top: 1px solid var(--border);
    }

    .user-menu > summary {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 14px 10px 0;
    }

    .user-summary {
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .user-summary strong,
    .user-summary small {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .user-summary strong {
        font-size: 0.82rem;
    }

    .user-summary small {
        color: var(--muted);
        font-size: 0.7rem;
    }

    .user-menu .user-menu-panel {
        position: absolute;
        right: 0;
        bottom: 48px;
        left: 0;
        z-index: 20;
    }

    .story-list {
        min-height: 100vh;
        min-height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        overflow-y: auto;
    }

    .management-page {
        min-height: 100vh;
        min-height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        overflow-y: auto;
    }

    .mobile-folders-page {
        min-height: 100vh;
        min-height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        overflow-y: auto;
    }

    .mobile-folder-navigation {
        width: min(100%, 720px);
        margin: 0 auto;
        padding: 28px;
    }

    .management-content {
        padding: 28px 28px 60px;
    }

    .user-create-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .user-create-form .primary-button {
        justify-self: start;
    }

    .management-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: end;
    }

    .management-form .wide-field {
        grid-column: 1 / -1;
    }

    .management-form .check-row {
        align-self: center;
    }

    .management-form > .primary-button,
    .management-form > .secondary-button {
        justify-self: start;
    }

    .folder-management-row {
        grid-template-columns: minmax(260px, 1fr) auto auto;
        align-items: center;
    }

    .feed-status-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .opml-summary,
    .result-grid,
    .refresh-detail-grid,
    .refresh-summary-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .empty-state {
        min-height: calc(100vh - 77px);
        min-height: calc(100dvh - 77px);
    }

    .bottom-nav {
        display: none;
    }
}

@media (min-width: 1180px) {
    .app-shell {
        grid-template-columns: var(--sidebar-width) minmax(420px, 1.15fr) var(--preview-width);
    }

    .preview-pane {
        display: block;
        min-height: 100vh;
        min-height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        overflow-y: auto;
        border-left: 1px solid var(--border);
        background: #131619;
    }

    .management-shell {
        grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    }

    .mobile-folders-shell {
        grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
    }

    .folder-toggle span,
    .feed-tree-wrapper {
        transition: none !important;
    }
}
