/* ReadingDesk visual system */
:root {
    --rd-font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --rd-font-serif: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
    --rd-font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
    --rd-header-height: 72px;
    --rd-content-max: 1480px;
    --rd-form-control-max: 680px;
    --rd-on-accent: #fffaf6;

    --rd-canvas: light-dark(#f4f1ea, #18191b);
    --rd-surface: light-dark(#fffdf8, #202124);
    --rd-surface-raised: light-dark(#ffffff, #282a2e);
    --rd-ink: light-dark(#27231e, #ececef);
    --rd-muted: light-dark(#756f66, #aaaab0);
    --rd-faint: light-dark(#9b9489, #81838a);
    --rd-line: light-dark(#ded8cc, #414349);
    --rd-line-soft: light-dark(#ebe6dd, #34363b);
    --rd-accent: light-dark(#456fb6, #6f9dde);
    --rd-accent-deep: light-dark(#2f528d, #9bbcf0);
    --rd-accent-soft: light-dark(#e3eaf6, #243653);
    --rd-sage: light-dark(#607b6c, #91ad9d);
    --rd-sage-soft: light-dark(#e7eee9, #26332c);
    --rd-gold: light-dark(#d29b43, #e4b15e);
    --rd-shadow: 0 18px 50px light-dark(rgba(63, 52, 37, 0.08), rgba(0, 0, 0, 0.22));
    --rd-shadow-small: 0 8px 24px light-dark(rgba(63, 52, 37, 0.07), rgba(0, 0, 0, 0.2));
    --rd-focus-ring: 0 0 0 3px var(--rd-accent-soft);

    --primary: var(--rd-accent);
    --secondary: var(--rd-ink);
    --accent: var(--rd-accent);
    --primary-fg: #ffffff;
    --body-fg: var(--rd-ink);
    --body-bg: var(--rd-canvas);
    --body-quiet-color: var(--rd-muted);
    --body-medium-color: light-dark(#554f47, #c8c9cd);
    --body-loud-color: light-dark(#171512, #ffffff);
    --header-color: var(--rd-muted);
    --header-branding-color: var(--rd-ink);
    --header-bg: var(--rd-surface);
    --header-link-color: var(--rd-ink);
    --breadcrumbs-fg: var(--rd-muted);
    --breadcrumbs-link-fg: var(--rd-muted);
    --breadcrumbs-bg: var(--rd-canvas);
    --link-fg: var(--rd-accent-deep);
    --link-hover-color: var(--rd-accent);
    --link-selected-fg: var(--rd-accent-deep);
    --hairline-color: var(--rd-line-soft);
    --border-color: var(--rd-line);
    --darkened-bg: light-dark(#eeeae2, #1c1d20);
    --selected-bg: var(--rd-accent-soft);
    --selected-row: light-dark(#fff7f4, #232a35);
    --button-bg: var(--rd-ink);
    --button-hover-bg: light-dark(#100f0d, #3b3d42);
    --default-button-bg: var(--rd-accent);
    --default-button-hover-bg: var(--rd-accent-deep);
    --close-button-bg: light-dark(#716b63, #4b4d53);
    --close-button-hover-bg: light-dark(#4f4a44, #5d6067);
    --object-tools-bg: var(--rd-surface-raised);
    --object-tools-hover-bg: var(--rd-accent-soft);
    --object-tools-fg: var(--rd-ink);
    --message-success-bg: light-dark(#e5f1e8, #24382b);
    --message-info-bg: light-dark(#e8f0f3, #24343b);
    --message-warning-bg: light-dark(#f8edcf, #463a20);
    --message-error-bg: light-dark(#f8e3df, #472723);
    color-scheme: light dark;
}

html[data-theme="light"] {
    color-scheme: light;
}

html[data-theme="dark"] {
    color-scheme: dark;
}

html[data-theme="auto"] {
    color-scheme: light dark;
}

html {
    background: var(--rd-canvas);
}

body {
    min-width: 0;
    background: var(--rd-canvas);
    color: var(--rd-ink);
    font-family: var(--rd-font-sans);
    font-size: 0.875rem;
    letter-spacing: -0.005em;
}

#container {
    min-width: 0;
}

a:link,
a:visited {
    color: var(--rd-accent-deep);
}

button,
input,
select,
textarea {
    font: inherit;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="search"],
input[type="number"],
textarea,
select {
    box-sizing: border-box;
    border: 1px solid var(--rd-line);
    border-radius: 9px;
    background: var(--rd-surface-raised);
    color: var(--rd-ink);
    transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    border-color: var(--rd-accent);
    box-shadow: var(--rd-focus-ring);
    outline: none;
}

.button,
input[type="submit"],
input[type="button"],
.submit-row input,
a.button {
    border: 0;
    border-radius: 9px;
    padding: 10px 16px;
    font-weight: 650;
    letter-spacing: 0;
    box-shadow: none;
}

input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--rd-accent);
}

/* Header and global navigation */
#header {
    position: sticky;
    z-index: 50;
    top: 0;
    min-height: var(--rd-header-height);
    box-sizing: border-box;
    padding: 11px 28px;
    border-bottom: 1px solid var(--rd-line-soft);
    background: color-mix(in srgb, var(--rd-surface) 94%, transparent);
    color: var(--rd-ink);
    backdrop-filter: blur(14px);
}

#branding,
#site-name {
    margin: 0;
}

#site-name {
    font-size: inherit;

    & a.readingdesk-brand:link,
    & a.readingdesk-brand:visited {
        display: inline-flex;
        align-items: center;
        gap: 11px;
        color: var(--rd-ink);
        text-decoration: none;
    }
}

.readingdesk-brand-mark {
    display: grid;
    width: 39px;
    height: 39px;
    flex: 0 0 39px;
    place-items: center;
    border-radius: 11px 11px 11px 4px;
    background: var(--rd-accent);
    color: var(--rd-on-accent);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--rd-accent) 25%, transparent);

    & svg {
        width: 24px;
        height: 24px;
    }
}

.readingdesk-brand-copy {
    display: flex;
    flex-direction: column;
    gap: 1px;

    & strong {
        font-family: var(--rd-font-serif);
        font-size: 1.22rem;
        line-height: 1.1;
        letter-spacing: -0.03em;
    }

    & small {
        color: var(--rd-faint);
        font-size: 0.67rem;
        font-weight: 600;
        letter-spacing: 0.04em;
    }
}

#user-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    color: var(--rd-muted);
    font-size: 0.76rem;
    letter-spacing: 0;
    text-transform: none;

    & .user-greeting {
        padding-right: 12px;
        border-right: 1px solid var(--rd-line);

        & strong {
            color: var(--rd-ink);
        }
    }

    & .theme-toggle {
        display: grid;
        width: 34px;
        height: 34px;
        margin: 0 0 0 2px;
        place-items: center;
        border: 1px solid var(--rd-line);
        border-radius: 50%;
        background: var(--rd-surface-raised);

        & svg {
            width: 17px;
            height: 17px;
            fill: var(--rd-ink);
            color: var(--rd-surface-raised);
        }
    }
}

#header #user-tools a,
#header #logout-form button {
    color: var(--rd-muted);
    font-size: 0.76rem;
    font-weight: 650;
    text-decoration: none;
}

#header #user-tools a:hover,
#header #logout-form button:hover {
    color: var(--rd-accent);
    text-decoration: none;
}

#logout-form button {
    padding: 0;
}

div.breadcrumbs {
    padding: 9px 31px;
    border-bottom: 1px solid var(--rd-line-soft);
    background: var(--rd-canvas);
    color: var(--rd-faint);
    font-size: 0.71rem;

    & a,
    & a:link,
    & a:visited {
        color: var(--rd-muted);
        text-decoration: none;
    }
}

.main > .content {
    min-width: 0;
    background: var(--rd-canvas);
}

#content {
    box-sizing: border-box;
    width: 100%;
    max-width: var(--rd-content-max);
    margin: 0 auto;
    padding: 38px 42px 54px;
}

ul.messagelist {
    max-width: var(--rd-content-max);
    margin: 18px auto 0;
    padding: 0 42px;

    & li {
        border: 1px solid color-mix(in srgb, currentColor 12%, transparent);
        border-radius: 10px;
        background-position: 18px center;
        padding: 12px 16px 12px 48px;
    }
}

.section-kicker {
    display: block;
    margin-bottom: 8px;
    color: var(--rd-accent);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    line-height: 1.2;
    text-transform: uppercase;
}

/* Sidebar */
.toggle-nav-sidebar {
    flex-basis: 34px;
    width: 34px;
    border-color: var(--rd-line-soft);
    background: var(--rd-surface);
    color: var(--rd-muted);

    &.sticky {
        top: var(--rd-header-height);
        max-height: calc(100vh - var(--rd-header-height));
    }

    &::before {
        content: "\203A";
        font-size: 1.4rem;
    }
}

.main.shifted .toggle-nav-sidebar::before {
    content: "\2039";
}

#nav-sidebar.readingdesk-sidebar {
    left: -251px;
    flex: 0 0 250px;
    box-sizing: border-box;
    margin-left: -251px;
    padding: 24px 16px 20px;
    border: 0;
    border-right: 1px solid var(--rd-line-soft);
    background: var(--rd-surface);
    color: var(--rd-ink);
    scrollbar-width: thin;

    &.sticky {
        top: var(--rd-header-height);
        height: calc(100vh - var(--rd-header-height));
    }
}

.main.shifted > #nav-sidebar {
    margin-left: 0;
}

.main > #nav-sidebar + .content {
    max-width: calc(100% - 34px);
}

.main.shifted > #nav-sidebar + .content {
    max-width: calc(100% - 284px);
}

.sidebar-intro {
    display: flex;
    flex-direction: column;
    padding: 0 10px 18px;

    & span {
        color: var(--rd-accent);
        font-size: 0.61rem;
        font-weight: 800;
        letter-spacing: 0.14em;
        text-transform: uppercase;
    }

    & strong {
        margin-top: 4px;
        font-family: var(--rd-font-serif);
        font-size: 1.05rem;
        letter-spacing: -0.02em;
    }
}

.sidebar-search {
    position: relative;
    display: block;
    margin-bottom: 24px;

    & svg {
        position: absolute;
        z-index: 1;
        top: 50%;
        left: 11px;
        width: 16px;
        height: 16px;
        color: var(--rd-faint);
        transform: translateY(-50%);
        pointer-events: none;
    }
}

#nav-sidebar #nav-filter {
    width: 100%;
    height: 38px;
    margin: 0;
    padding: 0 10px 0 34px;
    border: 1px solid var(--rd-line-soft);
    border-radius: 9px;
    background: var(--rd-canvas);
    color: var(--rd-ink);
    font-size: 0.74rem;
}

#nav-sidebar #nav-filter::placeholder,
.quick-save-control input::placeholder {
    color: var(--rd-faint);
}

.sidebar-section {
    margin-bottom: 23px;

    & h2 {
        margin: 0 10px 8px;
        color: var(--rd-faint);
        font-size: 0.62rem;
        font-weight: 800;
        letter-spacing: 0.12em;
        text-transform: uppercase;
    }
}

#nav-sidebar .sidebar-section {
    & table {
        width: 100%;
        border: 0;
        border-collapse: separate;
        border-spacing: 0 3px;
    }

    & th {
        width: auto;
        padding: 0;
        border: 0;
        background: transparent;
        font-weight: 600;
    }

    & tr {
        background: transparent;
    }

    & th a {
        display: flex;
        align-items: center;
        gap: 11px;
        min-height: 40px;
        box-sizing: border-box;
        padding: 8px 10px;
        border-radius: 9px;
        color: var(--rd-muted);
        font-size: 0.79rem;
        text-decoration: none;

        & svg {
            color: var(--rd-faint);
        }

        &:hover {
            background: var(--rd-canvas);
            color: var(--rd-ink);

            & svg {
                color: var(--rd-accent);
            }
        }
    }

    & tr.current-model th a {
        background: var(--rd-accent-soft);
        color: var(--rd-accent-deep);
        font-weight: 750;

        & svg {
            color: var(--rd-accent);
        }
    }
}

#nav-sidebar .sidebar-section th a svg,
.sidebar-note svg {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
}

.sidebar-note {
    display: flex;
    gap: 10px;
    margin: 34px 4px 0;
    padding: 14px;
    border: 1px solid var(--rd-line-soft);
    border-radius: 12px;
    background: var(--rd-canvas);
    color: var(--rd-faint);

    & svg {
        color: var(--rd-sage);
    }

    & p {
        margin: 0;
        font-family: var(--rd-font-serif);
        font-size: 0.72rem;
        line-height: 1.45;
    }
}

/* Dashboard */
.dashboard #content {
    width: 100%;
    max-width: 1320px;
}

.dashboard-shell {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.dashboard-hero {
    position: relative;
    display: grid;
    min-height: 400px;
    overflow: hidden;
    grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
    align-items: center;
    padding: 48px 58px;
    border: 1px solid var(--rd-line-soft);
    border-radius: 24px;
    background:
        radial-gradient(circle at 86% 14%, color-mix(in srgb, var(--rd-accent) 13%, transparent), transparent 34%),
        linear-gradient(135deg, var(--rd-surface-raised), var(--rd-surface));
    box-shadow: var(--rd-shadow);

    &::before {
        position: absolute;
        right: 37%;
        bottom: -50px;
        width: 180px;
        height: 180px;
        border: 1px solid var(--rd-line-soft);
        border-radius: 50%;
        content: "";
    }

    & h1 {
        max-width: 610px;
        margin: 0 0 20px;
        color: var(--rd-ink);
        font-family: var(--rd-font-serif);
        font-size: clamp(2.55rem, 4.5vw, 4.55rem);
        font-weight: 500;
        letter-spacing: -0.055em;
        line-height: 0.98;
    }
}

.dashboard-hero-copy {
    position: relative;
    z-index: 2;
    max-width: 630px;

    & > p {
        max-width: 540px;
        margin: 0;
        color: var(--rd-muted);
        font-size: 1rem;
        line-height: 1.7;
    }
}

.dashboard-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 11px;
    margin-top: 30px;

    & a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 46px;
        box-sizing: border-box;
        padding: 0 20px;
        border-radius: 10px;
        font-size: 0.79rem;
        font-weight: 750;
        text-decoration: none !important;
    }

    & .primary-action {
        background: var(--rd-accent);
        color: var(--rd-on-accent);
        box-shadow: 0 8px 20px color-mix(in srgb, var(--rd-accent) 22%, transparent);

        &:hover {
            background: var(--rd-accent-deep);
            color: var(--rd-on-accent);
        }
    }

    & .secondary-action {
        border: 1px solid var(--rd-line);
        background: var(--rd-surface-raised);
        color: var(--rd-ink);
    }
}

.dashboard-stack {
    position: relative;
    width: 300px;
    height: 310px;
    justify-self: center;
}

.paper-card {
    position: absolute;
    display: flex;
    width: 210px;
    height: 270px;
    box-sizing: border-box;
    flex-direction: column;
    padding: 25px;
    border: 1px solid var(--rd-line);
    border-radius: 7px;
    background: var(--rd-surface-raised);
    box-shadow: 0 24px 50px rgba(48, 38, 25, 0.16);

    & span {
        color: var(--rd-accent);
        font-size: 0.58rem;
        font-weight: 800;
        letter-spacing: 0.15em;
    }

    & i {
        display: block;
        height: 5px;
        margin-top: 12px;
        border-radius: 5px;
        background: var(--rd-line-soft);

        &:nth-last-child(1) {
            width: 62%;
        }
    }

    & strong {
        margin: 10px 0 4px;
        font-family: var(--rd-font-serif);
        font-size: 1.32rem;
        font-weight: 600;
        line-height: 1.05;
    }
}

.paper-card-back {
    top: 22px;
    left: 7px;
    transform: rotate(-11deg);
}

.paper-card-middle {
    top: 12px;
    right: 0;
    background: var(--rd-sage-soft);
    transform: rotate(9deg);
}

.paper-card-front {
    z-index: 2;
    top: 16px;
    left: 49px;
    transform: rotate(-1deg);
}

.paper-image {
    height: 95px;
    margin: -12px -12px 20px;
    border-radius: 3px;
    background:
        linear-gradient(145deg, transparent 45%, rgba(255, 255, 255, 0.22) 46% 53%, transparent 54%),
        linear-gradient(35deg, var(--rd-sage), #97aa91 55%, #d4b67a);
}

.dashboard-shortcuts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.shortcut-card {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 18px;
    border: 1px solid var(--rd-line-soft);
    border-radius: 14px;
    background: var(--rd-surface);
    color: var(--rd-ink);
    box-shadow: var(--rd-shadow-small);
    text-decoration: none !important;
    transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;

    &:link,
    &:visited {
        color: var(--rd-ink);
    }

    &:hover {
        border-color: var(--rd-line);
        box-shadow: var(--rd-shadow);
        transform: translateY(-2px);
    }

    & > span:nth-child(2) {
        display: flex;
        min-width: 0;
        flex-direction: column;
        gap: 3px;
    }

    & strong {
        font-family: var(--rd-font-serif);
        font-size: 1rem;
    }

    & small {
        overflow: hidden;
        color: var(--rd-muted);
        font-size: 0.69rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    & b {
        color: var(--rd-faint);
        font-size: 1.1rem;
    }
}

.shortcut-icon,
.quick-save-icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
}

.shortcut-icon {
    border-radius: 12px;

    & svg {
        width: 23px;
        height: 23px;
    }
}

.shortcut-icon-inbox,
.quick-save-icon {
    background: var(--rd-accent-soft);
    color: var(--rd-accent);
}

.shortcut-icon-star {
    background: color-mix(in srgb, var(--rd-gold) 17%, transparent);
    color: var(--rd-gold);
}

.shortcut-icon-tags {
    background: var(--rd-sage-soft);
    color: var(--rd-sage);
}

.shortcut-icon-feed {
    background: color-mix(in srgb, var(--rd-accent) 11%, var(--rd-sage-soft));
    color: var(--rd-accent-deep);
}

/* Reading list heading and quick save */
.library-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 28px;

    & p {
        max-width: 640px;
        margin: 10px 0 0;
        color: var(--rd-muted);
        font-size: 0.88rem;
        line-height: 1.55;
    }
}

.library-heading h1,
.article-edit-heading h1 {
    margin: 0;
    color: var(--rd-ink);
    font-family: var(--rd-font-serif);
    font-size: clamp(2.3rem, 4vw, 3.55rem);
    font-weight: 500;
    letter-spacing: -0.055em;
    line-height: 1;
}

.library-count {
    display: flex;
    min-width: 100px;
    flex-direction: column;
    align-items: flex-end;
    padding-bottom: 3px;

    & strong {
        color: var(--rd-ink);
        font-family: var(--rd-font-serif);
        font-size: 1.65rem;
        font-weight: 500;
        line-height: 1;
    }

    & span {
        margin-top: 4px;
        color: var(--rd-faint);
        font-size: 0.65rem;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }
}

.quick-save {
    display: grid;
    grid-template-columns: 48px minmax(180px, 0.55fr) minmax(320px, 1.45fr);
    gap: 18px;
    align-items: center;
    margin-bottom: 28px;
    padding: 19px 20px;
    border: 1px solid var(--rd-line-soft);
    border-radius: 16px;
    background: var(--rd-surface);
    box-shadow: var(--rd-shadow-small);
}

.quick-save-icon {
    border-radius: 13px 13px 13px 5px;

    & svg {
        width: 25px;
        height: 25px;
    }
}

.quick-save-copy {
    & h2 {
        margin: 0 0 4px;
        color: var(--rd-ink);
        font-family: var(--rd-font-serif);
        font-size: 1.03rem;
    }

    & p {
        margin: 0;
        color: var(--rd-muted);
        font-size: 0.69rem;
        line-height: 1.4;
    }
}

.quick-save-control {
    display: flex;
    gap: 9px;

    & input[type="url"] {
        min-width: 0;
        height: 46px;
        flex: 1 1 auto;
        padding: 0 15px;
        border-color: var(--rd-line);
        background: var(--rd-canvas);
        font-size: 0.81rem;
    }

    & button {
        display: inline-flex;
        height: 46px;
        flex: 0 0 auto;
        align-items: center;
        gap: 9px;
        padding: 0 17px;
        border: 0;
        border-radius: 9px;
        background: var(--rd-accent);
        color: var(--rd-on-accent);
        font-size: 0.75rem;
        font-weight: 750;
        cursor: pointer;
        transition: background 150ms ease, transform 150ms ease;

        &:hover {
            background: var(--rd-accent-deep);
            transform: translateY(-1px);
        }

        & svg {
            width: 17px;
            height: 17px;
        }
    }
}

.quick-save-form .errorlist {
    margin: 7px 0 0;
    padding: 0;
    background: transparent;

    & li {
        margin: 0;
        color: var(--error-fg);
        font-size: 0.68rem;
    }
}

.change-list .object-tools {
    margin: -5px 0 12px;
}

.object-tools {
    & li {
        list-style: none;
    }

    & a:link,
    & a:visited {
        padding: 8px 13px;
        border: 1px solid var(--rd-line);
        border-radius: 9px;
        background-color: var(--rd-surface-raised);
        color: var(--rd-muted);
        font-size: 0.65rem;
        font-weight: 750;
        letter-spacing: 0.04em;
    }

    & a:focus,
    & a:hover {
        border-color: var(--rd-accent);
        background-color: var(--rd-accent-soft);
        color: var(--rd-accent-deep);
    }

    & a.addlink {
        background-image: none;
    }
}

/* Changelist controls and filters */
#changelist {
    background: transparent;

    & .changelist-form-container {
        gap: 26px;

        &:has(#changelist-filter) > div {
            max-width: calc(100% - 246px);
        }
    }
}

#toolbar {
    margin: 0 0 12px;
    padding: 0;
    border: 0;
    background: transparent;
}

#changelist-search > div {
    display: flex;
    align-items: center;
    gap: 8px;
}

#changelist-search label {
    position: relative;
    z-index: 1;
    width: 0;

    & img {
        position: absolute;
        left: 13px;
        width: 15px;
        opacity: 0.55;
        transform: translateY(-50%);
    }
}

#toolbar form #searchbar {
    width: min(390px, 52vw);
    height: 42px;
    margin: 0;
    padding: 0 13px 0 38px;
    border: 1px solid var(--rd-line);
    border-radius: 10px;
    background: var(--rd-surface);
    color: var(--rd-ink);
    font-size: 0.77rem;
}

#toolbar form input[type="submit"] {
    height: 42px;
    padding: 0 14px;
    border: 1px solid var(--rd-line);
    border-radius: 9px;
    background: var(--rd-surface-raised);
    color: var(--rd-ink);
    box-shadow: none;
    font-size: 0.71rem;
    font-weight: 700;
}

#changelist-search .quiet {
    color: var(--rd-faint);
    font-size: 0.67rem;

    & a {
        color: var(--rd-muted);
    }
}

#changelist-filter {
    flex: 0 0 220px;
    margin: 0;
    padding: 7px 0 10px;
    border: 1px solid var(--rd-line-soft);
    border-radius: 14px;
    background: var(--rd-surface);
    box-shadow: var(--rd-shadow-small);

    & h2 {
        margin: 0;
        padding: 12px 16px 13px;
        border-bottom: 1px solid var(--rd-line-soft);
        background: transparent;
        color: var(--rd-ink);
        font-family: var(--rd-font-serif);
        font-size: 0.98rem;
        font-weight: 650;
        letter-spacing: -0.01em;
        text-transform: none;
    }

    & details {
        border-bottom: 1px solid var(--rd-line-soft);

        &:last-child {
            border-bottom: 0;
        }

        & summary {
            margin: 0;
            padding: 13px 16px 8px;
            color: var(--rd-faint);
            font-size: 0.61rem;
            font-weight: 800;
            letter-spacing: 0.09em;
            text-transform: uppercase;
        }

        & > summary::before,
        &[open] > summary::before {
            display: none;
        }
    }

    & ul {
        display: flex;
        flex-direction: column;
        gap: 2px;
        margin: 0;
        padding: 0 9px 11px;
        border: 0;
    }

    & li,
    & li.selected {
        margin: 0;
        padding: 0;
        border: 0;
    }

    & a {
        padding: 7px 9px;
        border-radius: 7px;
        color: var(--rd-muted);
        font-size: 0.72rem;
        text-decoration: none;

        &:hover {
            background: var(--rd-canvas);
            color: var(--rd-ink);
        }
    }

    & li.selected a {
        background: var(--rd-accent-soft);
        color: var(--rd-accent-deep);
        font-weight: 750;
    }

    & #changelist-filter-extra-actions {
        padding: 0 9px 8px;
        border-bottom: 1px solid var(--rd-line-soft);

        & h3 {
            margin: 3px 0;
            padding: 0;
        }

        & a {
            padding-left: 0;
            background-image: none;
            font-size: 0.66rem;
        }
    }
}

#changelist .actions {
    display: flex;
    width: auto;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 1px solid var(--rd-line-soft);
    border-radius: 10px;
    background: var(--rd-surface);

    & label {
        display: inline-flex;
        align-items: center;
        color: var(--rd-faint);
        font-size: 0;
    }

    & select {
        width: auto;
        height: 34px;
        margin: 0;
        padding: 0 30px 0 10px;
        border-color: var(--rd-line);
        border-radius: 8px;
        background-color: var(--rd-surface-raised);
        color: var(--rd-ink);
        font-size: 0.7rem;
    }

    & .button {
        height: 34px;
        padding: 0 13px;
        border: 0;
        border-radius: 8px;
        background: var(--rd-ink);
        color: var(--rd-surface);
        box-shadow: none;
        font-size: 0.69rem;
        font-weight: 750;
    }

    & span:is(.action-counter, .all, .question, .clear) {
        color: var(--rd-faint);
        font-size: 0.66rem;
    }
}

.library-selection {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 28px;
    padding: 0 3px;
    color: var(--rd-faint);
    font-size: 0.66rem;

    & label {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        font-size: 0.66rem;
        cursor: pointer;
    }
}

.library-selection input,
.entry-select input {
    margin: 0;
}

.entry-select input {
    width: 24px;
    height: 24px;
}

/* Article cards */
#changelist-form .reading-results {
    overflow: visible;
}

#changelist .entry-card-table {
    width: 100%;
    border: 0;
    border-collapse: separate;
    border-spacing: 0 11px;
    background: transparent;

    & tbody tr,
    & tbody tr:nth-child(odd) {
        background: transparent;
    }

    & tbody td {
        padding: 0;
        border: 0;
        background: transparent;
    }

    & tr.selected .entry-card,
    & tr:has(.action-select:checked) .entry-card {
        border-color: color-mix(in srgb, var(--rd-accent) 55%, var(--rd-line));
        background: var(--selected-row);
        box-shadow: 0 0 0 2px var(--rd-accent-soft);
    }
}

.entry-card {
    position: relative;
    display: flex;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--rd-line-soft);
    border-radius: 15px;
    background: var(--rd-surface);
    box-shadow: 0 4px 16px rgba(54, 45, 32, 0.035);
    transition: border-color 170ms ease, box-shadow 170ms ease, transform 170ms ease;

    &:hover {
        border-color: var(--rd-line);
        box-shadow: var(--rd-shadow-small);
        transform: translateY(-1px);

        & .entry-cover img {
            transform: scale(1.025);
        }

        & .entry-open {
            border-color: var(--rd-accent);
            background: var(--rd-accent);
            color: var(--rd-on-accent);
            transform: translateX(2px);
        }
    }
}

.entry-select {
    display: grid;
    width: 45px;
    flex: 0 0 45px;
    place-items: center;
    border-right: 1px solid var(--rd-line-soft);
    background: color-mix(in srgb, var(--rd-canvas) 65%, transparent);
    cursor: pointer;
}

.entry-card-link {
    display: grid;
    min-width: 0;
    flex: 1 1 auto;
    grid-template-columns: 158px minmax(0, 1fr) 42px;
    gap: 22px;
    align-items: center;
    padding: 14px 16px 14px 14px;
    text-decoration: none !important;

    &:link,
    &:visited {
        color: var(--rd-ink);
    }
}

.entry-cover {
    position: relative;
    width: 158px;
    height: 112px;
    overflow: hidden;
    border-radius: 10px;
    background: var(--rd-sage-soft);

    & img,
    & .entry-cover-placeholder {
        width: 100%;
        height: 100%;
    }

    & img {
        object-fit: cover;
        transition: transform 300ms ease;
    }
}

.entry-cover-placeholder {
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    background:
        linear-gradient(145deg, transparent 49%, color-mix(in srgb, var(--rd-sage) 13%, transparent) 50% 51%, transparent 52%),
        var(--rd-sage-soft);
    color: var(--rd-sage);

    &::before,
    &::after,
    & i {
        position: absolute;
        border: 1px solid color-mix(in srgb, var(--rd-sage) 20%, transparent);
        border-radius: 50%;
        content: "";
    }

    &::before {
        top: -32px;
        right: -22px;
        width: 92px;
        height: 92px;
    }

    &::after {
        bottom: -35px;
        left: -20px;
        width: 80px;
        height: 80px;
    }

    & i {
        top: 12px;
        left: 17px;
        width: 8px;
        height: 8px;
        background: color-mix(in srgb, var(--rd-sage) 24%, transparent);
    }

    & b {
        position: relative;
        z-index: 1;
        font-family: var(--rd-font-serif);
        font-size: 2.45rem;
        font-weight: 500;
        opacity: 0.8;
    }
}

.entry-star {
    position: absolute;
    top: 7px;
    right: 7px;
    display: grid;
    width: 27px;
    height: 27px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 50%;
    background: color-mix(in srgb, var(--rd-surface-raised) 92%, transparent);
    color: var(--rd-gold);
    box-shadow: 0 3px 10px rgba(40, 32, 20, 0.12);
    backdrop-filter: blur(5px);

    & svg {
        width: 15px;
        height: 15px;
        fill: currentColor;
    }
}

.feed-new-dot {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 10px;
    height: 10px;
    border: 3px solid color-mix(in srgb, var(--rd-surface-raised) 90%, transparent);
    border-radius: 50%;
    background: var(--rd-accent);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--rd-accent) 35%, transparent);
}

.feed-entry-unread .entry-card {
    border-left: 3px solid var(--rd-accent);
}

.feed-entry-card .entry-domain {
    color: var(--rd-sage);
}

.entry-copy {
    min-width: 0;
}

.entry-source-line {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 5px;
}

.entry-domain {
    overflow: hidden;
    color: var(--rd-accent);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.entry-status,
.entry-tags span {
    padding: 3px 7px;
    border-radius: 999px;
}

.entry-status {
    background: var(--rd-sage-soft);
    color: var(--rd-accent-deep);
    font-size: 0.57rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.entry-copy h2 {
    overflow: hidden;
    margin: 0 0 6px;
    font-family: var(--rd-font-serif);
    font-size: clamp(1.08rem, 1.6vw, 1.33rem);
    font-weight: 650;
    letter-spacing: -0.025em;
    line-height: 1.14;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entry-excerpt {
    display: -webkit-box;
    overflow: hidden;
    margin: 0 0 8px;
    color: var(--rd-muted);
    font-family: var(--rd-font-serif);
    font-size: 0.79rem;
    line-height: 1.42;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.entry-pending {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 9px;
    color: var(--rd-faint);
    font-family: var(--rd-font-serif);
    font-size: 0.76rem;
    font-style: italic;

    & span {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: var(--rd-accent);
        box-shadow: 0 0 0 4px var(--rd-accent-soft);
    }
}

.entry-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 0;
    color: var(--rd-muted);
    font-size: 0.63rem;

    & span + span::before {
        margin: 0 7px;
        color: var(--rd-line);
        content: "\2022";
    }
}

.entry-tags {
    display: flex;
    overflow: hidden;
    gap: 5px;
    margin-top: 8px;

    & span {
        flex: 0 0 auto;
        border: 1px solid var(--rd-line-soft);
        background: var(--rd-canvas);
        color: var(--rd-muted);
        font-size: 0.56rem;
        font-weight: 650;
    }
}

.entry-open {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid var(--rd-line-soft);
    border-radius: 50%;
    color: var(--rd-faint);
    transition: border-color 150ms ease, background 150ms ease, color 150ms ease, transform 150ms ease;

    & svg {
        width: 16px;
        height: 16px;
    }
}

#changelist .changelist-footer {
    margin-top: 10px;
    padding: 15px 3px;
    border: 0;
    color: var(--rd-muted);
}

#changelist .changelist-footer .paginator,
#changelist .paginator {
    border: 0;
    background: transparent;
    color: var(--rd-muted);
}

.paginator a:link,
.paginator a:visited {
    border-radius: 7px;
    background: var(--rd-surface-raised);
    color: var(--rd-ink);
}

.library-empty {
    display: flex;
    min-height: 390px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 45px 20px;
    border: 1px dashed var(--rd-line);
    border-radius: 17px;
    background: color-mix(in srgb, var(--rd-surface) 65%, transparent);
    text-align: center;
}

.library-empty-art {
    position: relative;
    width: 104px;
    height: 90px;
    margin-bottom: 23px;

    & svg {
        position: absolute;
        z-index: 2;
        right: 2px;
        bottom: 1px;
        width: 34px;
        height: 34px;
        padding: 7px;
        border-radius: 50%;
        background: var(--rd-accent);
        color: var(--rd-on-accent);
        box-shadow: 0 5px 15px color-mix(in srgb, var(--rd-accent) 25%, transparent);
    }
}

.empty-page {
    position: absolute;
    display: block;
    width: 64px;
    height: 78px;
    border: 1px solid var(--rd-line);
    border-radius: 4px;
    background: var(--rd-surface-raised);
    box-shadow: var(--rd-shadow-small);
}

.empty-page-back {
    top: 7px;
    left: 10px;
    background: var(--rd-sage-soft);
    transform: rotate(-9deg);
}

.empty-page-front {
    top: 2px;
    left: 27px;
    padding: 18px 12px;
    box-sizing: border-box;
    transform: rotate(5deg);

    & i {
        display: block;
        height: 3px;
        margin-bottom: 7px;
        border-radius: 3px;
        background: var(--rd-line);

        &:last-child {
            width: 65%;
        }
    }
}

.library-empty h2 {
    margin: 0 0 8px;
    font-family: var(--rd-font-serif);
    font-size: 1.4rem;
}

.library-empty p {
    max-width: 450px;
    margin: 0;
    color: var(--rd-muted);
    font-size: 0.8rem;
    line-height: 1.55;
}

.library-empty a {
    margin-top: 17px;
    color: var(--rd-accent-deep);
    font-size: 0.72rem;
    font-weight: 750;
}

/* Article edit and reader view */
.article-edit-heading {
    max-width: 920px;
    margin-bottom: 28px;

    & h1 {
        max-width: 850px;
        font-size: clamp(2.05rem, 4vw, 3.3rem);
        line-height: 1.05;
    }

    & > p {
        margin: 12px 0 0;
        color: var(--rd-muted);
    }
}

.article-back {
    display: inline-block;
    margin-bottom: 28px;
    color: var(--rd-muted) !important;
    font-size: 0.71rem;
    font-weight: 700;
    text-decoration: none !important;

    &:hover {
        color: var(--rd-accent) !important;
    }
}

.article-heading-meta {
    display: flex;
    flex-wrap: wrap;
    margin-top: 13px;
    color: var(--rd-faint);
    font-size: 0.68rem;

    & span + span::before {
        margin: 0 9px;
        content: "\2022";
    }
}

.model-entry.change-form {
    & #content {
        max-width: 1240px;
    }

    & .object-tools {
        margin-top: -7px;
    }

    & #entry_form > div {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    & fieldset.module {
        overflow: hidden;
        margin: 0;
        border: 1px solid var(--rd-line-soft);
        border-radius: 14px;
        background: var(--rd-surface);
        box-shadow: 0 3px 14px rgba(54, 45, 32, 0.03);

        & > h2,
        & summary h2 {
            padding: 15px 19px;
            border-bottom: 1px solid var(--rd-line-soft);
            background: transparent;
            color: var(--rd-ink);
            font-family: var(--rd-font-serif);
            font-size: 1.05rem;
            font-weight: 650;
            letter-spacing: -0.01em;
            text-transform: none;
        }

        & > .description,
        & details > .description {
            padding: 13px 19px;
            border-bottom: 1px solid var(--rd-line-soft);
            color: var(--rd-muted);
            font-size: 0.7rem;
        }

        & > .form-row,
        & details > .form-row {
            padding: 16px 19px;
            border-bottom: 1px solid var(--rd-line-soft);

            &:last-child {
                border-bottom: 0;
            }
        }
    }

    & fieldset.collapse details {
        & > summary {
            display: block;
            list-style: none;
            cursor: pointer;

            &::-webkit-details-marker {
                display: none;
            }

            & h2 {
                position: relative;
                border-bottom: 0;

                &::after {
                    position: absolute;
                    top: 50%;
                    right: 19px;
                    color: var(--rd-faint);
                    content: "+";
                    font-family: var(--rd-font-sans);
                    font-size: 1.15rem;
                    font-weight: 400;
                    transform: translateY(-50%);
                }
            }
        }

        &[open] > summary h2 {
            border-bottom: 1px solid var(--rd-line-soft);

            &::after {
                content: "\2212";
            }
        }
    }

    & .aligned {
        & label {
            width: 145px;
            color: var(--rd-muted);
            font-size: 0.71rem;
            font-weight: 700;
        }

        & .form-row input[type="text"],
        & .form-row input[type="url"],
        & .form-row textarea,
        & .form-row select:not([multiple]) {
            width: min(100%, var(--rd-form-control-max));
            min-height: 42px;
            padding: 9px 11px;
        }

        & .form-row textarea {
            min-height: 220px;
            font-family: var(--rd-font-mono);
            font-size: 0.72rem;
            line-height: 1.5;
        }
    }

    & .reading-state {
        & .form-multiline {
            display: flex;
            gap: 36px;
        }

        & .checkbox-row {
            gap: 8px;

            & label {
                width: auto;
                color: var(--rd-ink);
            }
        }
    }

    & .select2-container {
        width: min(100%, var(--rd-form-control-max)) !important;
    }

    & .select2-container--admin-autocomplete {
        & .select2-selection--multiple {
            min-height: 42px;
            box-sizing: border-box;
            padding: 4px 6px;
            border: 1px solid var(--rd-line);
            border-radius: 9px;
            background: var(--rd-surface-raised);
        }

        &.select2-container--focus .select2-selection--multiple {
            border-color: var(--rd-accent);
            box-shadow: var(--rd-focus-ring);
        }

        & .select2-selection__choice {
            margin: 3px 5px 3px 0;
            padding: 4px 8px;
            border: 1px solid var(--rd-line-soft);
            border-radius: 999px;
            background: var(--rd-canvas);
            color: var(--rd-ink);
            font-size: 0.68rem;
        }

        & .select2-search--inline .select2-search__field {
            min-height: 26px;
            margin: 3px 0;
            color: var(--rd-ink);
        }
    }
}

.reader-fieldset .field-article_reader {
    padding: 0 !important;

    & > div > .flex-container > label {
        display: none;
    }

    & .readonly {
        margin: 0;
    }
}

.reader-preview {
    max-width: 730px;
    margin: 0 auto;
    padding: 54px 52px 62px;
    color: var(--rd-ink);
    font-family: var(--rd-font-serif);
    font-size: 1.02rem;
    line-height: 1.76;

    & > *:first-child {
        margin-top: 0;
    }

    & > *:last-child {
        margin-bottom: 0;
    }

    & h1,
    & h2,
    & h3,
    & h4 {
        margin: 1.7em 0 0.65em;
        color: var(--rd-ink);
        font-family: inherit;
        font-weight: 650;
        letter-spacing: -0.03em;
        line-height: 1.15;
    }

    & h1 {
        font-size: 2rem;
    }

    & h2 {
        font-size: 1.55rem;
    }

    & h3 {
        font-size: 1.25rem;
    }

    & p,
    & ul,
    & ol,
    & figure,
    & blockquote,
    & pre,
    & table {
        margin: 0 0 1.35em;
    }

    & img {
        display: block;
        max-width: 100%;
        height: auto;
        margin: 1.8em auto;
        border-radius: 8px;
    }

    & a {
        color: var(--rd-accent-deep);
        text-decoration-color: color-mix(in srgb, var(--rd-accent) 45%, transparent);
        text-underline-offset: 3px;
    }

    & blockquote {
        padding: 5px 0 5px 22px;
        border-left: 3px solid var(--rd-accent);
        color: var(--rd-muted);
        font-size: 1.12rem;
        font-style: italic;
    }

    & pre,
    & code {
        font-family: var(--rd-font-mono);
        font-size: 0.78rem;
    }

    & pre {
        overflow-x: auto;
        padding: 18px;
        border: 1px solid var(--rd-line-soft);
        border-radius: 9px;
        background: var(--rd-canvas);
    }

    & table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.85rem;
    }

    & th,
    & td {
        padding: 9px;
        border: 1px solid var(--rd-line);
    }

    &.reader-preview--empty {
        max-width: none;
        padding: 58px 30px;
        color: var(--rd-faint);
        font-size: 0.91rem;
        font-style: italic;
        text-align: center;
    }
}

.model-entry.change-form .submit-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 0 0;
    padding: 14px;
    border: 1px solid var(--rd-line-soft);
    border-radius: 13px;
    background: var(--rd-surface);

    & input {
        margin: 0;

        &.default {
            order: -1;
        }
    }

    & a.deletelink {
        margin-left: auto;
    }
}

.feed-save-form {
    margin: 0;
}

.object-tools .feed-save-form button {
    min-height: 0;
    padding: 8px 13px;
    border: 1px solid var(--rd-accent);
    border-radius: 9px;
    background: var(--rd-accent);
    color: var(--rd-on-accent);
    font-size: 0.65rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    cursor: pointer;
}

.object-tools .feed-save-form .feed-secondary-button {
    border-color: var(--rd-line);
    background: var(--rd-surface-raised);
    color: var(--rd-muted);
}

.model-feedentry.change-form .reader-fieldset .readonly {
    margin: 0;
}

.model-feedentry.change-form .reader-fieldset .form-row,
.model-feedentry.change-form .reader-fieldset .flex-container {
    display: block;
    padding: 0;
}

.model-feedentry.change-form .reader-fieldset label {
    display: none;
}

/* Generic admin screens */
.module {
    background: var(--rd-surface);
}

.change-form:not(.model-entry) #content,
.change-list:not(.model-entry) #content,
.delete-confirmation #content {
    max-width: 1180px;
}

.change-form:not(.model-entry) #content h1,
.change-list:not(.model-entry) #content h1,
.delete-confirmation #content h1 {
    color: var(--rd-ink);
    font-family: var(--rd-font-serif);
    font-size: 2.2rem;
    font-weight: 500;
    letter-spacing: -0.045em;
}

.change-list:not(.model-entry) #changelist .results,
.change-form:not(.model-entry) fieldset.module,
.delete-confirmation #content-main {
    overflow: hidden;
    border: 1px solid var(--rd-line-soft);
    border-radius: 13px;
    background: var(--rd-surface);
    box-shadow: var(--rd-shadow-small);
}

table thead th,
table thead th.sorted {
    border-color: var(--rd-line-soft);
    background: var(--rd-canvas);
    color: var(--rd-muted);
}

table tbody tr,
table tbody tr:nth-child(odd),
.row-form-errors {
    background: var(--rd-surface);
}

td,
th {
    border-color: var(--rd-line-soft);
}

.module h2,
.module caption,
.inline-group h2 {
    background: var(--rd-ink);
    color: var(--rd-surface);
}

#changelist .entry-copy h2,
#changelist .library-empty h2 {
    padding: 0;
    background: transparent;
    color: var(--rd-ink);
}

/* Login */
body.login {
    background:
        radial-gradient(circle at 18% 15%, color-mix(in srgb, var(--rd-accent) 10%, transparent), transparent 28%),
        radial-gradient(circle at 85% 80%, color-mix(in srgb, var(--rd-sage) 12%, transparent), transparent 30%),
        var(--rd-canvas);

    & #container {
        width: min(430px, calc(100% - 32px));
        min-width: 0;
        margin-top: clamp(50px, 12vh, 120px);
        border: 1px solid var(--rd-line-soft);
        border-radius: 20px;
        background: var(--rd-surface);
        box-shadow: var(--rd-shadow);
    }

    & #header {
        position: static;
        justify-content: center;
        padding: 28px 28px 20px;
        border: 0;
        background: transparent;
    }

    & .readingdesk-brand-copy small {
        display: none;
    }

    & #content {
        padding: 16px 34px 34px;
    }

    & #content-main {
        & .form-row {
            padding: 10px 0;
        }

        & label {
            margin-bottom: 7px;
            color: var(--rd-muted);
            font-size: 0.72rem;
            font-weight: 700;
        }
    }

    & .form-row #id_username,
    & .form-row #id_password {
        min-height: 44px;
        padding: 8px 11px;
    }

    & .submit-row {
        padding: 14px 0 0;

        & input {
            width: 100%;
            min-height: 44px;
            background: var(--rd-accent);
        }
    }
}

/* Responsive layouts */
@media (max-width: 1180px) {
    #content {
        padding-right: 30px;
        padding-left: 30px;
    }

    .quick-save {
        grid-template-columns: 48px minmax(0, 1fr);
    }

    .quick-save-form {
        grid-column: 1 / -1;
    }

    .entry-card-link {
        grid-template-columns: 142px minmax(0, 1fr) 34px;
        gap: 18px;
    }

    .entry-cover {
        width: 142px;
        height: 105px;
    }

    .entry-excerpt {
        -webkit-line-clamp: 1;
    }

    .dashboard-hero {
        padding: 42px;
    }

    .dashboard-stack {
        transform: scale(0.9);
    }
}

@media (max-width: 980px) {
    #changelist .changelist-form-container {
        flex-direction: column;
    }

    #changelist .changelist-form-container:has(#changelist-filter) > div {
        width: 100%;
        max-width: 100%;
    }

    #changelist-filter {
        display: grid;
        width: 100%;
        box-sizing: border-box;
        flex-basis: auto;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        margin: 8px 0 0;
        order: 2;
    }

    #changelist-filter > h2,
    #changelist-filter-extra-actions {
        grid-column: 1 / -1;
    }

    #changelist-filter details {
        border-right: 1px solid var(--rd-line-soft);
        border-bottom: 0;
    }

    #changelist-filter details:last-child {
        border-right: 0;
    }

    .dashboard-hero {
        grid-template-columns: minmax(0, 1fr) 270px;
    }

    .dashboard-stack {
        margin-left: -15px;
        transform: scale(0.8);
    }

    .dashboard-shortcuts {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    #header {
        min-height: 62px;
        flex-direction: row;
        justify-content: space-between;
        padding: 10px 15px;
    }

    .readingdesk-brand-mark {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }

    .readingdesk-brand-mark svg {
        width: 21px;
        height: 21px;
    }

    .readingdesk-brand-copy strong {
        font-size: 1.08rem;
    }

    .readingdesk-brand-copy small,
    #user-tools .user-greeting,
    #user-tools .user-account-link {
        display: none;
    }

    #user-tools {
        gap: 10px;
        line-height: 1;
    }

    #header #logout-form button {
        font-size: 0.69rem;
    }

    #user-tools .theme-toggle {
        width: 32px;
        height: 32px;
    }

    #nav-sidebar,
    #toggle-nav-sidebar {
        display: none;
    }

    .main > #nav-sidebar + .content,
    .main.shifted > #nav-sidebar + .content {
        max-width: 100%;
    }

    div.breadcrumbs {
        overflow: hidden;
        padding: 8px 16px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #content {
        padding: 27px 15px 42px;
    }

    ul.messagelist {
        padding: 0 15px;
    }

    .library-heading {
        align-items: flex-start;
        margin-bottom: 23px;
    }

    .library-heading h1 {
        font-size: 2.45rem;
    }

    .library-heading p {
        font-size: 0.8rem;
    }

    .library-count {
        min-width: 58px;
    }

    .library-count strong {
        font-size: 1.35rem;
    }

    .quick-save {
        grid-template-columns: 42px minmax(0, 1fr);
        gap: 13px;
        padding: 15px;
    }

    .quick-save-icon {
        width: 42px;
        height: 42px;
    }

    .quick-save-control {
        flex-direction: column;
    }

    .quick-save-control input[type="url"],
    .quick-save-control button {
        width: 100%;
    }

    .quick-save-control button {
        justify-content: center;
    }

    .change-list .object-tools {
        display: none;
    }

    .model-feed.change-list .object-tools,
    .model-feedentry.change-list .object-tools {
        display: block;
    }

    #changelist-search > div {
        flex-wrap: nowrap;
    }

    #toolbar form #searchbar {
        width: auto;
        min-width: 0;
        flex: 1 1 0;
    }

    #toolbar form input[type="submit"] {
        flex: 0 0 auto;
    }

    #changelist-search .quiet {
        display: none;
    }

    #changelist .actions {
        align-items: stretch;
        padding: 10px;
    }

    #changelist .actions label {
        min-width: 0;
        flex: 1 1 0;
    }

    #changelist .actions select {
        width: 100%;
        flex: 1 1 auto;
    }

    #changelist .actions .button {
        flex: 0 0 auto;
        min-width: 50px;
        margin: 0;
    }

    #changelist .actions span:is(.action-counter, .all, .question, .clear) {
        flex-basis: 100%;
        margin: 3px 0 0;
    }

    .library-selection {
        padding: 3px;
    }

    .entry-card {
        display: block;
    }

    .entry-select {
        position: absolute;
        z-index: 4;
        top: 24px;
        left: 24px;
        width: 31px;
        height: 31px;
        border: 1px solid rgba(255, 255, 255, 0.75);
        border-radius: 50%;
        background: color-mix(in srgb, var(--rd-surface-raised) 92%, transparent);
        box-shadow: 0 3px 12px rgba(40, 32, 20, 0.12);
        backdrop-filter: blur(4px);
    }

    .entry-card-link,
    .entry-card-link:link,
    .entry-card-link:visited {
        display: block;
        padding: 11px;
    }

    .entry-cover {
        width: 100%;
        height: clamp(155px, 43vw, 220px);
        margin-bottom: 15px;
    }

    .entry-star {
        top: 9px;
        right: 9px;
    }

    .entry-copy {
        padding: 0 4px 5px;
    }

    .entry-copy h2 {
        overflow: visible;
        font-size: 1.27rem;
        line-height: 1.17;
        white-space: normal;
    }

    .entry-excerpt {
        font-size: 0.78rem;
        -webkit-line-clamp: 2;
    }

    .entry-open {
        display: none;
    }

    #changelist-filter {
        display: block;
        margin-top: 18px;
    }

    #changelist-filter details {
        border-right: 0;
        border-bottom: 1px solid var(--rd-line-soft);
    }

    .article-back {
        margin-bottom: 22px;
    }

    .article-edit-heading h1 {
        font-size: 2.15rem;
    }

    .model-entry.change-form .object-tools {
        text-align: left;
    }

    .model-entry.change-form fieldset.module > .form-row,
    .model-entry.change-form fieldset.module details > .form-row {
        padding: 15px;
    }

    .model-entry.change-form .aligned label {
        width: 100%;
        padding-bottom: 7px;
    }

    .model-entry.change-form .reading-state .form-multiline {
        gap: 13px;
    }

    .model-entry.change-form .reading-state .checkbox-row label {
        padding: 0;
    }

    .reader-preview {
        padding: 35px 24px 42px;
        font-size: 0.96rem;
        line-height: 1.7;
    }

    .model-entry.change-form .submit-row {
        align-items: stretch;
        flex-direction: column;
    }

    .model-entry.change-form .submit-row input,
    .model-entry.change-form .submit-row a.deletelink {
        width: 100%;
        box-sizing: border-box;
        margin: 0;
        text-align: center;
    }

    .dashboard #content {
        padding-top: 20px;
    }

    .dashboard-hero {
        min-height: 0;
        grid-template-columns: 1fr;
        padding: 34px 24px;
        border-radius: 18px;
    }

    .dashboard-hero h1 {
        font-size: clamp(2.35rem, 12vw, 3.2rem);
    }

    .dashboard-hero-copy > p {
        font-size: 0.86rem;
    }

    .dashboard-stack {
        display: none;
    }

    .dashboard-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-actions a {
        width: 100%;
    }

    .shortcut-card {
        grid-template-columns: 43px minmax(0, 1fr) auto;
        gap: 11px;
        padding: 14px;
    }

    .shortcut-icon {
        width: 43px;
        height: 43px;
    }
}

@media (max-width: 420px) {
    .library-heading p,
    .quick-save-copy p,
    .library-selection > span,
    .entry-excerpt {
        display: none;
    }

    .library-heading {
        margin-bottom: 19px;
    }

    .quick-save-copy h2 {
        font-size: 0.95rem;
    }

    .entry-meta span {
        display: none;
    }

    .entry-meta span:first-child,
    .entry-meta span:last-child {
        display: inline;
    }

    .entry-tags {
        margin-top: 7px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
