:root {
    --bg-body: #FFFFFF;
    --bg-panel: #FAFAFA;
    --bg-muted: #F8F5F0;
    --bg-hover: #F3F4F6;
    --bg-active: #EFF6FF;

    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-heading: #1e293b;

    --accent-orange: #EA580C;
    --accent-orange-text: #B45309;
    --accent-orange-light: #FFEDD5;
    --accent-green: #10B981;
    --accent-blue: #1E3A8A;

    --border-light: #E5E7EB;
    --border-medium: #D1D5DB;

    --font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, "Times New Roman", serif;
    --font-family-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.8125rem;
    --font-size-base: 0.875rem;
    --font-size-lg: 1rem;
    --font-size-xl: 1.375rem;

    --radius-sm: 4px;
    --radius-md: 6px;

    --scrollbar-thumb: #D1D5DB;
    --scrollbar-thumb-hover: #9CA3AF;
    --bg-btn-hover-warm: #FFF7ED;
    --shadow-overlay: rgba(15, 23, 42, 0.18);
    --shadow-toast: rgba(15, 23, 42, 0.2);
    --backdrop-overlay: rgba(15, 23, 42, 0.35);
    --text-on-dark: #FFFFFF;
    --error-bg: #991B1B;
    --danger-hover-bg: #FEF2F2;
    --danger-hover-text: #DC2626;
    --highlight-bg: #FDE68A;
    --highlight-bg-hover: #FCD34D;
    --highlight-text: #111827;
    --font-size-article: 0.9375rem;
    --font-size-article-h2: 1.125rem;
}

.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 100;
    background: var(--accent-blue);
    color: var(--text-on-dark);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    text-decoration: none;
}

.skip-link:focus {
    top: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
}

body {
    font-family: var(--font-family-ui);
    background-color: var(--bg-body);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    font-size: var(--font-size-base);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 10px;
}

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

.icon-rail {
    width: 48px;
    background-color: var(--bg-body);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    padding: 12px 0;
}

.icon-rail-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.icon-rail-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
}

.icon-rail-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-rail-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.icon-rail-btn.is-active {
    background-color: var(--accent-orange-light);
    color: var(--accent-orange-text);
}

.icon-rail-btn:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-btn[hidden] {
    display: none !important;
}

.icon-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.icon-btn.is-danger:hover,
.icon-btn.is-danger:focus-visible {
    background-color: var(--danger-hover-bg);
    color: var(--danger-hover-text);
}

.icon-btn.is-active {
    background-color: var(--accent-orange-light);
    color: var(--accent-orange-text);
}

.icon-btn:disabled,
.btn-outline:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.icon-btn:focus-visible,
.nav-item:focus-visible,
.btn-outline:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.article-item:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}



.nav-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 6px 12px;
    margin-bottom: 2px;
    border: none;
    border-radius: var(--radius-sm);
    background: none;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
    font: inherit;
    font-size: var(--font-size-sm);
    text-align: left;
}

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

.nav-item.active {
    background-color: var(--bg-panel);
    color: var(--accent-blue);
    font-weight: 500;
}

.nav-item-icon {
    width: 16px;
    height: 16px;
    margin-right: 12px;
    color: var(--text-secondary);
}

.nav-item.active .nav-item-icon {
    color: var(--accent-blue);
}

.nav-item-count {
    margin-left: auto;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.nav-item.active .nav-item-count {
    color: var(--accent-blue);
}

.article-list-panel {
    width: 0;
    min-width: 0;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
    transition: width 0.2s ease;
}

.article-list-panel.is-open {
    width: clamp(280px, 25vw, 360px);
}

.list-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    background-color: var(--bg-body);
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.list-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.list-title {
    font-weight: 500;
    color: var(--text-heading);
    font-size: var(--font-size-base);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.list-actions [hidden] {
    display: none !important;
}

.list-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    padding: 6px;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    background: var(--bg-body);
    box-shadow: 0 12px 30px var(--shadow-overlay);
    z-index: 20;
}

.list-menu-item {
    width: 100%;
    border: none;
    background: none;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.list-menu-item:hover,
.list-menu-item:focus-visible {
    background: var(--bg-hover);
    outline: none;
}

.list-menu-item.is-danger {
    color: var(--error-bg);
}

.list-menu-item:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.list-content {
    flex: 1;
    overflow-y: auto;
}

.today-sidebar {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    border-bottom: 1px solid var(--border-light);
    background: color-mix(in srgb, var(--bg-body) 72%, var(--bg-panel));
}

.today-calendar {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.today-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.today-calendar-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-heading);
    letter-spacing: -0.01em;
}

.today-calendar-nav {
    min-width: 32px;
    min-height: 32px;
    padding: 6px;
}

.today-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.today-calendar-weekday {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    text-align: center;
    padding-bottom: 4px;
}

.today-calendar-day {
    border: 1px solid var(--border-light);
    background: var(--bg-body);
    border-radius: 10px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: inherit;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.today-calendar-day:hover,
.today-calendar-day:focus-visible {
    background: var(--bg-hover);
    border-color: var(--border-medium);
    outline: none;
}

.today-calendar-day.is-selected {
    background: var(--bg-active);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    font-weight: 600;
}

.today-calendar-day.is-today {
    box-shadow: inset 0 0 0 1px var(--accent-orange);
}

.today-calendar-day.is-outside {
    visibility: hidden;
    pointer-events: none;
}

.today-calendar-day:disabled {
    cursor: not-allowed;
    opacity: 0.4;
    background: var(--bg-panel);
}

.article-item {
    display: block;
    width: 100%;
    padding: 16px 20px;
    border: none;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    background-color: transparent;
    position: relative;
    font: inherit;
    color: inherit;
    text-align: left;
}

.article-item:hover {
    background-color: var(--bg-body);
}

.article-item.active {
    background-color: var(--bg-active);
    border-left: 3px solid var(--accent-blue);
    padding-left: 17px;
}

.books-sidebar {
    padding: 18px 18px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.books-sidebar-copy {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 4px;
}

.books-sidebar-kicker,
.book-page-kicker,
.book-notes-kicker,
.books-empty-kicker {
    font-size: var(--font-size-xs);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-orange);
    font-weight: 700;
}

.books-sidebar-title {
    font-size: 1.2rem;
    color: var(--text-heading);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.books-sidebar-text,
.books-empty-text,
.book-page-blurb {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: var(--font-size-sm);
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.books-featured {
    border: 1px solid var(--border-light);
    background: linear-gradient(180deg, var(--bg-body), var(--bg-panel));
    border-radius: 18px;
    padding: 16px;
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    cursor: pointer;
    text-align: left;
}

.books-featured-copy {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.books-featured-label,
.books-section-label {
    font-size: var(--font-size-xs);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-orange-text);
    font-weight: 700;
}

.books-featured-title {
    color: var(--text-heading);
    font-family: var(--font-family);
    font-size: 1.15rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
    font-weight: 700;
}

.books-featured-author {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.books-featured-text {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

.book-card {
    border: none;
    background: none;
    padding: 0;
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.book-card:focus-visible {
    outline: none;
}

.book-card.is-active .book-cover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.18);
}

.book-cover,
.book-page-cover {
    position: relative;
    background: var(--book-accent);
    border-radius: 18px;
    color: #FEF7ED;
    border: 1px solid rgba(255,255,255,0.16);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
    overflow: hidden;
}

.book-cover::before,
.book-page-cover::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.18), transparent 38%),
        radial-gradient(circle at top right, rgba(255,255,255,0.16), transparent 34%);
    pointer-events: none;
}

.book-cover {
    min-height: 188px;
    padding: 14px 14px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.book-card:hover .book-cover,
.book-card:focus-visible .book-cover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.18);
}

.book-cover.is-image-cover,
.book-page-cover.is-image-cover {
    padding: 0;
}

.book-cover-tone {
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.82;
}

.book-cover-title {
    font-size: 1.05rem;
    line-height: 1.18;
    font-weight: 700;
    letter-spacing: -0.02em;
    max-width: 9ch;
    text-wrap: balance;
}

.book-cover-author {
    font-size: var(--font-size-xs);
    opacity: 0.92;
    line-height: 1.45;
}

.book-card-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 2px;
}

.book-card-title {
    color: var(--text-heading);
    font-size: var(--font-size-sm);
    font-weight: 600;
    line-height: 1.35;
}

.book-card-author {
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
}

.books-empty-state {
    min-height: 52vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.books-empty-copy {
    max-width: 32rem;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.books-empty-title,
.book-page-title {
    font-size: 2.1rem;
    line-height: 1.08;
    letter-spacing: -0.03em;
    color: var(--text-heading);
    font-family: var(--font-family);
}

.book-page {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.book-page-hero {
    display: grid;
    grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

.book-page-cover {
    min-height: 320px;
    padding: 22px 20px 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.book-page-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.book-page-author {
    color: var(--text-secondary);
    font-size: 1rem;
}

.book-page-progress {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.book-page-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.book-status-pill,
.book-local-pill {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 0.01em;
}

.book-status-pill {
    background: var(--bg-active);
    color: var(--accent-blue);
    border: 1px solid color-mix(in srgb, var(--accent-blue) 22%, var(--border-light));
}

.book-local-pill {
    background: var(--bg-panel);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

.book-sections-layout {
    display: grid;
    grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.book-sections-panel,
.book-notes-panel {
    border: 1px solid var(--border-light);
    border-radius: 18px;
    background: var(--bg-panel);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.book-sections-header,
.book-notes-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    background: color-mix(in srgb, var(--bg-body) 80%, var(--bg-panel));
}

.book-panel-title {
    font-size: 1.45rem;
    font-weight: 600;
    color: var(--text-heading);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.book-sections-list {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
}

.book-section-item {
    width: 100%;
    border: none;
    border-left: 3px solid transparent;
    background: none;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.book-section-item:hover,
.book-section-item:focus-visible {
    background: var(--bg-hover);
    outline: none;
}

.book-section-item.is-active {
    background: var(--bg-active);
    border-left-color: var(--accent-blue);
    padding-left: 15px;
}

.book-section-title {
    min-width: 0;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-weight: 600;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-section-title-edit-input {
    min-width: 0;
    width: 100%;
    border: 1px solid color-mix(in srgb, var(--accent-blue) 22%, var(--border-light));
    border-radius: 8px;
    background: var(--bg-body);
    color: var(--text-primary);
    font: inherit;
    font-size: var(--font-size-sm);
    font-weight: 600;
    line-height: 1.35;
    padding: 6px 8px;
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-blue) 10%, transparent);
}

.book-section-status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--border-light);
    background: var(--bg-body);
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    font-weight: 600;
    white-space: nowrap;
}

.book-section-status.is-done {
    background: var(--bg-active);
    border-color: color-mix(in srgb, var(--accent-blue) 22%, var(--border-light));
    color: var(--accent-blue);
}

.book-section-editor {
    min-width: 0;
}

.book-notes-panel {
    min-height: 560px;
}

.book-notes-chapter-title {
    min-width: 0;
    color: var(--text-heading);
    font-size: 1.45rem;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.book-notes-textarea {
    width: 100%;
    flex: 1;
    min-height: 320px;
    resize: vertical;
    border: none;
    border-top: 1px solid var(--border-light);
    border-radius: 0;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    line-height: 1.8;
    padding: 22px;
    outline: none;
    transition: background-color 0.2s ease;
}

.book-notes-textarea:focus {
    background: color-mix(in srgb, var(--bg-body) 88%, var(--bg-panel));
}

.item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.item-source {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.unread-dot {
    width: 6px;
    height: 6px;
    background-color: var(--accent-blue);
    border-radius: 50%;
    display: inline-block;
}

.item-time {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.item-title {
    font-size: var(--font-size-base);
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 4px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-item.is-unread .item-title {
    font-weight: 600;
    color: var(--text-primary);
}

.item-preview {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.reading-pane {
    flex: 1;
    background-color: var(--bg-body);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pane-shell {
    flex: 1;
    min-height: 0;
    display: flex;
    min-width: 0;
}

.pane-header {
    padding: 12px 32px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 60px;
    gap: 12px;
    flex-wrap: wrap;
}

.pane-actions-left,
.pane-actions-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.pane-actions-right .pane-separator {
    width: 1px;
    height: 20px;
    background: var(--border-light);
    margin: 0 8px;
}

.btn-outline {
    background-color: var(--bg-body);
    border: 1px solid var(--accent-orange-light);
    color: var(--accent-orange-text);
    padding: 6px 12px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-outline:hover {
    background-color: var(--bg-btn-hover-warm);
    border-color: var(--accent-orange-text);
}

.pane-content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 48px 32px;
    min-width: 0;
}

.article-container {
    max-width: 760px;
    margin: 0 auto;
}

.article-container.is-books-view {
    width: min(100%, 1220px);
    max-width: 1220px;
}

.article-layout {
    display: block;
}

.article-main {
    max-width: 680px;
}

.inspector-panel {
    width: 320px;
    flex-shrink: 0;
    border-left: 1px solid var(--border-light);
    background: var(--bg-panel);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

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

.inspector-panel-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: color-mix(in srgb, var(--bg-body) 80%, var(--bg-panel));
}

.inspector-panel-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-heading);
    letter-spacing: -0.01em;
}

.inspector-panel-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 18px;
}

.inspector-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.inspector-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-heading);
}

.inspector-empty {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.6;
}

.inspector-close-btn {
    min-width: 28px;
    min-height: 28px;
    padding: 4px;
}

.inspector-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.highlight-item {
    width: 100%;
    border: none;
    border-left: 3px solid var(--highlight-bg);
    border-radius: 0;
    background: none;
    padding: 6px 10px;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.highlight-item:hover,
.highlight-item:focus-visible {
    background: var(--bg-hover);
    outline: none;
}

.highlight-item.is-unresolved {
    opacity: 0.5;
    border-left-color: var(--border-medium);
}

.highlight-item-text {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    line-height: 1.5;
}

.highlight-item-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.highlight-jump-btn {
    flex: 1;
    border: none;
    background: none;
    padding: 0;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.highlight-remove-inline {
    min-width: 24px;
    min-height: 24px;
    padding: 2px;
    color: var(--text-secondary);
}

.highlight-remove-inline:hover,
.highlight-remove-inline:focus-visible {
    color: var(--danger-hover-text);
    background: var(--danger-hover-bg);
}

.article-hero {
    margin-bottom: 32px;
}

.article-hero figure {
    margin: 0;
}

.article-hero img,
.article-hero svg,
.article-hero video,
.article-hero canvas,
.article-hero iframe {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0;
    border-radius: 14px;
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    object-fit: cover;
}

.article-video-frame {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border-light);
    background: #000;
}

.article-video-frame iframe {
    width: 100%;
    height: 100%;
    border: 0;
    margin: 0;
    border-radius: 0;
    background: #000;
}

.article-hero figcaption {
    margin-top: 10px;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.article-header {
    margin-bottom: 40px;
}

.article-feed-name {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.feed-icon-small {
    width: 16px;
    height: 16px;
    border-radius: 2px;
}

.article-h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1.25;
    margin-bottom: 20px;
    letter-spacing: -0.01em;
}

.article-subtitle {
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: -8px 0 20px;
    max-width: 44rem;
}

.article-meta-row {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    padding: 12px 0;
}

.article-author {
    color: var(--text-primary);
    font-weight: 500;
}

.article-body {
    font-size: var(--font-size-article);
    line-height: 1.7;
    color: var(--text-primary);
    overflow-wrap: break-word;
}

.article-body p {
    margin-bottom: 20px;
}

.article-body ul,
.article-body ol {
    margin: 0 0 20px;
    padding-left: 1.5em;
    list-style-position: outside;
}

.article-body ul {
    list-style-type: disc;
}

.article-body ol {
    list-style-type: decimal;
}

.article-body li {
    margin-bottom: 8px;
}

.article-body li > ul,
.article-body li > ol {
    margin-top: 8px;
    margin-bottom: 8px;
}

.article-body h2 {
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--text-heading);
    margin: 48px 0 16px;
    letter-spacing: -0.01em;
}

.article-body a {
    color: var(--accent-orange-text);
    text-decoration: underline;
    text-decoration-color: var(--accent-orange-light);
    text-underline-offset: 2px;
}

.article-body a:hover {
    text-decoration-color: var(--accent-orange);
}

.transcript-timestamp {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border: 1px solid var(--border-light);
    border-radius: 999px;
    background: var(--bg-panel);
    color: var(--accent-blue);
    font: inherit;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    align-self: start;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.transcript-timestamp:hover,
.transcript-timestamp:focus-visible {
    background: var(--bg-active);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    outline: none;
}

.article-body p.transcript-line {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.transcript-line-text {
    min-width: 0;
}

.article-body blockquote {
    border-left: 3px solid var(--border-medium);
    padding-left: 16px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-style: italic;
}

.article-body figure {
    margin: 24px 0;
    max-width: 100%;
}

.article-body img,
.article-body svg,
.article-body video,
.article-body canvas {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 24px 0;
}

.article-body figure img,
.article-body figure svg,
.article-body figure video,
.article-body figure canvas {
    margin: 0;
}

.article-body iframe,
.article-body table,
.article-body pre {
    max-width: 100%;
}

.article-body pre,
.article-body table {
    overflow-x: auto;
}

.article-body pre {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
    white-space: pre-wrap;
}

.article-body table {
    display: block;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.article-body th,
.article-body td {
    border: 1px solid var(--border-light);
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
}

.article-highlight {
    background: var(--highlight-bg);
    color: var(--highlight-text);
    padding: 0 0.08em;
    border-radius: 0.18em;
    cursor: pointer;
}

.article-highlight:hover,
.article-highlight:focus-visible {
    background: var(--highlight-bg-hover);
    outline: none;
}

.digest-view {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.digest-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.digest-eyebrow {
    font-size: var(--font-size-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-orange);
}

.digest-eyebrow-button {
    border: none;
    background: none;
    padding: 0;
    width: fit-content;
    cursor: pointer;
}

.digest-eyebrow-button:hover,
.digest-eyebrow-button:focus-visible {
    text-decoration: underline;
    text-underline-offset: 3px;
    outline: none;
}

.digest-title {
    font-size: 2rem;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--text-heading);
}

.digest-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.digest-date-pill,
.digest-date-nav {
    border: none;
    background: none;
    padding: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.digest-date-pill:hover,
.digest-date-pill:focus-visible,
.digest-date-nav:hover,
.digest-date-nav:focus-visible {
    color: var(--text-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
    outline: none;
}

.digest-date-nav:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    text-decoration: none;
}

.digest-intro {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-primary);
    max-width: 48rem;
}

.digest-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
}

.digest-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.digest-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-heading);
}

.digest-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.digest-section-summary {
    color: var(--text-secondary);
    line-height: 1.65;
    max-width: 680px;
}

.digest-article-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 680px;
}

.digest-article-button {
    border: 1px solid var(--border-light);
    background: var(--bg-panel);
    border-radius: 12px;
    padding: 14px 16px;
    text-align: left;
    cursor: pointer;
    width: 100%;
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.digest-article-button:hover,
.digest-article-button:focus-visible {
    border-color: var(--border-medium);
    background: var(--bg-body);
    transform: translateY(-1px);
    outline: none;
}

.digest-article-meta {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.digest-article-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.45;
}

.digest-article-subtitle,
.digest-article-preview {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.55;
}

.digest-state {
    max-width: 40rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.inline-link {
    color: var(--accent-orange-text);
    text-decoration: none;
    font-size: var(--font-size-sm);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.inline-link svg {
    width: 12px;
    height: 12px;
}

.empty-state {
    padding: 20px;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

.list-status {
    padding: 16px 20px 24px;
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    text-align: center;
}

.article-loading-state {
    padding: 20px;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.feed-dialog {
    border: none;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 20px 50px var(--shadow-overlay);
    max-width: 440px;
    width: calc(100% - 32px);
    margin: auto;
    background: var(--bg-body);
    color: var(--text-primary);
}

.feed-dialog::backdrop {
    background: var(--backdrop-overlay);
}

.feed-dialog-card {
    background: var(--bg-body);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.newsletter-card {
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid var(--border-medium);
    background: var(--bg-muted);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.newsletter-kicker {
    font-size: var(--font-size-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-blue);
}

.newsletter-meta {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.newsletter-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.settings-dialog-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.theme-mode-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dialog-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-heading);
}

.dialog-copy {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.text-input {
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    font: inherit;
    color: var(--text-primary);
    background: var(--bg-body);
    width: 100%;
}

.text-input::placeholder {
    color: var(--text-secondary);
    opacity: 1;
}

select.text-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.text-input:focus {
    outline: 2px solid rgba(30, 58, 138, 0.12);
    border-color: var(--accent-blue);
}

textarea.text-input {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

.book-dialog-preview {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.book-dialog-preview-frame {
    max-width: 220px;
    border-radius: 18px;
    overflow: hidden;
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
}

.book-dialog-preview-frame .book-page-cover,
.book-dialog-preview-frame .book-cover {
    min-height: 280px;
}

.book-cover-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-page-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-secondary {
    background: var(--bg-body);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    cursor: pointer;
    font: inherit;
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
    background: var(--bg-hover);
    border-color: var(--border-medium);
    outline: none;
}

.btn-secondary.is-active {
    background: var(--bg-active);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.btn-primary {
    background: var(--accent-blue);
    color: var(--text-on-dark);
    border: 1px solid var(--accent-blue);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    cursor: pointer;
    font: inherit;
}

.btn-primary:hover,
.btn-primary:focus-visible {
    filter: brightness(1.05);
    outline: none;
}

.btn-danger {
    background: var(--error-bg);
    color: var(--text-on-dark);
    border: 1px solid var(--error-bg);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    cursor: pointer;
    font: inherit;
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    background: var(--text-heading);
    color: var(--text-on-dark);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: var(--font-size-sm);
    box-shadow: 0 12px 30px var(--shadow-toast);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast.is-error {
    background: var(--error-bg);
}

[data-theme="dark"] {
        --bg-body: #111827;
        --bg-panel: #1F2937;
        --bg-muted: #1B2430;
        --bg-hover: #374151;
        --bg-active: #1E3A5F;

        --text-primary: #F3F4F6;
        --text-secondary: #9CA3AF;
        --text-heading: #F9FAFB;

        --accent-orange: #FB923C;
        --accent-orange-text: #FDBA74;
        --accent-orange-light: #431407;
        --accent-green: #34D399;
        --accent-blue: #60A5FA;

        --border-light: #374151;
        --border-medium: #4B5563;

        --scrollbar-thumb: #4B5563;
        --scrollbar-thumb-hover: #6B7280;
        --bg-btn-hover-warm: #431407;
        --shadow-overlay: rgba(0, 0, 0, 0.4);
        --shadow-toast: rgba(0, 0, 0, 0.5);
        --backdrop-overlay: rgba(0, 0, 0, 0.5);
        --text-on-dark: #F9FAFB;
        --error-bg: #DC2626;
        --danger-hover-bg: #451A1A;
        --danger-hover-text: #FCA5A5;
        --highlight-bg: #F59E0B;
        --highlight-bg-hover: #FBBF24;
        --highlight-text: #111827;
}

[data-theme="dark"] .feed-dialog,
[data-theme="dark"] .feed-dialog-card {
    background: var(--bg-panel);
    color: var(--text-primary);
}

[data-theme="dark"] .text-input {
    background: var(--bg-body);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

[data-theme="dark"] .book-dialog-preview-frame {
    background: var(--bg-body);
    border-color: var(--border-medium);
}

.shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shortcut-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.shortcut-row kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    padding: 2px 8px;
    background: var(--bg-panel);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

@media (pointer: coarse) {
    .icon-btn {
        min-width: 44px;
        min-height: 44px;
    }
}

@media (max-width: 960px) {
    .books-featured {
        grid-template-columns: 1fr;
    }

    .books-grid {
        grid-template-columns: 1fr;
    }

    .book-page-hero {
        grid-template-columns: 1fr;
    }

    .book-page-cover {
        min-height: 240px;
    }

    .book-sections-layout {
        grid-template-columns: 1fr;
    }

    .pane-header,
    .pane-content-scroll {
        padding-left: 20px;
        padding-right: 20px;
    }

    .pane-content-scroll {
        padding-top: 24px;
        padding-bottom: 24px;
    }

    .pane-shell {
        flex-direction: column;
    }

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

    .inspector-panel {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-light);
    }
}

@media (max-width: 640px) {
    .article-list-panel {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 48px;
        z-index: 30;
        box-shadow: 0 18px 40px var(--shadow-overlay);
    }

    .article-list-panel.is-open {
        width: min(320px, calc(100vw - 48px));
    }

    .book-page {
        gap: 20px;
    }

    .book-page-title {
        font-size: 1.7rem;
    }

    .book-notes-header {
        padding: 14px 16px;
        flex-direction: column;
        align-items: stretch;
    }

    .book-notes-textarea {
        padding: 18px 16px;
        min-height: 280px;
    }

    .book-notes-chapter-title {
        font-size: 1.2rem;
    }

    .book-panel-title {
        font-size: 1.2rem;
    }
}
