/* ==========================================================================
   Fotobuch – design system "Foto zuerst" (docs/spec/ui-v3.md, docs/spec/ui-v3-konzept.md sections 3 and 4).
   Tokens -> base -> shell -> components. Components use tokens only (no hex values); pages bring their layout in
   *.razor.css. The building blocks are also Blazor components in src/Fotobuch.Ui (Icon, Button, Chip, ...).
   ========================================================================== */

/* ---------- Fonts: Inter (interface) and Playfair Display (titles), served from this site (OFL, fonts/ui) ----------
   Names of their own: /fonts.css declares the book's TTF files as "Inter" and "Playfair Display" (editor, preview), and
   faces of one name would be combined, so the browser loaded both files. */
@font-face { font-family: "Inter UI"; src: url(fonts/ui/Inter-Regular.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter UI"; src: url(fonts/ui/Inter-SemiBold.woff2) format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Playfair Display UI"; src: url(fonts/ui/PlayfairDisplay-Regular.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

/* ---------- Tokens: light ---------- */
:root {
    color-scheme: light;
    --bg: #f7f6f3;
    --surface: #ffffff;
    --surface-2: #f0eeea;
    --surface-3: #e7e4de;
    --line: #e6e3dd;
    --line-strong: #d3cfc7;
    --ink: #1b1a18;
    --ink-2: #57534c;
    --ink-3: #8b867e;
    /* Zinnober (torii red, Roman terracotta): the one primary button, "im Buch", the active choice. Only for that. */
    --accent: #d6452a;
    --accent-hover: #bf3a21;
    --accent-ink: #ffffff;
    --accent-soft: #fbe9e3;
    --accent-text: #b8391f;
    --good: #1d8a4e;
    --good-soft: #e2f2e8;
    --warn: #a8670f;
    --warn-soft: #fbf0da;
    /* errors: a darker carmine, never the accent, and always shown with an icon (.notice-error, .badge-error) */
    --error: #9b1c3a;
    --error-soft: #f9e3e8;
    --scrim: rgba(17, 16, 15, .55);
    --glass: rgba(247, 246, 243, .82);
    /* dark floating things in both themes: toast, selection bar */
    --inverse: #1f1e1c;
    --inverse-ink: #f6f4ef;
    /* marks on top of photos (the "im Buch" ring) */
    --on-photo: #ffffff;
    /* monograms (initials on a colour, e.g. a print shop without a logo): the mockup's ten muted colours, white text */
    --mono-0: #c8553d; --mono-1: #3d7ea6; --mono-2: #6a8e4e; --mono-3: #8e5aa8; --mono-4: #c08a2e;
    --mono-5: #4f6d7a; --mono-6: #a64d79; --mono-7: #2f8f83; --mono-8: #7a6a4f; --mono-9: #5868b0;
    /* the dark full view (Großansicht, Sichten, Vorschau) is dark in both themes */
    --stage: #0f0f0e;
    --stage-2: #1d1c1a;
    --stage-ink: #f3f1ec;
    --stage-ink-2: #b4afa6;
    --focus: 0 0 0 3px rgba(214, 69, 42, .32);

    --font-ui: "Inter UI", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-display: "Playfair Display UI", Georgia, serif;

    /* exactly seven sizes */
    --fs-xs: .75rem;    /* 12 meta, badges */
    --fs-sm: .8125rem;  /* 13 hints, chips */
    --fs-md: .9375rem;  /* 15 text, buttons */
    --fs-lg: 1.25rem;   /* 20 card titles */
    --fs-xl: 1.625rem;  /* 26 section titles (display) */
    --fs-2xl: 2.25rem;  /* 36 page titles (display) */
    --fs-3xl: 3rem;     /* 48 hero (display) */

    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;
    --r-sm: 8px; --r-md: 12px; --r-lg: 20px; --r-pill: 999px;
    --sh-1: 0 1px 2px rgba(28, 22, 16, .05), 0 0 0 1px rgba(28, 22, 16, .045);
    --sh-2: 0 10px 30px -10px rgba(28, 22, 16, .18), 0 2px 6px rgba(28, 22, 16, .05), 0 0 0 1px rgba(28, 22, 16, .04);
    --sh-3: 0 30px 80px -20px rgba(20, 16, 12, .38), 0 0 0 1px rgba(28, 22, 16, .05);
    --ease: cubic-bezier(.2, .8, .2, 1);
    --t-1: 120ms; --t-2: 220ms; --t-3: 360ms;
    --page-max: 1240px;
    --header-h: 64px;
    /* smallest tap target on touch screens */
    --tap: 44px;
    /* height of the phone bottom bar while it is shown, otherwise 0px; toasts, the selection bar and Knipsi sit above it */
    --bottom-bar-h: 0px;
    /* overlay layers, lowest first */
    --z-header: 40;
    --z-bottom-bar: 50;
    --z-popover: 60;
    --z-selbar: 65;
    --z-mascot: 70;
    --z-sheet: 75;
    --z-lightbox: 78;
    --z-toast: 85;
    --z-chat: 90;
    --z-confirm: 95;

    /* names of the first design (UX v2), kept for page styles that are not restyled yet */
    --paper: var(--bg);
    --ink-soft: var(--ink-2);
    --bad: var(--error);
    --bad-soft: var(--error-soft);
    --radius: var(--r-sm);
    --shadow: var(--sh-2);
}

/* ---------- Tokens: dark (system setting, or chosen in the menu: data-theme on <html>, theme-boot.js) ---------- */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #111110; --surface: #1b1a19; --surface-2: #252422; --surface-3: #302e2b;
        --line: #2e2c29; --line-strong: #403d39;
        --ink: #f3f1ec; --ink-2: #bdb8af; --ink-3: #8d887f;
        --accent: #ff6b4d; --accent-hover: #ff8166; --accent-ink: #1b0b06; --accent-soft: rgba(255, 107, 77, .14); --accent-text: #ff8a70;
        --good: #4cc483; --good-soft: rgba(76, 196, 131, .14); --warn: #e3a948; --warn-soft: rgba(227, 169, 72, .14);
        --error: #f2708d; --error-soft: rgba(242, 112, 141, .14);
        --glass: rgba(17, 17, 16, .78);
        --focus: 0 0 0 3px rgba(255, 107, 77, .4);
        --sh-1: 0 0 0 1px rgba(255, 255, 255, .06);
        --sh-2: 0 12px 32px -8px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .07);
        --sh-3: 0 30px 80px -10px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .08);
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #111110; --surface: #1b1a19; --surface-2: #252422; --surface-3: #302e2b;
    --line: #2e2c29; --line-strong: #403d39;
    --ink: #f3f1ec; --ink-2: #bdb8af; --ink-3: #8d887f;
    --accent: #ff6b4d; --accent-hover: #ff8166; --accent-ink: #1b0b06; --accent-soft: rgba(255, 107, 77, .14); --accent-text: #ff8a70;
    --good: #4cc483; --good-soft: rgba(76, 196, 131, .14); --warn: #e3a948; --warn-soft: rgba(227, 169, 72, .14);
    --error: #f2708d; --error-soft: rgba(242, 112, 141, .14);
    --glass: rgba(17, 17, 16, .78);
    --focus: 0 0 0 3px rgba(255, 107, 77, .4);
    --sh-1: 0 0 0 1px rgba(255, 255, 255, .06);
    --sh-2: 0 12px 32px -8px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .07);
    --sh-3: 0 30px 80px -10px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .08);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
    background: var(--bg); color: var(--ink);
    font: 400 var(--fs-md)/1.55 var(--font-ui);
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
    font-feature-settings: "cv11", "ss01";
}
/* a jump to an anchor (/einstellungen#assistent …) ends below the sticky header; :where keeps it weaker than any
   element's own scroll-margin */
:where([id]) { scroll-margin-top: calc(var(--header-h) + var(--sp-3)); }

h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
h1, h2, .display { font-family: var(--font-display); font-weight: 400; letter-spacing: -.01em; line-height: 1.15; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-family: var(--font-ui); font-size: var(--fs-lg); font-weight: 600; }
p { margin: 0 0 .75em; }
a { color: var(--accent-text); text-underline-offset: 3px; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus); border-radius: var(--r-sm); }
.eyebrow { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.grow { flex: 1; }

@media (max-width: 760px) {
    h1 { font-size: var(--fs-xl); }
    h2 { font-size: var(--fs-lg); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; animation-iteration-count: 1 !important; }
}

/* ---------- Icons (Lucide sprite, <Icon Name="…" />) ---------- */
.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.i-sm { width: 16px; height: 16px; }
.i-lg { width: 24px; height: 24px; }
.i-xl { width: 40px; height: 40px; stroke-width: 1.4; }
.i-fill { fill: currentColor; }

/* ---------- Shell: header ---------- */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }
.app-header {
    position: sticky; top: 0; z-index: var(--z-header); height: var(--header-h);
    display: flex; align-items: center; gap: var(--sp-4); padding: 0 var(--sp-6);
    background: var(--glass); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
    border-bottom: 1px solid var(--line);
}
.app-brand {
    display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; white-space: nowrap;
    font-family: var(--font-display); font-size: 1.375rem;
}
.app-brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.app-brand-mark .i { width: 18px; height: 18px; stroke-width: 2; }
.app-nav { display: flex; gap: 2px; padding: 4px; margin-left: var(--sp-4); background: var(--surface-2); border-radius: var(--r-pill); min-width: 0; }
.app-nav a {
    display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: var(--r-pill);
    color: var(--ink-2); font-weight: 600; font-size: var(--fs-sm); text-decoration: none; white-space: nowrap;
    transition: color var(--t-1), background var(--t-1);
}
.app-nav a:hover { color: var(--ink); }
.app-nav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
.app-nav a .i { width: 18px; height: 18px; }
.app-header-end { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.app-logout-form { display: none; }
/* the editor has one bar instead of this header plus its own (ui-v3-konzept.md 2.1, buch.html): its bar carries the way
   back to Start and the menu; the logout form stays in the page for that menu */
/* --ed-rail-h: the height of the editor's filmstrip (SpreadRail), which Knipsi and the folded photo tray keep clear of */
.app-shell[data-area="editor"] { --header-h: 0px; --ed-rail-h: 112px; }
@media (max-width: 760px) {
    .app-shell[data-area="editor"] { --ed-rail-h: 92px; }
}
.app-shell[data-area="editor"] .app-header { display: none; }
.app-main { flex: 1; min-width: 0; padding: var(--sp-6) var(--sp-6) var(--sp-8); }
/* pages that are not restyled yet keep a readable width; Fotos, the editor and the full views use all of it */
.page { max-width: var(--page-max); margin: 0 auto; }
.app-error { max-width: 40rem; margin: var(--sp-6) auto; }

@media (max-width: 1100px) {
    .app-header { padding: 0 var(--sp-4); gap: var(--sp-3); }
    .app-nav { margin-left: 0; }
    .app-nav a { padding: 0 12px; }
    .app-header .book-pill .book-pill-meta { display: none; }
}

/* ---------- Shell: phone bottom bar and "Mehr" ---------- */
.bottom-bar { display: none; }

@media (max-width: 760px) {
    :root { --header-h: 56px; }
    .app-header { padding: 0 var(--sp-4); }
    .app-header .app-nav, .app-header .book-pill { display: none; }
    .app-brand { font-size: 1.25rem; }
    .app-main { padding: var(--sp-5) var(--sp-4) var(--sp-7); }

    .app-shell.has-bottom-bar { --bottom-bar-h: calc(64px + env(safe-area-inset-bottom, 0px)); }
    .has-bottom-bar .app-main { padding-bottom: calc(var(--bottom-bar-h) + var(--sp-6)); }
    .bottom-bar {
        display: grid; grid-template-columns: repeat(5, 1fr);
        position: fixed; z-index: var(--z-bottom-bar); left: 0; right: 0; bottom: 0; height: var(--bottom-bar-h);
        padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
        background: var(--glass); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
        border-top: 1px solid var(--line);
    }
}
.bottom-item {
    display: grid; justify-items: center; align-content: center; gap: 2px; min-width: 0; min-height: var(--tap);
    padding: 4px 0; border: 0; border-radius: var(--r-md); background: transparent;
    color: var(--ink-3); font-size: 11px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.bottom-item .i { width: 22px; height: 22px; }
.bottom-item[aria-current="page"], .bottom-item.active { color: var(--accent-text); }

.more-backdrop { position: fixed; inset: 0 0 var(--bottom-bar-h) 0; z-index: var(--z-sheet); background: var(--scrim); animation: fade-in var(--t-2) var(--ease); }
.more-sheet {
    position: fixed; left: 0; right: 0; bottom: var(--bottom-bar-h); z-index: var(--z-sheet);
    max-height: calc(100vh - var(--bottom-bar-h) - 24px); overflow-y: auto;
    padding: var(--sp-2) var(--sp-3) var(--sp-3); background: var(--surface);
    border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--sh-3); animation: sheet-up var(--t-3) var(--ease);
}
.more-list { list-style: none; margin: 0; padding: 0; }
.more-sep { height: 1px; margin: var(--sp-2) var(--sp-1); background: var(--line); }
.more-label-group { padding: var(--sp-2) var(--sp-3) var(--sp-1); }
.more-item {
    display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-height: var(--tap);
    padding: var(--sp-2) var(--sp-3); border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink);
    text-align: left; text-decoration: none; cursor: pointer;
}
.more-item .i { color: var(--ink-2); }
.more-item:hover, .more-item.active { background: var(--surface-2); }
.more-item.active .more-label { color: var(--accent-text); }
.more-text { display: flex; flex-direction: column; min-width: 0; }
.more-label { font-weight: 600; }
.more-hint { font-size: var(--fs-sm); color: var(--ink-2); }
.more-check { margin-left: auto; color: var(--accent-text); }

/* ---------- Buttons ---------- */
.btn {
    --h: 40px;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--h); min-height: var(--h);
    padding: 0 18px; border-radius: var(--r-pill); border: 0;
    background: var(--surface-2); color: var(--ink); font-weight: 600; font-size: var(--fs-md); line-height: 1.2;
    white-space: nowrap; text-decoration: none; cursor: pointer;
    transition: background var(--t-1), box-shadow var(--t-1), transform var(--t-1), color var(--t-1);
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: default; transform: none; }
.btn .i { width: 18px; height: 18px; }
/* primary: the one red button of a screen */
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 16px -6px rgba(214, 69, 42, .55); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-tonal { background: var(--surface-2); }
.btn-ghost, .btn-quiet { background: transparent; color: var(--ink-2); }
.btn-ghost:hover, .btn-quiet:hover { background: var(--surface-2); color: var(--ink); }
.btn-dark { background: var(--ink); color: var(--bg); }
.btn-dark:hover { background: var(--ink-2); }
/* destructive actions: carmine text, never the accent */
.btn-danger { color: var(--error); }
.btn-danger:hover { background: var(--error-soft); }
.btn-sm, .btn-small { --h: 32px; padding: 0 12px; font-size: var(--fs-sm); gap: 6px; }
.btn-sm .i, .btn-small .i { width: 16px; height: 16px; }
.btn-lg { --h: 48px; padding: 0 24px; }
.btn-icon { width: var(--h); padding: 0; }
.btn-block { width: 100%; }
.link { color: var(--accent-text); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.link:hover { text-decoration: underline; }
@media (pointer: coarse) {
    .btn-sm, .btn-small { --h: 40px; }
}

/* ---------- Chips and badges ---------- */
.chip {
    display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--r-pill);
    border: 0; background: var(--surface-2); color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap;
    text-decoration: none; cursor: pointer; transition: background var(--t-1), color var(--t-1);
}
.chip:hover { background: var(--surface-3); color: var(--ink); }
.chip[aria-pressed="true"], .chip.is-on { background: var(--ink); color: var(--bg); }
.chip .count { font-weight: 400; opacity: .7; }
.chip .i { width: 16px; height: 16px; }
.badge {
    display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--r-pill);
    font-size: var(--fs-xs); font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
}
.badge .i { width: 13px; height: 13px; stroke-width: 2.2; }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-good { background: var(--good-soft); color: var(--good); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-error, .badge-bad { background: var(--error-soft); color: var(--error); }
.badge-dark, .badge-solid { background: var(--ink); color: var(--bg); }

/* ---------- Segmented choice and tabs ---------- */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: var(--r-pill); max-width: 100%; overflow-x: auto; }
.seg button, .seg a {
    display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border: 0; border-radius: var(--r-pill);
    background: transparent; color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; text-decoration: none;
}
.seg button:hover, .seg a:hover { color: var(--ink); }
.seg [aria-pressed="true"], .seg [aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
.seg .count { font-weight: 400; color: var(--ink-3); }
/* the underline is drawn inside the tab: nothing reaches below the bar, so it never shows a vertical scroll bar */
.tabs { display: flex; gap: var(--sp-5); border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; margin-bottom: var(--sp-5); }
.tab {
    display: inline-flex; align-items: center; gap: 6px; padding: var(--sp-3) 0; border: 0;
    background: none; color: var(--ink-2); font-weight: 600; white-space: nowrap; text-decoration: none; cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.tab .count { font-weight: 400; color: var(--ink-3); }

/* ---------- Cards (never a card inside a card) ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: var(--sp-5); }
.card-flush { padding: 0; overflow: hidden; }
.card-link { transition: box-shadow var(--t-2), transform var(--t-2); }
.card-link:hover { box-shadow: var(--sh-2); transform: translateY(-2px); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.card-title { font-size: var(--fs-lg); font-weight: 600; margin: 0; font-family: var(--font-ui); }
.section { margin-top: var(--sp-7); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.section-head h2 { margin: 0; }
@media (max-width: 760px) {
    .card { padding: var(--sp-4); }
    .card-flush { padding: 0; }
    .section { margin-top: var(--sp-6); }
}

/* ---------- Notices: errors in carmine with an icon, hints in amber ---------- */
.notice { display: flex; align-items: flex-start; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--surface-2); color: var(--ink); }
.notice > .i { margin-top: 2px; }
.notice-error { background: var(--error-soft); color: var(--error); }
.notice-warn { background: var(--warn-soft); color: var(--warn); }
.notice-good { background: var(--good-soft); color: var(--good); }

/* ---------- Progress ---------- */
.meter { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.ring { --p: 0; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-3) 0); }
.ring::after { content: attr(data-label); width: 28px; height: 28px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 10px; font-weight: 600; color: var(--ink-2); }
/* four steps: Fotos · Gestalten · Druckerei · Bestellen; hatched = a proposal of the analysis */
.steps4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.steps4 > i { height: 6px; border-radius: 3px; background: var(--surface-3); }
.steps4 > i.is-done { background: var(--good); }
.steps4 > i.is-now { background: var(--accent); }
.steps4 > i.is-ai { background: repeating-linear-gradient(135deg, var(--accent) 0 3px, var(--accent-soft) 3px 6px); }

/* ---------- "Im Buch" mark: a filled accent circle with a white ring, visible on red motifs too ---------- */
.inbook-mark {
    display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
    background: var(--accent); color: var(--on-photo); box-shadow: 0 0 0 2px var(--on-photo), 0 1px 4px rgba(0, 0, 0, .35);
}
.inbook-mark .i { width: 14px; height: 14px; stroke-width: 2.2; }
.inbook-mark.is-missing { background: rgba(0, 0, 0, .35); border: 1.5px dashed var(--on-photo); box-shadow: none; }

/* ---------- Popover and menu (MenuButton, BookPill) ---------- */
.pop {
    position: absolute; z-index: var(--z-popover); min-width: 220px; max-width: min(360px, calc(100vw - 24px));
    max-height: min(70vh, 32rem); overflow-y: auto; padding: 6px;
    background: var(--surface); border-radius: var(--r-md); box-shadow: var(--sh-3); animation: pop-in var(--t-2) var(--ease);
}
.popover { position: relative; display: inline-block; max-width: 100%; }
.popover > .pop { top: calc(100% + 8px); }
.pop-right { right: 0; }
.pop-left { left: 0; }
.menu-group { padding: 8px 10px 4px; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }

/* ---------- Toast (ToastHost) ---------- */
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* ---------- Scrim, side panel and sheet ---------- */
.scrim { position: fixed; inset: 0; z-index: var(--z-sheet); background: var(--scrim); animation: fade-in var(--t-2) var(--ease); }
.panel {
    position: fixed; z-index: var(--z-sheet); display: flex; flex-direction: column;
    background: var(--surface); color: var(--ink); box-shadow: var(--sh-3); outline: none;
}
.panel-side { top: 12px; right: 12px; bottom: 12px; width: min(420px, calc(100% - 24px)); border-radius: var(--r-lg); animation: slide-in var(--t-3) var(--ease); }
.panel-center {
    left: 50%; top: 50%; width: min(980px, calc(100% - 48px)); max-height: calc(100% - 64px); transform: translate(-50%, -50%);
    border-radius: var(--r-lg); animation: fade-in var(--t-2) var(--ease);
}
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 14px 20px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-family: var(--font-ui); font-size: var(--fs-lg); font-weight: 600; flex: 1; min-width: 0; }
.panel-body { flex: 1; overflow: auto; padding: 20px; }
.panel-foot { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: 12px; border-top: 1px solid var(--line); }
@media (max-width: 760px) {
    .panel-side, .panel-center {
        top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 90%; transform: none;
        border-radius: var(--r-lg) var(--r-lg) 0 0; animation: sheet-up var(--t-3) var(--ease);
    }
    .panel-side { height: 88%; }
}

/* ---------- Floating selection bar (from the first marked photo) ---------- */
.selbar {
    position: fixed; z-index: var(--z-selbar); left: 50%; bottom: calc(var(--bottom-bar-h) + 24px); transform: translateX(-50%);
    display: flex; align-items: center; gap: var(--sp-2); max-width: calc(100vw - 24px); overflow-x: auto;
    padding: 6px 6px 6px 16px; border-radius: var(--r-pill); background: var(--inverse); color: var(--inverse-ink); box-shadow: var(--sh-3);
    animation: toast-in var(--t-3) var(--ease);
}
.selbar-count { font-weight: 600; white-space: nowrap; margin-right: var(--sp-2); }
.selbar .btn { background: rgba(255, 255, 255, .1); color: var(--inverse-ink); }
.selbar .btn:hover { background: rgba(255, 255, 255, .2); }
.selbar .btn-primary { background: var(--accent); color: var(--accent-ink); }
.selbar-sep { width: 1px; align-self: stretch; margin: 6px 2px; background: rgba(255, 255, 255, .18); }

/* ---------- Dark full view (Großansicht; Sichten is the same building block) ---------- */
.lightbox {
    position: fixed; inset: 0; z-index: var(--z-lightbox); display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr auto;
    background: var(--stage); color: var(--stage-ink); color-scheme: dark; outline: none;
}
.lightbox-top { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); }
.lightbox-top > .btn { flex: none; }
.lightbox-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 0 64px; }
.lightbox-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); }
.lightbox-nav.is-prev { left: 12px; }
.lightbox-nav.is-next { right: 12px; }
.lightbox-bottom { grid-column: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4) var(--sp-4); }
.lightbox-aside { grid-row: 2 / 4; grid-column: 2; width: 340px; overflow-y: auto; padding: var(--sp-4); background: var(--stage-2); }
.lightbox .btn { background: rgba(255, 255, 255, .1); color: var(--stage-ink); }
.lightbox .btn:hover { background: rgba(255, 255, 255, .2); }
.lightbox .btn-primary { background: var(--accent); color: var(--accent-ink); }
.lightbox .btn[aria-pressed="true"] { background: var(--stage-ink); color: var(--stage); }
.lightbox .muted { color: var(--stage-ink-2); }
.lightbox-progress { height: 3px; background: rgba(255, 255, 255, .12); grid-column: 1 / -1; }
.lightbox-progress > i { display: block; height: 100%; background: var(--accent); }
@media (max-width: 760px) {
    .lightbox { grid-template-columns: 1fr; }
    .lightbox-stage { padding: 0; }
    .lightbox-aside { display: none; }
    .lightbox-bottom .btn { --h: 44px; }
}

/* ---------- Book object, small cover, book pill ---------- */
.book3d {
    position: relative; aspect-ratio: 297 / 210; border-radius: 3px 8px 8px 3px; overflow: hidden; background: var(--surface-3);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .4) inset, 0 18px 30px -14px rgba(20, 16, 12, .45), 0 4px 8px -2px rgba(20, 16, 12, .18);
}
.book3d img { display: block; width: 100%; height: 100%; object-fit: cover; }
.book3d::before { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--spine, 10px); z-index: 1; background: linear-gradient(90deg, rgba(0, 0, 0, .35), rgba(255, 255, 255, .18) 55%, rgba(0, 0, 0, .12)); }
.book3d::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(115deg, rgba(255, 255, 255, .18), transparent 38%); pointer-events: none; }
.cover-xs { position: relative; width: 40px; height: 28px; flex: none; overflow: hidden; border-radius: 2px 5px 5px 2px; background: var(--surface-3); box-shadow: 0 2px 6px -1px rgba(0, 0, 0, .3); }
.cover-xs img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cover-xs::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; z-index: 1; background: linear-gradient(90deg, rgba(0, 0, 0, .35), rgba(255, 255, 255, .2)); }
.book-pill-wrap { position: relative; min-width: 0; }
.book-pill {
    display: inline-flex; align-items: center; gap: 10px; max-width: 100%; height: 40px; padding: 0 12px 0 6px;
    border: 0; border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--sh-1); color: var(--ink); text-align: left;
}
.book-pill:hover { box-shadow: var(--sh-2); }
.book-pill-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.book-pill-meta { color: var(--ink-3); font-size: var(--fs-sm); white-space: nowrap; }
.book-pill .i { color: var(--ink-3); width: 16px; height: 16px; }
.book-pill.is-large { height: 48px; padding: 0 16px 0 8px; font-size: var(--fs-lg); }
.book-pill.is-large .cover-xs { width: 48px; height: 34px; }
.book-pill.is-empty { color: var(--ink-2); }
.book-menu { width: min(340px, calc(100vw - 24px)); }
.book-opt {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r-sm);
    background: none; color: var(--ink); text-align: left; text-decoration: none; cursor: pointer;
}
.book-opt:hover, .book-opt:focus-visible { background: var(--surface-2); }
.book-opt-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.book-opt-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-opt-meta { font-size: var(--fs-sm); color: var(--ink-3); }
.book-opt-check { color: var(--accent-text); }
.book-opt[aria-checked="false"] .book-opt-check { visibility: hidden; }

/* ---------- Empty states ---------- */
.empty { display: grid; justify-items: center; gap: 10px; padding: var(--sp-7) var(--sp-5); text-align: center; color: var(--ink-2); }
.empty > .i { width: 40px; height: 40px; color: var(--ink-3); stroke-width: 1.4; }

/* ---------- Inputs ---------- */
input[type=text], input[type=password], input[type=search], input[type=number], input[type=date], input[type=time],
input[type=datetime-local], input[type=email], input[type=url], select, textarea {
    width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
    background: var(--surface); color: var(--ink); transition: border-color var(--t-1), box-shadow var(--t-1);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
label { display: block; font-size: var(--fs-sm); color: var(--ink-2); margin: var(--sp-3) 0 var(--sp-1); }
.field { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-3); }
.field input { border: 0; background: transparent; outline: none; box-shadow: none; color: var(--ink); width: 100%; min-height: 0; padding: 0; }
.switch { position: relative; width: 40px; height: 24px; flex: none; border-radius: 12px; border: 0; background: var(--surface-3); transition: background var(--t-1); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform var(--t-2) var(--ease); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(16px); }
kbd { font: 600 11px/1 var(--font-ui); color: var(--ink-3); background: var(--surface-2); padding: 3px 6px; border-radius: 6px; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: var(--sp-4); }
.login-card { width: min(380px, 100%); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-2); padding: var(--sp-6) var(--sp-5); }
.login-card h1 { text-align: center; margin-bottom: var(--sp-1); }
.login-hint { text-align: center; color: var(--ink-2); margin: 0 0 var(--sp-4); }
.login-error { display: flex; gap: var(--sp-2); align-items: flex-start; background: var(--error-soft); color: var(--error); border-radius: var(--r-sm); padding: var(--sp-2) var(--sp-3); margin: 0 0 var(--sp-2); }
.login-remember { display: flex; align-items: center; gap: var(--sp-2); color: var(--ink); font-size: var(--fs-md); margin: var(--sp-4) 0; }
.login-remember input { width: auto; min-height: 0; }
.login-card .btn { width: 100%; }

/* ---------- Blazor error bar ---------- */
#blazor-error-ui {
    display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
    background: var(--error-soft); color: var(--error); padding: var(--sp-2) var(--sp-5); box-shadow: var(--sh-3);
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: var(--sp-3); top: var(--sp-2); }

/* ---------- Motion ---------- */
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes slide-in { from { transform: translateX(calc(100% + 64px)); } }
@keyframes sheet-up { from { transform: translateY(100%); } }

@media print {
    .app-header, .bottom-bar, .selbar, .toast-host { display: none !important; }
}
