/* Knowary styles. MudBlazor carries the layout, the theme and its own components; this file covers only what MudBlazor
   has no component for. Every color comes from the theme palette (--mud-palette-*, set in MainLayout.razor), so the
   dark scheme needs no second set of rules (UI-13, UI-15). */
:root {
    color-scheme: light;
    font-family: "Segoe UI", Arial, sans-serif;
    color: #20352e;
    background: #f7f8f4;
    font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--mud-palette-primary); }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 2rem; line-height: 1.2; letter-spacing: -0.02em; font-weight: 600; margin-bottom: 16px; }
h2 { font-size: 1.25rem; letter-spacing: -0.02em; font-weight: 600; }
h3 { font-size: 1.35rem; font-weight: 600; letter-spacing: -0.025em; }
h1:focus, main:focus { outline: none; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
h3[tabindex="-1"]:focus { outline: 3px solid var(--mud-palette-secondary); outline-offset: 4px; }
.dark-mode { color-scheme: dark; color: var(--mud-palette-text-primary); background: var(--mud-palette-background); }
.eyebrow { font-size: .72rem; letter-spacing: .15em; text-transform: uppercase; font-weight: 650; margin-bottom: 20px; }
.skip-link { position: absolute; top: -70px; left: 16px; padding: 12px; background: var(--mud-palette-surface); z-index: 2000; }
.skip-link:focus { top: 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.host-error { margin: 60px auto; padding: 24px; max-width: 850px; }
.host-error-legal { margin-top: 32px; font-size: .9rem; }
#blazor-error-ui { display: none; position: fixed; bottom: 0; width: 100%; z-index: 2000; padding: 16px 48px 16px 20px; background: #fff2cf; color: #503e16; box-shadow: 0 -1px 6px #0002; }
#blazor-error-ui .reload { margin-left: 8px; }
#blazor-error-ui .dismiss { position: absolute; right: 15px; top: 12px; border: 0; background: transparent; font-size: 22px; cursor: pointer; }

/* Shell (UI-13): app bar, drawer, content column, phone navigation. */
.workspace-header { border-bottom: 1px solid var(--mud-palette-lines-default); }
.workspace-header .mud-toolbar { gap: 6px; }
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; color: var(--mud-palette-text-primary); font-size: 1.3rem; font-weight: 650; letter-spacing: -0.04em; text-decoration: none; }
/* UI-27: "Knowary - Beta", the suffix smaller and lighter than the name, in both schemes from the palette. */
.brand-text { white-space: nowrap; }
.brand-beta { font-size: .8rem; font-weight: 500; letter-spacing: 0; color: var(--mud-palette-text-secondary); }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; background: var(--mud-palette-primary); color: var(--mud-palette-primary-text); border-radius: 10px; font-family: Georgia, serif; font-size: 1.6rem; }
.global-search { display: flex; flex: 1; min-width: 0; max-width: 34rem; margin-right: auto; }
.global-search input { width: 100%; min-width: 0; height: 40px; padding: 0 .9rem; border: 1px solid var(--mud-palette-lines-inputs); border-radius: 10px; background: var(--mud-palette-background); color: var(--mud-palette-text-primary); font: inherit; font-size: 1rem; }
.global-search input::placeholder { color: var(--mud-palette-text-secondary); }
.global-search input:focus { border-color: var(--mud-palette-primary); outline: 2px solid var(--mud-palette-primary); outline-offset: 0; }
.session-menu { display: flex; align-items: center; justify-content: flex-end; gap: .6rem; flex-shrink: 0; font-size: .875rem; white-space: nowrap; }
.session-menu form { display: flex; }
/* UI-27: the profile menu (SessionMenu.razor). Its list renders in MudBlazor's popover layer, outside the header. */
.profile-menu-popover .mud-list { min-width: 15rem; }
.profile-menu-identity { display: flex; align-items: center; gap: 8px; padding: 8px 16px 10px; color: var(--mud-palette-text-secondary); font-size: .875rem; }
/* The sign-out form has no visible part; the menu item "Abmelden" submits it. */
.session-menu .profile-menu-signout-form { display: none; }
.session-button { min-height: 40px; padding: .4rem .7rem; border: 1px solid var(--mud-palette-primary); border-radius: 8px; background: transparent; color: var(--mud-palette-primary); cursor: pointer; font: inherit; }
/* A-10 W-25: the hint of a lost sign-in stays in view while the page scrolls; it never covers the input below it. */
.session-expiry-hint { position: sticky; top: 72px; z-index: 5; margin-bottom: 1rem; }
.session-expiry-hint p { margin: 0 0 .5rem; white-space: normal; }
.session-expiry-hint-title { font-weight: 600; }
.app-drawer { border-right: 1px solid var(--mud-palette-lines-default); }
.app-drawer .mud-navmenu { padding: 12px 8px; }
.app-drawer .mud-nav-link { border-radius: 8px; }
/* The content column is at least the viewport high, so the legal links end the page and never float mid-screen. */
.main-column { display: flex; flex-direction: column; min-height: 100dvh; box-sizing: border-box; }
.main-column > .mud-container { flex: 1 0 auto; }
.workspace-footer { padding: 8px 16px 16px; text-align: center; color: var(--mud-palette-text-secondary); font-size: .75rem; }
.workspace-footer a { color: inherit; }
/* Guide P-8 allows the legal links one step away: below md the bottom navigation's page "Mehr" carries them. */
@media (max-width: 959.98px) { .workspace-footer { display: none; } }
/* Phone navigation: fixed to the bottom edge, inside the safe area of a notched phone. */
.phone-nav { position: fixed; left: 0; right: 0; bottom: 0; height: calc(56px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); justify-content: space-around; align-items: stretch; z-index: 1200; }
.phone-nav-item { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 44px; text-decoration: none; color: var(--mud-palette-text-secondary); font-size: .7rem; line-height: 1; }
.phone-nav-item .mud-icon-root { width: 24px; height: 24px; }
.phone-nav-item.phone-nav-item-primary, .phone-nav-item.phone-nav-item-active { color: var(--mud-palette-primary); }
.phone-nav-item.phone-nav-item-active { font-weight: 600; }
.phone-nav-space { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
/* Below MudBlazor's sm the app bar keeps the mark, the search, the theme switch and the sign-in button or profile menu.
   UI-27: there the field is narrow, so while it is focused (search-expanded, MainLayout.razor) it takes the whole bar and
   the other items step aside; leaving the field, Escape or sending the search brings them back. */
@media (max-width: 599.98px) {
    .workspace-header.search-expanded .brand,
    .workspace-header.search-expanded .theme-toggle,
    .workspace-header.search-expanded .session-menu { display: none; }
    .workspace-header.search-expanded .global-search { max-width: none; margin: 0; }
}
@media (min-width: 600px) {
    .global-search { margin-left: 8px; }
}

/* Page header (PageHeader.razor): the page name, its action beside it, at most one sentence below. */
.page-header { margin-bottom: 20px; }
.page-title { margin: 0; overflow-wrap: anywhere; }
.page-header-lead { max-width: 60rem; margin-top: 10px; }

/* Native controls (UI-15). Fields that are plain HTML look like one family and take their colors from the theme;
   MudBlazor's own inputs carry a mud- class and are left alone. */
.page-content :is(input:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"], [type="range"]), select, textarea):not([class*="mud-"]) { min-height: 44px; max-width: 100%; padding: .55rem .8rem; border: 1px solid var(--mud-palette-lines-inputs); border-radius: 8px; background: var(--mud-palette-surface); color: var(--mud-palette-text-primary); font: inherit; }
.page-content :is(input, select, textarea):not([class*="mud-"])::placeholder { color: var(--mud-palette-text-secondary); }
.page-content :is(input:not([type="checkbox"], [type="radio"], [type="file"]), select, textarea):not([class*="mud-"]):focus { border-color: var(--mud-palette-primary); outline: 2px solid var(--mud-palette-primary); outline-offset: 0; }
.page-content :is(input, select, textarea):not([class*="mud-"]):disabled { opacity: .6; }
.page-content :is(input[type="checkbox"], input[type="radio"]):not([class*="mud-"]) { width: 1.1rem; height: 1.1rem; flex-shrink: 0; accent-color: var(--mud-palette-primary); }
/* A label that sits directly before its field on the same line keeps a gap to it. */
.page-content label:has(+ :is(input, select, textarea):not([class*="mud-"])) { display: inline-block; margin-right: 8px; }
/* Fields in a row (field-grid): the label above its field, the fields in equal columns that wrap on a phone. */
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 16px 24px; margin-top: 16px; }
.field-grid .field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.page-content .field-grid .field > label { display: block; margin-right: 0; font-size: .9rem; font-weight: 600; }
.field-grid .field > :is(input, select, textarea) { width: 100%; }
/* An interval (IntervalInput.razor): the number and its unit side by side under one label. */
.interval-input { display: grid; grid-template-columns: minmax(4.5rem, 1fr) minmax(0, 1.6fr); gap: 8px; }
.interval-input > :is(input, select) { width: 100%; min-width: 0; }
/* Disclosure boxes built on <details>: one border, one marker. */
.capture-facet, .library-filters { border: 1px solid var(--mud-palette-lines-inputs); border-radius: 8px; }
.capture-facet summary, .library-filters > summary { cursor: pointer; font-weight: 600; }
.library-filters > summary { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem 1rem; }
.library-filters > summary::after { content: "▾"; }
.library-filters[open] > summary::after { content: "▴"; }
.library-filters > summary span, .library-filter-title span { margin-left: auto; font-weight: 400; color: var(--mud-palette-text-secondary); }
/* Page search (PageSearch.razor): the label above, the field and its button in one row, also on a phone. */
.page-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 10px; row-gap: 6px; max-width: 42rem; margin-bottom: 24px; }
.page-search > label { grid-column: 1 / -1; font-size: .9rem; font-weight: 600; }
.page-search > input { width: 100%; min-width: 0; }
.page-search .mud-button-root { min-height: 44px; }

/* Lists and cards shared by the pages. */
.inbox-list { display: grid; gap: 16px; margin-bottom: 24px; }
.inbox-item.mud-paper, .entry-source-paper.mud-paper { padding: 24px; }
.inbox-item h2 { margin-bottom: 12px; overflow-wrap: anywhere; }
.inbox-item p:last-child { margin-bottom: 0; color: var(--mud-palette-text-secondary); line-height: 1.65; overflow-wrap: anywhere; }
.inbox-date { color: var(--mud-palette-text-secondary); font-size: .8rem; }
.search-thumbnail { float: right; width: 80px; height: 80px; object-fit: cover; border-radius: .4rem; margin-left: .75rem; }
.feature-placeholder.mud-paper { padding: 40px; max-width: 850px; }
/* Empty lists (EmptyState.razor, UI-18): a sentence and the primary action. */
.empty-state { margin-top: 48px; }
.feature-placeholder h2 { margin-top: 24px; }
/* UI-27: the settings' tabs (SettingsTabs.razor) are links with their own addresses; the active one is underlined. */
.settings-tabs { display: flex; flex-wrap: wrap; gap: 0 4px; margin-bottom: 20px; border-bottom: 1px solid var(--mud-palette-lines-default); }
.settings-tab { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; margin-bottom: -1px; border-bottom: 3px solid transparent; color: var(--mud-palette-text-secondary); font-weight: 600; text-decoration: none; white-space: nowrap; }
.settings-tab:hover { color: var(--mud-palette-text-primary); }
.settings-tab.settings-tab-active { color: var(--mud-palette-primary); border-bottom-color: var(--mud-palette-primary); }
.settings-lead { max-width: 60rem; margin-bottom: 20px; }
/* UI-27: the bordered blocks of a settings tab stand apart; before, those of "Meine Daten" touched each other. */
.settings-stack { display: grid; gap: 16px; }
.settings-stack > .feature-placeholder h2:first-child { margin-top: 0; }
.feature-placeholder p { max-width: 650px; color: var(--mud-palette-text-secondary); line-height: 1.8; margin-bottom: 24px; }
.breadcrumb { display: flex; gap: 10px; margin-bottom: 28px; color: var(--mud-palette-text-secondary); font-size: .85rem; }
.entry-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }

/* Overview (Home.razor, UI-16): the person's own state in three blocks. */
.overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.overview-card.mud-paper { padding: 20px 24px; min-width: 0; }
.overview-card-wide { grid-column: 1 / -1; }
.overview-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.overview-card-head h2 { margin: 0; }
.overview-note { margin-bottom: 12px; color: var(--mud-palette-text-secondary); }
.overview-list { list-style: none; margin: 0 0 8px; padding: 0; }
.overview-list li { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--mud-palette-lines-default); }
.overview-list li:last-child { border-bottom: 0; }
.overview-list a { min-width: 0; overflow-wrap: anywhere; text-decoration: none; font-weight: 500; }
.overview-list a:hover { text-decoration: underline; }
.overview-list time { flex-shrink: 0; color: var(--mud-palette-text-secondary); font-size: .8rem; }
.overview-card .mud-button-text { margin-left: -8px; }
@media (max-width: 959.98px) {
    .overview-grid { grid-template-columns: 1fr; }
    .feature-placeholder.mud-paper { padding: 28px; }
}

/* Capture and edit. */
.editor-paper.mud-paper { margin-top: 24px; overflow: hidden; }
.editor-paper > .mud-input-control { margin: 20px 24px; }
.capture-save-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 24px; border-top: 1px solid var(--mud-palette-lines-default); }
.capture-save-actions .mud-alert { width: 100%; }
.capture-organize-panel { padding: 1.25rem 1.5rem; border-top: 1px solid var(--mud-palette-lines-default); }
.capture-organize-panel > p { margin: .35rem 0 1rem; }
.capture-facets { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; margin: 1rem 0; }
.capture-facet { min-width: 0; padding: .65rem; }
.capture-facet > label { display: block; font-weight: 600; margin-top: .75rem; }
.capture-facet > input { width: 100%; margin-block: .5rem; }
.capture-facet-list { display: flex; flex-direction: column; gap: .45rem; max-height: 12rem; overflow-y: auto; padding: .65rem; border: 1px solid var(--mud-palette-lines-default); border-radius: 8px; }
.capture-facet-list label { display: flex; align-items: start; gap: .5rem; overflow-wrap: anywhere; }
.capture-organization { flex-basis: 100%; }
.capture-new-values { display: grid; gap: .75rem; max-width: 36rem; margin-block: 1rem; padding: 1rem; border: 1px solid var(--mud-palette-lines-inputs); border-radius: 8px; }
.capture-new-values-title { margin: 0; font-weight: 600; }
.capture-organize-panel select, .entry-categories select { width: 100%; max-width: 36rem; }
.capture-editor { display: flex; flex-direction: column; }
.editor-toolbar { order: -1; display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 16px; background: var(--mud-palette-background-gray); border-bottom: 1px solid var(--mud-palette-lines-default); }
.editor-toolbar button { min-height: 40px; min-width: 40px; padding: 6px 10px; border: 1px solid var(--mud-palette-lines-inputs); border-radius: 6px; background: var(--mud-palette-surface); color: var(--mud-palette-primary); font: inherit; cursor: pointer; }
.editor-toolbar button:disabled { opacity: .45; cursor: default; }
.editor-toolbar button:hover:enabled { background: var(--mud-palette-action-default-hover); }
.editor-toolbar select { min-height: 40px; padding: 6px 8px; border: 1px solid var(--mud-palette-lines-inputs); border-radius: 6px; background: var(--mud-palette-surface); color: var(--mud-palette-primary); font: inherit; cursor: pointer; }
.editor-toolbar select:disabled { opacity: .45; cursor: default; }
/* The content rules below apply to the editor and to the read-only view of an entry alike (tst01 check, 2026-11-16). */
.editor-surface { overflow-x: auto; }
.editor-surface .ProseMirror { min-height: 330px; padding: 28px; line-height: 1.75; overflow-wrap: anywhere; white-space: pre-wrap; }
.editor-surface .ProseMirror:focus { outline: 2px solid var(--mud-palette-primary); outline-offset: -2px; }
.editor-surface .ProseMirror > :last-child { margin-bottom: 0; }
.editor-surface .ProseMirror h1 { font-size: 2rem; }
.editor-surface .ProseMirror h2 { font-size: 1.5rem; }
.editor-surface .ProseMirror h3 { font-size: 1.25rem; }
.editor-surface ul, .editor-surface ol, .entry-markdown-view ul, .entry-markdown-view ol { padding-left: 28px; }
.editor-surface ul, .entry-markdown-view ul { list-style: disc; }
.editor-surface ol, .entry-markdown-view ol { list-style: decimal; }
.editor-surface blockquote, .entry-markdown-view blockquote { margin: 16px 0; padding: 4px 18px; border-left: 3px solid var(--mud-palette-lines-inputs); color: var(--mud-palette-text-secondary); }
.editor-surface pre, .entry-markdown-view pre { overflow-x: auto; padding: 16px; border-radius: 6px; background: var(--mud-palette-background-gray); white-space: pre; }
.editor-surface code, .entry-markdown-view code { font-family: Consolas, monospace; background: var(--mud-palette-background-gray); padding: 2px 4px; border-radius: 3px; }
.editor-surface table, .entry-markdown-view table { border-collapse: collapse; width: 100%; margin-block: 16px; }
.editor-surface td, .editor-surface th, .entry-markdown-view td, .entry-markdown-view th { min-width: 70px; padding: 8px; border: 1px solid var(--mud-palette-lines-inputs); }
.editor-surface th, .entry-markdown-view th { background: var(--mud-palette-background-gray); }
.editor-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 20px 24px; border-top: 1px solid var(--mud-palette-lines-default); }
.editor-import { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: .85rem; }
.editor-import input { max-width: 100%; font: inherit; }
.editor-import input::file-selector-button { min-height: 40px; border: 1px solid var(--mud-palette-lines-inputs); border-radius: 6px; background: var(--mud-palette-background-gray); color: var(--mud-palette-primary); padding: 8px 12px; cursor: pointer; }
.editor-count { margin-left: auto; color: var(--mud-palette-text-secondary); font-size: .8rem; }
.editor-help, .editor-error { padding: 0 24px; font-size: .82rem; line-height: 1.65; }
.editor-help { color: var(--mud-palette-text-secondary); }
/* 2026-11-17: the status ("Inhalt geändert.") stands apart from the help text, right below the editor actions. */
.editor-status { width: fit-content; max-width: calc(100% - 48px); margin: .75rem 24px; padding: .35rem .75rem; border-radius: 6px; background: color-mix(in srgb, var(--mud-palette-primary) 12%, transparent); color: var(--mud-palette-primary); font-size: .875rem; font-weight: 600; }
.editor-status:empty { display: none; }
.editor-error, .unsupported-image { color: var(--mud-palette-error); }
@media (max-width: 599.98px) {
    .editor-surface .ProseMirror { padding: 20px; min-height: 280px; }
    .editor-actions { padding: 16px; }
    .editor-import { min-width: 0; width: 100%; }
    .editor-count { margin-left: 0; }
}

/* Entry detail (UI-17): the text first; state and organization beside it from lg up, below it otherwise. */
.entry-layout { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "content" "side" "extra"; }
.entry-content { grid-area: content; min-width: 0; }
.entry-side { grid-area: side; display: grid; gap: 16px; align-content: start; min-width: 0; }
.entry-extra { grid-area: extra; min-width: 0; }
.entry-side-card.mud-paper { padding: 16px 20px; min-width: 0; }
.entry-side-card > :first-child { margin-top: 0 !important; }
.entry-side-card select { max-width: 100%; }
@media (min-width: 1280px) {
    /* The second row takes the height the side column adds, so learning and quiz follow the text directly. */
    .entry-layout { grid-template-columns: minmax(0, 1fr) 22rem; grid-template-rows: auto 1fr; grid-template-areas: "content side" "extra side"; }
}
.entry-source-paper { margin-bottom: 24px; }
.entry-source { margin-bottom: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.75; }
.entry-detail h1 { overflow-wrap: anywhere; }
.entry-images { margin: 1.5rem 0; }
.entry-image-attachment { display: flex; align-items: center; gap: .75rem; margin: .5rem 0; }
.entry-inline-image { max-width: 100%; height: auto; border-radius: .4rem; }
.entry-markdown-view { line-height: 1.6; }
.entry-raw-markdown { white-space: pre-wrap; overflow-wrap: anywhere; overflow-x: auto; }

/* Library filters: one closed box below the search; opened, the category and tag pickers sit side by side. */
.library-filters { max-width: 42rem; margin: -8px 0 28px; }
.library-filters-body { display: flex; flex-direction: column; gap: 20px; padding: 12px 16px 16px; border-top: 1px solid var(--mud-palette-lines-default); }
.library-filter + .library-filter { padding-top: 16px; border-top: 1px solid var(--mud-palette-lines-default); }
.library-filter-title { display: flex; gap: 1rem; margin: 0 0 .5rem; font-size: 1rem; font-weight: 600; }
.library-filter { min-width: 0; }
.library-filter-options { display: flex; flex-direction: column; align-items: flex-start; gap: .6rem; max-height: 20rem; overflow-y: auto; }
.library-filter-options > input { width: 100%; }
.library-filter-option { display: flex; align-items: start; gap: .5rem; overflow-wrap: anywhere; }

/* Tags, categories, sets. */
.category-view-toggle { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 20px; }
.tag-create { margin-bottom: 24px; }
.tag-create-controls, .tag-edit-controls { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; max-width: 34rem; }
.tag-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-create-controls .mud-input-control, .tag-edit-controls .mud-input-control { width: 100%; }
.tag-create-controls .mud-button-root, .tag-actions .mud-button-root { min-height: 40px; }
.set-entry-picker { margin-block: 20px; padding: 20px; border: 1px solid var(--mud-palette-lines-default); border-radius: 10px; }
.set-entry-search { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 18px; }
.set-entry-search .mud-input-control { min-width: min(100%, 18rem); flex: 1; }
.set-entry-choices { display: flex; flex-wrap: wrap; gap: 8px; max-height: 15rem; overflow-y: auto; }

/* One look for controls (tst01 check, 2026-11-16). Buttons share shape and height; on a phone the filled and outlined
   ones span the content width and stack. Kept side by side there: the search row, the 1-to-5 ratings and the list or
   tree switch. Text buttons stay link-like. MudBlazor's capitals are off in the theme (MainLayout). */
main .mud-button-root:not(.mud-icon-button) { min-height: 40px; border-radius: 8px; }
main :is(h2, h3, h4):not(.page-title) { margin-bottom: 12px; }
main :is(p, .mud-typography) + .mud-button-root { margin-top: 8px; }
main .mud-button-root + .mud-button-root { margin-inline-start: 8px; }
main :is(.entry-actions, .tag-actions, .card-actions, .capture-save-actions, .editor-actions, .rating-scale div, .category-view-toggle, .page-search, .overview-card-head) .mud-button-root + .mud-button-root { margin-inline-start: 0; }
main :is(p, label) + :is(input[type=file], select) { margin-top: 8px; }
main label + select { display: block; }
main select { min-height: 40px; max-width: 100%; padding: 6px 10px; border: 1px solid var(--mud-palette-lines-inputs); border-radius: 8px; background: var(--mud-palette-surface); color: var(--mud-palette-text-primary); font: inherit; }
main input[type=file] { max-width: 100%; color: var(--mud-palette-text-secondary); font: inherit; }
main input[type=file]::file-selector-button { min-height: 40px; margin-inline-end: 10px; padding: 6px 14px; border: 1px solid var(--mud-palette-primary); border-radius: 8px; background: transparent; color: var(--mud-palette-primary); font: inherit; cursor: pointer; }
.rating-scale > .mud-typography-subtitle2 { margin-bottom: 6px; }
.rating-scale > .mud-typography-caption { display: block; margin-top: 6px; }

/* Forms and card editors: fields one below the other at one distance, actions as one group. */
.form-stack { display: grid; gap: 12px; max-width: 36rem; justify-items: start; }
.form-stack > :is(h2, .mud-input-control, select, .mud-alert) { justify-self: stretch; margin: 0; }
.card-controls { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; max-width: 34rem; margin-top: 8px; }
.card-controls > :is(.mud-input-control, select) { align-self: stretch; margin: 0; }
.card-controls > label + select { margin-top: -4px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Image attachments of an entry: equal tiles, the name below; a tile opens the full image. */
.entry-image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.entry-image-grid a { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; }
.entry-image-grid img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--mud-palette-lines-default); border-radius: 8px; background: var(--mud-palette-background-gray); }
.entry-image-grid a:hover img, .entry-image-grid a:focus-visible img { border-color: var(--mud-palette-primary); }
.entry-image-name { overflow: hidden; color: var(--mud-palette-text-secondary); font-size: .85rem; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 599.98px) {
    main .mud-button-root:not(.mud-icon-button) { min-height: 44px; }
    main .mud-button-root:is(.mud-button-filled, .mud-button-outlined) { width: 100%; }
    main :is(.page-search, .rating-scale, .category-view-toggle) .mud-button-root { width: auto; }
    main :is(.entry-actions, .tag-actions, .card-actions) .mud-button-root { flex: 1 1 100%; }
    main .mud-button-root + .mud-button-root { margin-inline-start: 0; margin-top: 8px; }
    main :is(.entry-actions, .tag-actions, .card-actions, .capture-save-actions, .editor-actions, .rating-scale div, .category-view-toggle, .page-search) .mud-button-root + .mud-button-root { margin-top: 0; }
    .form-stack { justify-items: stretch; }
    .card-controls { align-items: stretch; }
    .capture-save-actions { padding: 16px; }
    .entry-image-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
