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

.header-switchers {
    display: flex;
    align-items: center;
    gap: 10px;
}

.account-menu-switchers {
    display: none;
}

.theme-switcher {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    border: 1px solid #e1e7de;
    border-radius: 99px;
    background: #fff;
}

.language-switcher {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border: 1px solid #e1e7de;
    border-radius: 99px;
    background: #fff;
}

.language-switcher button {
    width: 34px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .04em;
}

.language-switcher button:hover {
    background: #f3f6ef;
    color: #263b32;
}

.language-switcher button[aria-pressed="true"] {
    background: #c5ee69;
    color: #233628;
}

.language-switcher button:focus-visible {
    outline: 2px solid #7cab49;
    outline-offset: 1px;
}

.theme-switcher button {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
}

.theme-switcher button:hover {
    background: #f3f6ef;
    color: #263b32;
}

.theme-switcher button[aria-pressed="true"] {
    background: #c5ee69;
    color: #233628;
}

.theme-switcher button:focus-visible {
    outline: 2px solid #7cab49;
    outline-offset: 1px;
}

.theme-switcher svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (max-width: 620px) {
    .header-actions {
        gap: 8px;
    }

    .theme-switcher button {
        width: 30px;
        height: 30px;
    }

    .header-switchers {
        gap: 8px;
    }

    /* Signed-in users find language and theme in the account menu instead. */
    .header-switchers-collapsible {
        display: none;
    }

    .account-menu-switchers {
        display: grid;
        justify-items: start;
        gap: 6px;
        padding: 8px 12px 12px;
        margin-bottom: 4px;
        border-bottom: 1px solid #eef0ea;
    }

    .account-menu-switcher-label {
        color: var(--text-muted);
        font-size: .7rem;
        font-weight: 800;
        letter-spacing: .08em;
        text-transform: uppercase;
    }

    .account-menu-panel .account-menu-switchers form {
        margin: 0;
        padding: 3px;
        border-top: 1px solid #e1e7de;
    }

    .account-menu-panel .account-menu-switchers button {
        display: grid;
        place-items: center;
        width: 34px;
        height: 32px;
        padding: 0;
        border-radius: 50%;
        color: var(--text-muted);
        text-align: center;
    }

    .account-menu-panel .account-menu-switchers .theme-switcher button {
        width: 32px;
    }

    .account-menu-panel .account-menu-switchers button:hover {
        background: #f3f6ef;
        color: #263b32;
    }

    .account-menu-panel .account-menu-switchers button[aria-pressed="true"] {
        background: #c5ee69;
        color: #233628;
    }

    .account-menu-switchers .language-switcher + .account-menu-switcher-label {
        margin-top: 6px;
    }
}

/* Dark theme: set on <html> by js/theme.js, either chosen or taken from the system. */
html[data-theme="dark"] {
    --text-muted: #93a399;
    --text-packed: #808f86;
    --text-green: #a5d752;
    --text-green-muted: #9ab79d;
    color-scheme: dark;
    color: #e6ede8;
    background: #121a17;
}

html[data-theme="dark"] a:hover,
html[data-theme="dark"] .text-button:hover,
html[data-theme="dark"] .site-footer a:hover {
    color: #a5d752;
}

html[data-theme="dark"] .text-button,
html[data-theme="dark"] .admin-stat span {
    color: #dbe6dd;
}

/* Header, navigation and footer */
html[data-theme="dark"] .theme-switcher {
    border-color: #2f3d35;
    background: #1a2420;
}

html[data-theme="dark"] .language-switcher {
    border-color: #2f3d35;
    background: #1a2420;
}

html[data-theme="dark"] .language-switcher button {
    color: #93a399;
}

html[data-theme="dark"] .language-switcher button:hover {
    background: #26332c;
    color: #e6ede8;
}

html[data-theme="dark"] .language-switcher button[aria-pressed="true"] {
    background: #c5ee69;
    color: #233628;
}

html[data-theme="dark"] .theme-switcher button {
    color: #93a399;
}

html[data-theme="dark"] .theme-switcher button:hover {
    background: #26332c;
    color: #e6ede8;
}

html[data-theme="dark"] .theme-switcher button[aria-pressed="true"] {
    background: #c5ee69;
    color: #233628;
}

html[data-theme="dark"] .brand-text strong span,
html[data-theme="dark"] .brand-text .brand-name span,
html[data-theme="dark"] .auth-intro h1 em {
    color: #a5d752;
}

html[data-theme="dark"] .brand-text small,
html[data-theme="dark"] .brand-text > strong {
    color: #8a9b90;
}

html[data-theme="dark"] .top-nav,
html[data-theme="dark"] .site-footer {
    border-color: #26332c;
}

html[data-theme="dark"] .top-nav a {
    color: #8a9b90;
}

html[data-theme="dark"] .top-nav a.active {
    color: #eef4ef;
    border-color: #eef4ef;
}

html[data-theme="dark"] .site-footer {
    color: #8a9b90;
}

/* Headings and muted text */
html[data-theme="dark"] .eyebrow {
    color: #9ab79d;
}

html[data-theme="dark"] .page-heading p,
html[data-theme="dark"] .detail-heading p,
html[data-theme="dark"] .create-card p,
html[data-theme="dark"] .create-option p,
html[data-theme="dark"] .shared-by,
html[data-theme="dark"] .card-meta,
html[data-theme="dark"] .card-progress,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .back-row,
html[data-theme="dark"] .progress-card p,
html[data-theme="dark"] .items-empty,
html[data-theme="dark"] .item-details > summary,
html[data-theme="dark"] .muted,
html[data-theme="dark"] .auth-intro p,
html[data-theme="dark"] .topic-head span,
html[data-theme="dark"] .topic-empty,
html[data-theme="dark"] .ungrouped-section .topic-head h3,
html[data-theme="dark"] .admin-hero p,
html[data-theme="dark"] .admin-stat small,
html[data-theme="dark"] .admin-users-heading p,
html[data-theme="dark"] .admin-empty,
html[data-theme="dark"] .admin-user-date,
html[data-theme="dark"] .account-menu-head small,
html[data-theme="dark"] .avatar-placeholder-note p,
html[data-theme="dark"] .avatar-editor-hint,
html[data-theme="dark"] .avatar-editor-zoom output,
html[data-theme="dark"] .auth-switch,
html[data-theme="dark"] .stack-form label small,
html[data-theme="dark"] .shared-person small,
html[data-theme="dark"] .admin-user-email {
    color: #93a399;
}

html[data-theme="dark"] .fine-print {
    color: #8a9b90;
}

html[data-theme="dark"] .empty-state h3,
html[data-theme="dark"] .account-menu-head strong,
html[data-theme="dark"] .list-card:hover {
    color: #e6ede8;
}

html[data-theme="dark"] .percent {
    color: #a5d752;
}

html[data-theme="dark"] .orbit {
    border-color: #2e4034;
}

html[data-theme="dark"] .suitcase {
    box-shadow: 12px 15px 0 #2a3a2c;
}

/* Cards, forms and buttons */
html[data-theme="dark"] .card {
    background: #1a2420;
    border-color: #28362e;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .25);
}

html[data-theme="dark"] .list-card:hover {
    box-shadow: 0 12px 28px rgba(0, 0, 0, .4);
}

html[data-theme="dark"] input:not([type]),
html[data-theme="dark"] input[type=text],
html[data-theme="dark"] input[type=email],
html[data-theme="dark"] input[type=password],
html[data-theme="dark"] input[type=number],
html[data-theme="dark"] input[type=date],
html[data-theme="dark"] input[type=search],
html[data-theme="dark"] select {
    border-color: #2f3d35;
    background: #141d19;
    color: #e6ede8;
}

html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus {
    border-color: #7cab49;
    box-shadow: 0 0 0 3px #7cab4955;
}

html[data-theme="dark"] input::placeholder {
    color: #6f7f75;
}

html[data-theme="dark"] .button.outline,
html[data-theme="dark"] .button.ghost {
    border-color: #2f3d35;
    background: #1a2420;
    color: #cfe3c8;
}

html[data-theme="dark"] .button.outline:hover {
    border-color: #5c7d4d;
    background: #212d27;
    color: #e6f2df;
}

html[data-theme="dark"] .stack-form label,
html[data-theme="dark"] .avatar-editor-title,
html[data-theme="dark"] .avatar-placeholder-note strong {
    color: #cfdcd2;
}

html[data-theme="dark"] .forgot-link,
html[data-theme="dark"] .auth-switch a,
html[data-theme="dark"] .legal-card a,
html[data-theme="dark"] .field-saved,
html[data-theme="dark"] .fine-print a {
    color: #a5d752;
}

html[data-theme="dark"] .button.danger {
    background: #b4503f;
}

html[data-theme="dark"] .button.danger:hover {
    background: #c75f4d;
}

html[data-theme="dark"] .flash {
    background: #1f3524;
    color: #b6dca6;
}

html[data-theme="dark"] .error-box {
    background: #3a2420;
    color: #f0b3a6;
}

/* Lists, items and progress */
html[data-theme="dark"] .count-pill {
    background: #26362b;
    color: #a9cf9c;
}

html[data-theme="dark"] .type-badge {
    background: #26352b;
    color: #a1c48f;
}

html[data-theme="dark"] .arrow {
    color: #7f9285;
}

html[data-theme="dark"] .progress-track {
    background: #2a372f;
}

html[data-theme="dark"] .items-empty,
html[data-theme="dark"] .item-row,
html[data-theme="dark"] .add-section-form,
html[data-theme="dark"] .bulk-items,
html[data-theme="dark"] .create-option + .create-option,
html[data-theme="dark"] .menu-panel > form + form,
html[data-theme="dark"] .account-menu-head,
html[data-theme="dark"] .account-menu-switchers,
html[data-theme="dark"] .account-menu-panel form,
html[data-theme="dark"] .legal-card section,
html[data-theme="dark"] .admin-user-row,
html[data-theme="dark"] .admin-empty {
    border-color: #26332c;
}

html[data-theme="dark"] .tick {
    border-color: #3b4c41;
    background: #141d19;
    color: #e6ede8;
}

html[data-theme="dark"] .tick.checked {
    border-color: #c5ef66;
    background: #c5ef66;
    color: #20392b;
}

html[data-theme="dark"] .item-quantity {
    color: #a5d752;
}

html[data-theme="dark"] .item-note {
    color: #9fb0a5;
}

html[data-theme="dark"] .field-hint {
    color: #e0b866;
}

html[data-theme="dark"] .item-row.done .item-name {
    color: var(--text-packed);
}

html[data-theme="dark"] .template-bullet {
    background: #3c5a35;
}

html[data-theme="dark"] .item-details > summary:hover,
html[data-theme="dark"] .account-menu-panel a:hover,
html[data-theme="dark"] .account-menu-panel button:hover,
html[data-theme="dark"] .account-menu-panel a.active,
html[data-theme="dark"] .admin-user-menu button:hover {
    background: #26332c;
}

html[data-theme="dark"] .item-popover,
html[data-theme="dark"] .menu-panel,
html[data-theme="dark"] .account-menu-panel {
    border-color: #2f3d35;
    background: #1a2420;
    box-shadow: 0 16px 38px rgba(0, 0, 0, .45);
}

html[data-theme="dark"] .item-tools button {
    color: #b9d0b5;
}

html[data-theme="dark"] .item-tools .danger-link,
html[data-theme="dark"] .danger-link,
html[data-theme="dark"] .admin-user-menu .danger-link,
html[data-theme="dark"] .remove-share,
html[data-theme="dark"] .account-menu-panel button {
    color: #e08a7a;
}

html[data-theme="dark"] .account-menu-panel button:hover,
html[data-theme="dark"] .admin-user-menu .danger-link:hover {
    color: #f0a091;
}

/* Account menu and avatars */
html[data-theme="dark"] .account-menu-trigger {
    border-color: #2f3d35;
    background: #1a2420;
    color: #dbe6dd;
}

html[data-theme="dark"] .account-menu-trigger:hover,
html[data-theme="dark"] .account-menu[open] .account-menu-trigger {
    border-color: #5c7d4d;
    background: #212d27;
}

html[data-theme="dark"] .account-menu-caret {
    border-color: #93a399;
}

html[data-theme="dark"] .account-menu-panel a,
html[data-theme="dark"] .menu-link,
html[data-theme="dark"] .admin-user-menu button {
    color: #dbe6dd;
}

html[data-theme="dark"] .avatar {
    background: #26362b;
    color: #a9cf9c;
}

html[data-theme="dark"] .profile-avatar {
    background: #26362b;
    color: #cfe3c8;
}

html[data-theme="dark"] .profile-avatar.large {
    border-color: #1a2420;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .3);
}

html[data-theme="dark"] .avatar-add-badge {
    border-color: #121a17;
    background: #c5ee69;
    color: #233628;
}

html[data-theme="dark"] .avatar-placeholder-note,
html[data-theme="dark"] .avatar-editor {
    border-color: #2f3d35;
    background: #17211c;
}

html[data-theme="dark"] .avatar-editor-frame {
    background: #2a372f;
    box-shadow: 0 0 0 4px #1a2420, 0 8px 32px rgba(0, 0, 0, .3);
}

html[data-theme="dark"] .avatar-editor-frame:focus-visible {
    box-shadow: 0 0 0 4px #1a2420, 0 0 0 7px #a5d752;
}

html[data-theme="dark"] input[type=file] {
    border-color: #3b4c41;
    background: #141d19;
    color: #cfdcd2;
}

html[data-theme="dark"] input[type=file]::file-selector-button {
    border-color: #2f3d35;
    background: #212d27;
    color: #cfe3c8;
}

html[data-theme="dark"] .account-pending {
    border-color: #2f3d35;
    background: #1f2b24;
    color: #cfe3c8;
}

/* Legal pages */
html[data-theme="dark"] .legal-card p,
html[data-theme="dark"] .legal-card address,
html[data-theme="dark"] .legal-card li {
    color: #cfdcd2;
}

/* Admin area */
html[data-theme="dark"] .admin-user-counts {
    color: #a9bfae;
}

html[data-theme="dark"] .admin-filter a {
    border-color: #2f3d35;
    background: #1a2420;
    color: #b9ccbd;
}

html[data-theme="dark"] .admin-filter a:hover {
    border-color: #5c7d4d;
    background: #212d27;
    color: #e6f2df;
}

html[data-theme="dark"] .admin-filter a.active {
    border-color: #c5ee69;
    background: #c5ee69;
    color: #1d2d29;
}

html[data-theme="dark"] .admin-filter a.active .count-pill {
    background: #1d2d29;
    color: #c5ee69;
}

html[data-theme="dark"] .admin-user-row.is-blocked .avatar,
html[data-theme="dark"] .type-badge.blocked {
    background: #3a2420;
    color: #e08a7a;
}

html[data-theme="dark"] .admin-user-row.is-blocked .admin-user-name strong {
    color: #93a399;
}

html[data-theme="dark"] textarea {
    background: #202d27;
    border-color: #405044;
    color: #e5ece1;
}

html[data-theme="dark"] .archive-notice,
html[data-theme="dark"] .archive-tabs .active {
    background: #2b3d2c;
    border-color: #496346;
    color: #e5ece1;
}

html[data-theme="dark"] .sync-status,
html[data-theme="dark"] .item-meta {
    color: #a8b7a9;
}

html[data-theme="dark"] .bulk-items > summary {
    color: #b5d889;
}

html[data-theme="dark"] .translation-entry {
    border-color: #26332c;
}

html[data-theme="dark"] .translation-filters label,
html[data-theme="dark"] .translation-default strong {
    color: #dbe6dd;
}

html[data-theme="dark"] .translation-default,
html[data-theme="dark"] .translation-source,
html[data-theme="dark"] .translation-entry-actions small,
html[data-theme="dark"] .translation-empty p {
    color: #a8b7a9;
}

.translation-source {
    margin: .55rem 0;
    padding: .55rem .7rem;
    border-left: 3px solid #a7c795;
    background: #f8fbf2;
    color: #526559;
    font-size: .85rem;
}

html[data-theme="dark"] .translation-source {
    border-color: #5c7d4d;
    background: #1f2b24;
}

html[data-theme="dark"] .account-menu-switcher-label {
    color: #93a399;
}

html[data-theme="dark"] .account-menu-panel .account-menu-switchers form {
    border-color: #2f3d35;
}

html[data-theme="dark"] .account-menu-panel .account-menu-switchers button {
    color: #b3c3b8;
}

html[data-theme="dark"] .account-menu-panel .account-menu-switchers button:hover {
    background: #26332c;
    color: #e6ede8;
}

html[data-theme="dark"] .account-menu-panel .account-menu-switchers button[aria-pressed="true"] {
    background: #c5ee69;
    color: #233628;
}

/* Settings sheet on small screens */
@media (max-width: 850px) {
    html[data-theme="dark"] .side-column[popover] {
        background: #121a17;
        box-shadow: 0 -16px 40px rgba(0, 0, 0, .5);
    }

    html[data-theme="dark"] .settings-close {
        border-color: #2f3d35;
        background: #1a2420;
        color: #cfe3c8;
    }
}

/* Group avatars on the overview */
html[data-theme="dark"] .avatar-stack .profile-avatar,
html[data-theme="dark"] .avatar-stack-more {
    box-shadow: 0 0 0 2px #121a17;
}

html[data-theme="dark"] .avatar-stack-more {
    background: #26362b;
    color: #a9cf9c;
}

html[data-theme="dark"] .departure-badge {
    background: #3a2f17;
    color: #f0cf8a;
}

html[data-theme="dark"] .departure-line {
    color: #c9d6cd;
}

html[data-theme="dark"] .list-card .avatar-stack .profile-avatar,
html[data-theme="dark"] .list-card .avatar-stack-more {
    box-shadow: 0 0 0 2px #1a2420;
}

html[data-theme="dark"] .confirm-dialog {
    background: #1a2420;
    color: #e6ede8;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .55);
}

html[data-theme="dark"] .confirm-dialog::backdrop {
    background: rgba(0, 0, 0, .6);
}

html[data-theme="dark"] .item-error {
    color: #e08a7a;
}

html[data-theme="dark"] .drag-handle {
    color: #6f7f75;
}

html[data-theme="dark"] .drag-handle:hover {
    background: #26332c;
    color: #c9d6cd;
}

html[data-theme="dark"] .topic-section.dragging {
    background: #1a2420;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}

html[data-theme="dark"] .item-row.dragging {
    background: #1a2420;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}

html[data-theme="dark"] .flash.toast {
    box-shadow: 0 14px 40px rgba(0, 0, 0, .55);
}

html[data-theme="dark"] .flash-close:hover {
    background: rgba(255, 255, 255, .08);
}

html[data-theme="dark"] .progress-complete {
    background: #1f3524;
}

html[data-theme="dark"] .progress-card .progress-complete p {
    color: #b6dca6;
}

html[data-theme="dark"] .progress-complete strong {
    color: #e6ede8;
}

html[data-theme="dark"] :where(a, button, summary, [tabindex], input[type="checkbox"], input[type="radio"], input[type="file"]):focus-visible {
    outline-color: #a5d752;
}

html[data-theme="dark"] .offline-banner {
    background: #26332c;
    color: #e6ede8;
}

html[data-theme="dark"] .item-row.sync-pending .tick::after {
    box-shadow: 0 0 0 2px #1a2420;
}

html[data-theme="dark"] .password-toggle {
    color: #9fb0a5;
}

html[data-theme="dark"] .password-toggle:hover {
    background: #26332c;
    color: #e6ede8;
}

html[data-theme="dark"] .starter-card {
    border-color: #2f3d35;
    background: #151e1a;
    color: #e6ede8;
}

html[data-theme="dark"] .starter-card:hover {
    border-color: #c5ee69;
}

html[data-theme="dark"] .starter-card small {
    color: #a9cf7c;
}

html[data-theme="dark"] .starter-card span {
    color: #93a399;
}

html[data-theme="dark"] .muted-list li {
    border-top-color: #2a3630;
}

html[data-theme="dark"] .open-filter .check-label {
    border-color: #2f3d35;
    background: #1a2420;
    color: #b7c4bb;
}

html[data-theme="dark"] .open-filter .check-label:hover {
    border-color: #4a5e50;
}

html[data-theme="dark"] .open-filter .check-label:has(input:checked) {
    border-color: #c5ee69;
    background: #c5ee69;
    color: #233628;
}

/* Safe areas: in landscape the page gutter (32 px, 18 px on phones) can be narrower than the camera cut-out.
   Only the part of the inset beyond the gutter is added as body padding. */
body {
    --inset-left: max(0px, calc(env(safe-area-inset-left, 0px) - 32px));
    --inset-right: max(0px, calc(env(safe-area-inset-right, 0px) - 32px));
    padding-left: var(--inset-left);
    padding-right: var(--inset-right);
}

@media (max-width: 620px) {
    body {
        --inset-left: max(0px, calc(env(safe-area-inset-left, 0px) - 18px));
        --inset-right: max(0px, calc(env(safe-area-inset-right, 0px) - 18px));
    }
}

.offline-banner {
    margin-left: calc(-1 * var(--inset-left));
    margin-right: calc(-1 * var(--inset-right));
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
}

.flash.toast {
    width: min(520px, calc(100% - 2 * max(16px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px))));
}

@supports selector(:popover-open) {
    @media (max-width: 850px) {
        .side-column[popover] {
            padding-left: max(16px, env(safe-area-inset-left, 0px));
            padding-right: max(16px, env(safe-area-inset-right, 0px));
        }
    }
}

/* Support page and card */
html[data-theme="dark"] .support-way {
    background: #1a2420;
    border-color: #28362e;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .25);
}

html[data-theme="dark"] .support-way.featured {
    border-color: #6f9a45;
}

html[data-theme="dark"] .support-badge {
    background: #26361f;
    color: #c5ee69;
}
