/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

button {
    color: inherit;
}

:root {
    --color-bg: #111827;
    --color-surface: #1f2937;
    --color-text: #f9fafb;
    --color-text-muted: #9ca3af;
    --color-primary: #3b82f6;
    --color-primary-hover: #60a5fa;
    --color-success: #34d399;
    --color-success-bg: #064e3b;
    --color-error: #f87171;
    --color-error-bg: #7f1d1d;
    --color-border: #374151;
    --color-border-focus: #60a5fa;
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-serif: Georgia, "Times New Roman", serif;
    --font-mono: "SF Mono", Monaco, "Cascadia Code", monospace;
    --radius: 6px;
    --color-code-bg: #374151;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
    --color-bg: #fafafa;
    --color-surface: #ffffff;
    --color-text: #1a1a1a;
    --color-text-muted: #6b7280;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-success: #059669;
    --color-success-bg: #ecfdf5;
    --color-error: #dc2626;
    --color-error-bg: #fef2f2;
    --color-border: #e5e7eb;
    --color-border-focus: #93c5fd;
    --color-code-bg: #f3f4f6;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

html {
    font-size: 16px;
    line-height: 1.6;
}

body {
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Navbar */
.navbar {
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(55, 65, 81, 0.5);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 0 2rem;
}

[data-theme="light"] .navbar {
    background: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid var(--color-border);
}

.has-tab-bar {
    padding-top: 3.125rem;
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 950px;
    margin: 0 auto;
    padding: 0.75rem 0;
    width: 100%;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.02em;
}

.navbar-brand:hover {
    text-decoration: none;
    color: var(--color-primary);
}

.navbar-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.navbar-divider {
    display: inline-block;
    width: 1px;
    height: 1.25rem;
    background: var(--color-border);
    margin: 0 0.5rem;
}

.navbar-links a {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.navbar-links a:hover {
    color: var(--color-text);
    text-decoration: none;
}

.nav-link {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
}

.nav-link:hover {
    color: var(--color-text);
    background: rgba(59, 130, 246, 0.12);
    text-decoration: none;
}

[data-theme="light"] .nav-link:hover {
    background: rgba(37, 99, 235, 0.08);
}

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

.link-button {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}

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

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    color: var(--color-text-muted);
    transition: color 0.15s, background-color 0.15s;
}

.nav-icon:hover {
    color: var(--color-text);
    text-decoration: none;
    background: rgba(59, 130, 246, 0.12);
}

[data-theme="light"] .nav-icon:hover {
    background: rgba(37, 99, 235, 0.08);
}

.nav-icon.nav-icon-active {
    color: var(--color-primary);
}

.nav-icon.nav-icon-active:hover {
    color: var(--color-primary-hover);
    background: rgba(59, 130, 246, 0.12);
}

[data-theme="light"] .nav-icon.nav-icon-active:hover {
    background: rgba(37, 99, 235, 0.08);
}

.nav-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
    transition: color 0.15s, background-color 0.15s;
}

.nav-icon-button:hover {
    color: var(--color-text);
    background: rgba(59, 130, 246, 0.12);
}

[data-theme="light"] .nav-icon-button:hover {
    background: rgba(37, 99, 235, 0.08);
}

/* ---------- Sticky Header Inline Actions ---------- */
.sticky-article-header-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.sticky-header-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    border-radius: var(--radius);
    color: var(--color-text-muted);
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s, background-color 0.15s;
}

.sticky-header-action:hover {
    color: var(--color-primary);
    background: rgba(59, 130, 246, 0.12);
    text-decoration: none;
}

[data-theme="light"] .sticky-header-action:hover {
    background: rgba(37, 99, 235, 0.08);
}

.sticky-header-action-danger:hover {
    color: var(--color-error);
    background: rgba(248, 113, 113, 0.12);
}

[data-theme="light"] .sticky-header-action-danger:hover {
    background: rgba(220, 38, 38, 0.08);
}

/* ---------- Article Header Inline Actions ---------- */
.article-header-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.article-header-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    border-radius: var(--radius);
    color: var(--color-text-muted);
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s, background-color 0.15s;
}

.article-header-action:hover {
    color: var(--color-primary);
    background: rgba(59, 130, 246, 0.12);
    text-decoration: none;
}

[data-theme="light"] .article-header-action:hover {
    background: rgba(37, 99, 235, 0.08);
}

.article-header-action-danger:hover {
    color: var(--color-error);
    background: rgba(248, 113, 113, 0.12);
}

[data-theme="light"] .article-header-action-danger:hover {
    background: rgba(220, 38, 38, 0.08);
}

/* Container */
.container {
    max-width: 950px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
    width: 100%;
}

/* Footer */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--color-border);
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.alert-success {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid #065f46;
}

.alert-error {
    background: var(--color-error-bg);
    color: var(--color-error);
    border: 1px solid #991b1b;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: var(--color-text);
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: inherit;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-control.input-validation-error {
    border-color: var(--color-error);
}

.field-validation-error {
    display: block;
    color: var(--color-error);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.validation-summary-errors ul {
    list-style: none;
    color: var(--color-error);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.5;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
    text-decoration: none;
    box-sizing: border-box;
    margin: 0;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
}

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

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

.btn-secondary:hover {
    background: #374151;
}

.btn-danger {
    background: var(--color-error);
    color: #fff;
}

.btn-danger:hover {
    background: #991b1b;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@keyframes btn-spinner {
    to { transform: rotate(360deg); }
}

.btn-loading {
    pointer-events: none;
    opacity: 0.6;
}

.btn-loading::before {
    content: "";
    display: inline-block;
    width: 0.8em;
    height: 0.8em;
    margin-right: 0.4em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btn-spinner 0.6s linear infinite;
    vertical-align: middle;
}

/* Auth pages */
.auth-container {
    max-width: 400px;
    margin: 3rem auto;
}

.auth-container h1 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.auth-footer {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

/* Page headers */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Article list / table */
.article-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.article-table th,
.article-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.875rem;
    white-space: nowrap;
}

.article-table th {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.article-table tbody tr {
    cursor: pointer;
    transition: background 0.1s;
}

.article-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.08);
}

.article-table .article-checkbox {
    width: 2rem;
    text-align: center;
    vertical-align: top;
    padding-top: 0.5rem;
}

.article-table .article-domain,
.article-table .article-date,
.article-table .article-status {
    vertical-align: top;
}

.article-table .article-title-cell {
    overflow: hidden;
    text-overflow: ellipsis;
}

.article-table .article-title {
    font-weight: 600;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.article-table .article-domain {
    color: var(--color-text-muted);
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 10rem;
}

.article-table .article-date {
    color: var(--color-text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
    width: 7rem;
}

.article-table .article-status {
    width: 5rem;
    white-space: nowrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-icon {
    flex-shrink: 0;
    vertical-align: middle;
}

.badge-sent .badge-text {
    display: none;
}

.badge-sent {
    background: none;
    color: var(--color-success);
    padding: 0;
}

.badge-unsent {
    display: none;
}

.badge-read {
    background: #1e3a5f;
    color: #93c5fd;
}

.badge-archived {
    background: #451a03;
    color: #fcd34d;
}

/* Tag pills */
.article-tags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.tag-pill {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
    transition: opacity 0.15s;
}

.tag-pill:hover {
    opacity: 0.8;
    text-decoration: none;
    color: #fff;
}

/* Tag filter bar */
.tag-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}

.tag-filter-label {
    color: var(--color-text-muted);
    font-weight: 500;
}

.tag-filter-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 0.25rem;
}

.tag-filter-clear:hover {
    color: var(--color-error);
    text-decoration: none;
}

/* Article metadata container — consistent row heights */
.article-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.25rem;
    min-height: 1.25rem;
    align-items: center;
}

/* Custom filter dropdown */
.filter-dropdown {
    position: relative;
    display: inline-block;
}

.filter-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    font-family: inherit;
    white-space: nowrap;
}

.filter-dropdown-btn:hover {
    border-color: var(--color-text-muted);
    color: var(--color-text);
}

.filter-dropdown-btn svg {
    flex-shrink: 0;
    transition: transform 0.15s;
}

.filter-dropdown.open .filter-dropdown-btn svg {
    transform: rotate(180deg);
}

.filter-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 180px;
    max-height: 240px;
    overflow-y: auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    z-index: 100;
    padding: 0.25rem 0;
    scrollbar-width: thin;
}

[data-theme="light"] .filter-dropdown-menu {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.filter-dropdown.open .filter-dropdown-menu {
    display: block;
}

.filter-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.4rem 0.75rem;
    border: none;
    background: none;
    color: var(--color-text);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s;
    white-space: nowrap;
}

.filter-dropdown-item:hover {
    background: rgba(59, 130, 246, 0.1);
}

[data-theme="light"] .filter-dropdown-item:hover {
    background: rgba(37, 99, 235, 0.06);
}

.filter-dropdown-item-color {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.filter-dropdown-item-count {
    margin-left: auto;
    color: var(--color-text-muted);
    font-size: 0.7rem;
}

/* Active filter bar highlight */
.tag-filter-bar.has-active-filter {
    background: rgba(59, 130, 246, 0.06);
    border-left: 3px solid var(--color-primary);
    padding: 0.4rem 0.5rem 0.4rem 0.75rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-left: -0.25rem;
}

[data-theme="light"] .tag-filter-bar.has-active-filter {
    background: rgba(37, 99, 235, 0.04);
}

.filter-clear-all {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-decoration: none;
    margin-left: 0.25rem;
}

.filter-clear-all:hover {
    color: var(--color-error);
    text-decoration: none;
}

.tag-filter-select {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: 0.375rem;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 0.8rem;
    cursor: pointer;
}

.collection-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 600;
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-text-muted);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
    transition: opacity 0.15s;
}

.collection-pill:hover {
    opacity: 0.8;
    text-decoration: none;
    color: var(--color-text);
    border-color: var(--color-text);
}

.collection-pill-icon {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.form-group-divider {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    margin: 0.5rem 0;
}

/* Collections page */
.collections-heading {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.collection-create-form {
    margin-bottom: 1.5rem;
}

.collection-create-row,
.collection-edit-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.collection-create-row .form-control,
.collection-edit-row .form-control {
    flex: 1;
    min-width: 150px;
}

.collections-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.collection-card {
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
}

.collection-card-view {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.collection-card-info {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
    min-width: 0;
}

.collection-card-name {
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
}

.collection-card-name:hover {
    color: var(--color-primary, #3b82f6);
}

.collection-card-count {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.collection-card-desc {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.collection-card-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

/* Search bar */
.search-bar {
    margin-bottom: 0.75rem;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 0;
    position: relative;
}

.search-input {
    flex: 1;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--color-border);
    border-radius: 6px 0 0 6px;
    background: var(--color-bg);
    color: var(--color-text);
    outline: none;
    transition: border-color 0.15s;
    min-height: 38px;
}

.search-input:focus {
    border-color: var(--color-primary);
}

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

.search-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-left: none;
    border-radius: 0 6px 6px 0;
    background: var(--color-surface);
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    min-height: 38px;
    transition: color 0.15s, background 0.15s;
}

.search-btn:hover {
    color: var(--color-text);
    background: var(--color-border);
}

.search-clear {
    position: absolute;
    right: 44px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0.25rem;
}

.search-clear:hover {
    color: var(--color-text);
}

/* Filter tabs */
.filter-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0;
}

.filter-tab {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}

.filter-tab:hover {
    color: var(--color-text);
    text-decoration: none;
}

.filter-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* Read article row style */
.article-read .article-title {
    font-weight: 400;
    color: var(--color-text-muted);
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 1.5rem;
    list-style: none;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    font-size: 0.8rem;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    text-decoration: none;
}

.pagination a:hover {
    background: #374151;
    text-decoration: none;
}

.pagination .active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.pagination .disabled {
    color: var(--color-text-muted);
    opacity: 0.5;
    pointer-events: none;
}

/* Article view */
.article-view-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.article-view-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

/* Article view — organize (tags & collections) */
.article-organize {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0;
    border-top: 1px solid var(--color-border);
}

.article-organize-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px dashed var(--color-text-muted);
    border-radius: 50%;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    flex-shrink: 0;
}

.article-organize-add-btn:hover {
    border-style: solid;
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: rgba(59, 130, 246, 0.1);
}

[data-theme="light"] .article-organize-add-btn:hover {
    background: rgba(37, 99, 235, 0.06);
}

/* Organize bottom sheet extras */
.organize-sheet-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.organize-sheet-tag-btn,
.organize-sheet-collection-btn {
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
}

.organize-sheet-tag-btn:hover,
.organize-sheet-collection-btn:hover {
    opacity: 0.85;
    transform: scale(1.05);
}

.organize-sheet-create-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.organize-sheet-create-row .form-control {
    flex: 1;
    min-width: 0;
}

.organize-sheet-color-input {
    width: 2.5rem;
    height: 2.25rem;
    padding: 0.15rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    cursor: pointer;
    flex-shrink: 0;
}

.article-view-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.125rem;
}

.tag-remove-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0 0.15rem;
    line-height: 1;
    opacity: 0.6;
}

.tag-remove-btn:hover {
    opacity: 1;
    color: var(--color-error);
}

.article-view-collection {
    display: inline-flex;
    align-items: center;
    gap: 0.125rem;
}

.article-view-collection .collection-pill {
    font-size: 0.7rem;
    padding: 0.1rem 0.45rem;
}

.article-content {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    line-height: 1.8;
    max-width: 720px;
}

.article-content p {
    margin-bottom: 1.25rem;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 1rem 0;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
    font-family: var(--font-sans);
    margin: 1.5rem 0 0.75rem;
    line-height: 1.3;
}

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

.article-content pre {
    background: var(--color-code-bg);
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    margin: 1rem 0;
}

.article-content code {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    background: var(--color-code-bg);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
}

.article-content a {
    color: var(--color-primary);
}

.article-content a.btn {
    color: inherit;
}

.article-content a.btn-primary {
    color: #fff;
}

.article-content ul,
.article-content ol {
    padding-left: 1.5rem;
    margin-bottom: 1.25rem;
}

.article-content li {
    margin-bottom: 0.375rem;
}

.article-content li:last-child {
    margin-bottom: 0;
}

/* ---------- Highlights ---------- */
mark.user-highlight {
    background-color: rgba(202, 138, 4, 0.35);
    border-radius: 2px;
    padding: 0 1px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

mark.user-highlight:hover,
mark.user-highlight.user-highlight-hover {
    background-color: rgba(202, 138, 4, 0.55);
}

[data-theme="light"] mark.user-highlight {
    background-color: rgba(250, 204, 21, 0.4);
}

[data-theme="light"] mark.user-highlight:hover,
[data-theme="light"] mark.user-highlight.user-highlight-hover {
    background-color: rgba(250, 204, 21, 0.6);
}

.highlight-toolbar {
    position: absolute;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    white-space: nowrap;
}

.highlight-toolbar button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
    color: var(--color-text);
    transition: background-color 0.15s ease;
}

.highlight-toolbar button:hover {
    background: var(--color-hover);
}

.highlight-toolbar button.highlight-btn-highlight {
    color: #fbbf24;
}

[data-theme="light"] .highlight-toolbar button.highlight-btn-highlight {
    color: #92400e;
}

.highlight-toolbar button.highlight-btn-remove {
    color: #dc2626;
}

/* ---------- Highlights Dashboard List ---------- */
.highlights-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.highlight-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.highlight-group-title {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid var(--color-border);
}

.highlight-group-title:hover {
    color: var(--color-primary);
}

.highlight-group-chevron {
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.25rem;
    opacity: 0.4;
    transition: opacity 0.15s ease;
}

.highlight-group-title:hover .highlight-group-chevron {
    opacity: 0.8;
}

.highlight-card {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    padding: 0.5rem 0.75rem;
    border-left: 3px solid rgba(202, 138, 4, 0.5);
    background: var(--color-surface);
    border-radius: 0 6px 6px 0;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s ease;
}

.highlight-card:hover {
    background: var(--color-hover);
    text-decoration: none;
    color: inherit;
}

[data-theme="light"] .highlight-card {
    border-left-color: rgba(250, 204, 21, 0.6);
}

.highlight-card-text {
    flex: 1;
    margin: 0;
    padding: 0;
    border: none;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--color-text);
}

.highlight-card-date {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.empty-state-icon {
    color: var(--color-text-muted);
    opacity: 0.5;
    margin-bottom: 0.75rem;
}

/* Help overlay */
.help-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 0.25s ease;
}

.help-overlay.open .help-overlay-backdrop {
    background: rgba(0, 0, 0, 0.5);
}

.help-overlay-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 680px;
    max-height: calc(100vh - 4rem);
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(40px);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
    margin: 2rem;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.help-overlay.open .help-overlay-panel {
    transform: translateY(0);
    opacity: 1;
}

.help-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem 0.75rem;
    flex-shrink: 0;
}

.help-overlay-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.help-overlay-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: var(--radius);
    transition: background 0.15s, color 0.15s;
}

.help-overlay-close:hover {
    background: var(--color-border);
    color: var(--color-text);
}

/* Help navigation tabs */
.help-overlay-nav {
    display: flex;
    gap: 0;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.help-overlay-nav::-webkit-scrollbar {
    display: none;
}

.help-nav-tab {
    padding: 0.625rem 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
    font-family: inherit;
    margin-bottom: -1px;
}

.help-nav-tab:hover {
    color: var(--color-text);
}

.help-nav-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* Help content area */
.help-overlay-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}

.help-overlay-content::-webkit-scrollbar {
    width: 6px;
}

.help-overlay-content::-webkit-scrollbar-track {
    background: transparent;
}

.help-overlay-content::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

.help-overlay-content::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

.help-section {
    display: none;
}

.help-section.active {
    display: block;
}

.help-section-intro {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* Tier labels */
.help-tier {
    text-align: center;
    margin-bottom: 0.5rem;
}

.help-tier-label {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

.help-tier-epic {
    background: #7c3aed;
    color: #fff;
}

.help-tier-great {
    background: #2563eb;
    color: #fff;
}

.help-tier-good {
    background: #64748b;
    color: #fff;
}

/* Help cards */
.help-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.help-card:hover {
    border-color: var(--color-border-focus);
}

.help-card.help-card-epic {
    border-color: #7c3aed;
    border-width: 2px;
    box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.1);
}

.help-card.help-card-epic:hover {
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.help-card.help-card-great {
    border-color: #2563eb;
    border-width: 2px;
}

.help-card.help-card-great:hover {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.help-card.help-card-good {
    border-color: #64748b;
}

.help-card-dimmed {
    opacity: 0.55;
}

.help-badge-beta {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: #f59e0b;
    color: #fff;
    margin-left: 0.5rem;
    vertical-align: middle;
    line-height: 1.4;
}

.help-card h2 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.625rem;
    display: flex;
    align-items: center;
}

.help-card h2 .help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius);
    margin-right: 0.6rem;
    flex-shrink: 0;
}

.help-card-epic h2 .help-icon {
    background: rgba(124, 58, 237, 0.1);
    color: #7c3aed;
}

.help-card-great h2 .help-icon {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
}

.help-card-good h2 .help-icon {
    background: rgba(100, 116, 139, 0.1);
    color: #64748b;
}

.help-icon-blue {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
}

.help-icon-green {
    background: rgba(5, 150, 105, 0.1);
    color: #059669;
}

.help-icon-purple {
    background: rgba(124, 58, 237, 0.1);
    color: #7c3aed;
}

.help-card-epic h2 .help-icon {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}

.help-card-great h2 .help-icon {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.help-card-good h2 .help-icon {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

.help-icon-blue {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.help-icon-green {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
}

.help-icon-purple {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}

.help-overlay.open .help-overlay-backdrop {
    background: rgba(0, 0, 0, 0.7);
}

.help-overlay-panel {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

[data-theme="light"] .help-card-epic h2 .help-icon {
    background: rgba(124, 58, 237, 0.1);
    color: #7c3aed;
}

[data-theme="light"] .help-card-great h2 .help-icon {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
}

[data-theme="light"] .help-card-good h2 .help-icon {
    background: rgba(100, 116, 139, 0.1);
    color: #64748b;
}

[data-theme="light"] .help-icon-blue {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
}

[data-theme="light"] .help-icon-green {
    background: rgba(5, 150, 105, 0.1);
    color: #059669;
}

[data-theme="light"] .help-icon-purple {
    background: rgba(124, 58, 237, 0.1);
    color: #7c3aed;
}

[data-theme="light"] .help-overlay.open .help-overlay-backdrop {
    background: rgba(0, 0, 0, 0.5);
}

[data-theme="light"] .help-overlay-panel {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.help-card p {
    font-size: 0.85rem;
    line-height: 1.7;
    margin-bottom: 0.625rem;
    color: var(--color-text);
}

.help-card p:last-child {
    margin-bottom: 0;
}

.help-card p em {
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

.help-card ul,
.help-card ol {
    padding-left: 1.25rem;
    margin-bottom: 0.625rem;
    font-size: 0.85rem;
    line-height: 1.7;
}

.help-card li {
    margin-bottom: 0.2rem;
}

.help-card li:last-child {
    margin-bottom: 0;
}

.bookmarklet-drag-area {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--color-bg);
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 0.75rem 1.25rem;
    margin: 0.5rem 0;
}

.bookmarklet-drag-area .btn {
    cursor: grab;
    pointer-events: auto;
}

.bookmarklet-drag-hint {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Settings */
.settings-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.settings-section h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

.settings-description {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

/* Checkbox / Toggle */
input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-muted);
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.list-end-message {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.list-end-check {
    display: inline-block;
    margin-right: 0.375rem;
    color: var(--color-primary);
}

/* Light mode overrides for hardcoded colors */
[data-theme="light"] .btn-secondary:hover {
    background: #f3f4f6;
}

[data-theme="light"] .btn-danger:hover {
    background: #b91c1c;
}

[data-theme="light"] .article-table tbody tr:hover {
    background: rgba(37, 99, 235, 0.04);
}

[data-theme="light"] .badge-read {
    background: #dbeafe;
    color: #1d4ed8;
}

[data-theme="light"] .badge-archived {
    background: #fef3c7;
    color: #92400e;
}

[data-theme="light"] .pagination a:hover {
    background: #f3f4f6;
}

[data-theme="light"] .alert-success {
    border-color: #a7f3d0;
}

[data-theme="light"] .alert-error {
    border-color: #fecaca;
}

[data-theme="light"] .form-control:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Select inputs - larger, more modern feel */
select.form-control {
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    cursor: pointer;
}

/* Add URL notice (used in bottom sheet) */
.add-url-notice {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    background: #374151;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    margin-bottom: 1rem;
}

[data-theme="light"] .add-url-notice {
    background: #f3f4f6;
}

.settings-back-link {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

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

/* Settings tabs */
.settings-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 1.5rem;
    padding-bottom: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.settings-tab {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
    font-family: inherit;
    margin-bottom: -1px;
}

.settings-tab:hover {
    color: var(--color-text);
}

.settings-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.settings-tab-panel {
    display: none;
}

.settings-tab-panel.active {
    display: block;
}

.help-arrow {
    text-align: center;
    margin: 0.5rem 0;
    color: var(--color-text-muted);
}

.settings-card-disabled {
    opacity: 0.55;
    pointer-events: none;
}

.settings-card-disabled .help-card:hover {
    border-color: #7c3aed;
}

/* PWA install banner */
.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 3000;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.1);
    padding: 0.75rem 1rem;
    display: none;
    align-items: center;
    gap: 0.75rem;
}

.pwa-install-banner.visible {
    display: flex;
}

.pwa-install-banner-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    flex-shrink: 0;
}

.pwa-install-banner-text {
    flex: 1;
    min-width: 0;
}

.pwa-install-banner-title {
    font-size: 0.875rem;
    font-weight: 600;
}

.pwa-install-banner-subtitle {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.pwa-install-banner-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.pwa-install-dismiss {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0.25rem;
    display: inline-flex;
    align-items: center;
}

.pwa-install-dismiss:hover {
    color: var(--color-text);
}

.pwa-install-banner {
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .pwa-install-banner {
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.1);
}

/* ---------- Batch Action Toolbar ---------- */
.batch-toolbar {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
    animation: batchToolbarSlideUp 0.2s ease-out;
    max-width: calc(100vw - 2rem);
}

[data-theme="light"] .batch-toolbar {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
}

@keyframes batchToolbarSlideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.batch-toolbar-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-primary);
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0 0.25rem;
}

.batch-toolbar-divider {
    width: 1px;
    height: 1.25rem;
    background: var(--color-border);
    flex-shrink: 0;
    margin: 0 0.25rem;
}

.batch-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    overflow-x: auto;
}

.batch-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.625rem;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--color-text);
    background: none;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background-color 0.15s, color 0.15s;
}

.batch-toolbar-btn:hover {
    background: rgba(59, 130, 246, 0.12);
    color: var(--color-primary);
}

[data-theme="light"] .batch-toolbar-btn:hover {
    background: rgba(37, 99, 235, 0.08);
}

.batch-toolbar-btn svg {
    flex-shrink: 0;
}

.batch-toolbar-btn-danger:hover {
    background: rgba(248, 113, 113, 0.12);
    color: var(--color-error);
}

[data-theme="light"] .batch-toolbar-btn-danger:hover {
    background: rgba(220, 38, 38, 0.08);
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        padding: 0 1rem;
    }

    .navbar-links {
        gap: 0.125rem;
    }

    .nav-icon,
    .nav-icon-button {
        min-width: 44px;
        min-height: 44px;
    }

    .navbar-divider {
        margin: 0 0.25rem;
    }

    .container {
        padding: 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-input {
        min-height: 44px;
        font-size: 1rem;
    }

    .search-btn {
        min-height: 44px;
        padding: 0.5rem 1rem;
    }

    .search-clear {
        right: 50px;
    }

    input[type="checkbox"] {
        min-width: 20px;
        min-height: 20px;
    }

    .btn-sm {
        min-height: 44px;
        padding: 0.5rem 0.75rem;
    }

    .pagination a,
    .pagination span {
        min-width: 44px;
        height: 44px;
    }

    .help-overlay-close {
        width: 44px;
        height: 44px;
    }

    .pwa-install-dismiss {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .filter-tab,
    .settings-tab,
    .help-nav-tab {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Card-based article layout for mobile */
    .article-table,
    .article-table tbody {
        display: block;
    }

    .article-table thead {
        display: none;
    }

    .article-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        padding: 0.625rem 0;
        border-bottom: 1px solid var(--color-border);
    }

    .article-table tbody tr:hover {
        background: transparent;
    }

    .article-table tbody td {
        border-bottom: none;
        padding: 0;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    /* Checkbox - hidden on touch devices (long-press enters select mode) */
    .article-table tbody td.article-checkbox {
        display: none;
        padding-right: 0.5rem;
        padding-top: 0.125rem;
        align-self: flex-start;
        width: auto;
    }

    .article-table tbody td.article-checkbox input[type="checkbox"] {
        padding: 12px;
        margin: 0;
    }

    body.select-mode .article-table tbody td.article-checkbox {
        display: flex;
    }

    /* Title - full width by default, narrower in select mode */
    .article-table .article-title-cell {
        flex: 1 1 100%;
        max-width: none;
        margin-bottom: 0;
    }

    body.select-mode .article-table .article-title-cell {
        flex: 1 1 calc(100% - 2.5rem);
    }

    .article-table .article-title {
        white-space: normal;
        font-size: 1.125rem;
        line-height: 1.4;
    }

    .article-tags {
        display: flex;
        margin-left: 0;
        margin-top: 0.25rem;
    }

    .article-metadata {
        margin-left: 0;
        min-height: 0;
    }

    .article-metadata:empty {
        display: none;
    }

    .filter-dropdown-btn {
        min-height: 44px;
    }

    /* Metadata row - domain, words, date, status */
    .article-table .article-domain,
    .article-table .article-date {
        font-size: 0.75rem;
        color: var(--color-text-muted);
        width: auto;
    }

    /* First metadata item aligns under title */
    .article-table .article-domain {
        padding-left: 0.25rem;
        max-width: calc(100% - 10rem);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex-shrink: 1;
    }

    body.select-mode .article-table .article-domain {
        padding-left: 1.75rem;
    }

    /* Subsequent metadata items have smaller spacing */
    .article-table .article-date {
        padding-left: 0.5rem;
        flex-shrink: 0;
    }

    /* Dot separators between metadata items */
    .article-table .article-domain::after {
        content: "\00b7";
        margin-left: 0.5rem;
    }

    /* Only show dot after date when a sent badge follows */
    .article-table td:nth-child(4)::after {
        content: none;
    }

    /* Badge cell on mobile */
    .article-table tbody td:last-child:not(.article-title-cell):not(.article-domain):not(.article-date):not(:first-child) {
        padding-left: 0.5rem;
    }


    /* Batch toolbar - full width on mobile, above bottom tab bar */
    .batch-toolbar {
        bottom: calc(56px + env(safe-area-inset-bottom, 0px));
        left: 0;
        right: 0;
        transform: none;
        border-radius: 12px 12px 0 0;
        padding: 0.5rem 0.75rem;
        gap: 0;
    }

    @keyframes batchToolbarSlideUp {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .batch-toolbar-count {
        font-size: 0.8rem;
        padding: 0 0.25rem;
    }

    .batch-toolbar-actions {
        flex: 1;
        justify-content: flex-end;
        gap: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .batch-toolbar-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 0.5rem;
        justify-content: center;
        flex-shrink: 0;
    }

    .batch-toolbar-btn span {
        display: none;
    }

    .batch-toolbar-btn svg {
        width: 20px;
        height: 20px;
    }

    .batch-toolbar-divider {
        display: none;
    }

    /* Help overlay responsive */
    .help-overlay-panel {
        margin: 0;
        border-radius: 0;
        max-width: 100%;
    }

    .help-overlay-header {
        padding: 1rem 1rem 0.5rem;
    }

    .help-overlay-nav {
        padding: 0 1rem;
    }

    .help-nav-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }

    .help-overlay-content {
        padding: 1rem;
    }

    /* Settings tabs responsive */
    .settings-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
}

/* Non-touch mobile: always show checkboxes (no long-press available) */
@media (max-width: 768px) and (pointer: fine) {
    .article-table tbody td.article-checkbox {
        display: flex;
    }

    .article-table .article-title-cell {
        flex: 1 1 calc(100% - 2.5rem);
    }

    .article-table .article-domain {
        padding-left: 1.75rem;
    }
}

/* Safe area insets for notched devices */
@supports (padding: env(safe-area-inset-top)) {
    .navbar-inner {
        padding-top: calc(0.75rem + env(safe-area-inset-top));
    }

    .pwa-install-banner {
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
    }

    .footer {
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    }

    @media (max-width: 768px) {
        .container {
            padding-left: calc(1rem + env(safe-area-inset-left));
            padding-right: calc(1rem + env(safe-area-inset-right));
        }
    }
}

/* Shared article styles */
.shared-article-unavailable {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--color-text-muted);
}

.shared-article-unavailable h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.shared-article-attribution {
    text-align: center;
    padding: 2rem 0;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.shared-article-attribution a {
    color: var(--color-primary);
    text-decoration: none;
}

.shared-article-attribution a:hover {
    text-decoration: underline;
}

/* PWA Splash Screen */
.pwa-splash {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
}

.pwa-splash.visible {
    display: flex;
    animation: splashFadeIn 0.3s ease-out;
}

.pwa-splash.fade-out {
    animation: splashFadeOut 0.4s ease-in forwards;
}

.pwa-splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.pwa-splash-icon {
    animation: splashPulse 2s ease-in-out infinite;
}

.pwa-splash-icon svg {
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.4);
}

[data-theme="light"] .pwa-splash-icon svg {
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.3);
}

.pwa-splash-name {
    font-family: var(--font-sans);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.02em;
}

.pwa-splash-tagline {
    font-family: var(--font-sans);
    font-size: 0.875rem;
    color: var(--color-text-muted);
    font-weight: 400;
}

@keyframes splashFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes splashFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes splashPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Admin Dashboard */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.admin-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.admin-nav {
    display: flex;
    gap: 0.5rem;
}

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.admin-stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
}

.admin-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1.2;
}

.admin-stat-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

@media (max-width: 480px) {
    .admin-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .admin-stat-value {
        font-size: 1.5rem;
    }
}

/* Admin Users Table */
.admin-users-table-wrapper {
    overflow-x: auto;
}

.admin-users-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-users-table th,
.admin-users-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.admin-users-table th {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-user-email {
    font-weight: 500;
    word-break: break-all;
}

.admin-user-stat {
    white-space: nowrap;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.admin-user-date {
    white-space: nowrap;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.admin-user-status {
    white-space: nowrap;
}

.admin-user-actions {
    white-space: nowrap;
    text-align: right;
}

.admin-user-actions form {
    display: inline;
}

.admin-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.admin-badge-active {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.admin-badge-disabled {
    background: var(--color-error-bg);
    color: var(--color-error);
}

.admin-btn-enable {
    background: var(--color-success);
    color: #fff;
}

.admin-btn-enable:hover {
    background: #047857;
}

.admin-empty {
    text-align: center;
    color: var(--color-text-muted);
    padding: 2rem 0;
}

@media (max-width: 640px) {
    .admin-users-table,
    .admin-users-table tbody {
        display: block;
    }

    .admin-users-table thead {
        display: none;
    }

    .admin-users-table tbody tr {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto auto;
        gap: 0.25rem 0.5rem;
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--color-border);
    }

    .admin-users-table td {
        padding: 0;
        border-bottom: none;
    }

    .admin-user-email {
        grid-column: 1 / -1;
        font-size: 0.95rem;
    }

    .admin-user-stat {
        font-size: 0.8rem;
    }

    .admin-user-stat::before {
        font-size: 0.7rem;
        color: var(--color-text-muted);
        margin-right: 0.25rem;
    }

    .admin-user-date {
        font-size: 0.8rem;
    }

    .admin-user-status {
        grid-column: 1;
    }

    .admin-user-actions {
        grid-column: 2;
        text-align: right;
    }
}

/* Admin Backup */
.admin-backup-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    padding: 2rem;
    max-width: 480px;
}

.admin-backup-description {
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* Onboarding Wizard */
.onboarding-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="light"] .onboarding-backdrop {
    background: rgba(0, 0, 0, 0.5);
}

[data-theme="light"] .onboarding-card {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.onboarding-card {
    background: var(--color-surface);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    max-width: 480px;
    width: 90vw;
    padding: 2.5rem 2rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.onboarding-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    min-height: 160px;
}

.onboarding-icon {
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.onboarding-title {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--color-text);
}

.onboarding-description {
    font-size: 0.95rem;
    color: var(--color-text-muted);
    line-height: 1.6;
    max-width: 360px;
}

.onboarding-dots {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.onboarding-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-border);
    transition: background 0.2s;
}

.onboarding-dot.active {
    background: var(--color-primary);
}

.onboarding-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 0.75rem;
}

.onboarding-btn {
    min-width: 100px;
}

.onboarding-skip {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    min-width: 100px;
}

.onboarding-skip:hover {
    color: var(--color-text);
}
