/* ============================================================
   DasElektroWerk Bautagebuch - mobile/tablet app shell
   - Top app bar (slim) + bottom tab bar
   - Card-first layout, large touch targets
   - Safe-area insets for iPad / Notch devices
   - No JS dialogs; print-friendly report
   ============================================================ */
:root {
    --brand:        #f48124;
    --brand-dark:   #d96710;
    --brand-light:  #fff1e1;
    --accent:       #e84e32;
    --ink:          #1d1d1f;
    --text:         #2b2b2e;
    --muted:        #6b7280;
    --bg:           #f4f5f7;
    --card:         #ffffff;
    --border:       #e5e7ec;
    --line:         #eef0f3;
    --ok:           #2e7d32;
    --warn:         #b26a00;
    --err:          #c1272d;

    --radius:       14px;
    --radius-sm:    10px;
    --shadow-sm:    0 1px 2px rgba(15, 23, 42, .05);
    --shadow:       0 4px 14px rgba(15, 23, 42, .06);

    --tap:          48px;
    --appbar-h:     88px;
    --tabbar-h:     64px;

    --safe-top:     env(safe-area-inset-top, 0px);
    --safe-bot:     env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0; padding: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: contain;
}

img { max-width: 100%; display: block; }
a   { color: var(--brand-dark); text-decoration: none; }
a:active { opacity: .7; }
h1  { font-size: 1.35rem; margin: 0 0 .25rem 0; color: var(--ink); font-weight: 800; letter-spacing: -0.01em; }
h2  { font-size: 1.05rem; margin: 0 0 .65rem 0; color: var(--ink); font-weight: 700; }
::selection { background: var(--brand-light); color: var(--ink); }

/* ============================================================
   APP SHELL
   ============================================================ */
body.is-app {
    min-height: 100vh;
    padding-top:    calc(var(--appbar-h) + var(--safe-top));
    padding-bottom: calc(var(--tabbar-h) + var(--safe-bot) + 12px);
}

.appbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 30;
    height: calc(var(--appbar-h) + var(--safe-top));
    padding-top: var(--safe-top);
    background: #fff;
    display: grid;
    grid-template-columns: 120px 1fr 64px;
    align-items: center;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.appbar-back, .appbar-brand, .appbar-user {
    display: inline-flex; align-items: center; justify-content: center;
    height: var(--appbar-h);
    color: var(--ink);
}
.appbar-back { width: 64px; }
.appbar-user { width: 64px; }
.appbar-brand { width: 120px; padding-left: .75rem; }
.appbar-back:hover, .appbar-user:hover { background: var(--brand-light); text-decoration: none; }
.appbar-brand img { width: 88px; height: 88px; object-fit: contain; }
@media (min-width: 720px) {
    .appbar-brand img { width: 96px; height: 96px; }
}
.appbar-title {
    text-align: center;
    font-weight: 800; color: var(--ink);
    font-size: 1.02rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    padding: 0 .25rem;
}
.avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .95rem;
}

.tabbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    height: calc(var(--tabbar-h) + var(--safe-bot));
    padding-bottom: var(--safe-bot);
    background: #fff;
    border-top: 1px solid var(--border);
    display: grid; grid-template-columns: repeat(4, 1fr);
    box-shadow: 0 -2px 8px rgba(15, 23, 42, .04);
}
.tabbar-item {
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 600;
    height: var(--tabbar-h);
}
.tabbar-item svg { width: 24px; height: 24px; }
.tabbar-item:hover { text-decoration: none; color: var(--ink); }
.tabbar-item.is-active { color: var(--brand-dark); }
.tabbar-item.is-active svg path { fill: var(--brand); stroke: var(--brand); }

/* ============================================================
   MAIN content
   ============================================================ */
.app-main {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}
@media (min-width: 720px) {
    .app-main { padding: 1.25rem 1.5rem; }
}

.page-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap;
    margin: .25rem 0 1rem;
}
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.back { display: inline-block; color: var(--muted); font-size: .85rem; margin-bottom: .25rem; }
.back:hover { color: var(--brand-dark); }

.muted  { color: var(--muted); }
.small  { font-size: .8rem; }
.center { text-align: center; }

/* ---------- Hero block (only on Home) ---------- */
.hero {
    background: linear-gradient(135deg, #1d1d1f 0%, #2b2c33 100%);
    color: #fff;
    padding: 1.4rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
}
.hero::after {
    content: ""; position: absolute; right: -50px; top: -50px;
    width: 220px; height: 220px; border-radius: 50%;
    background: radial-gradient(circle, rgba(244,129,36,.5) 0%, rgba(244,129,36,0) 70%);
}
.hero h1 { color: #fff; font-size: 1.5rem; }
.hero .muted { color: rgba(255,255,255,.85); }
.cta-row { margin-top: 1rem; display: flex; gap: .5rem; flex-wrap: wrap; position: relative; z-index: 1; }
.hero .btn { background: #fff; color: var(--ink); border-color: #fff; }
.hero .btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.hero .btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.hero .btn-ghost { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.22); }
.hero .btn-ghost:hover { background: rgba(255,255,255,.22); }

/* ---------- Cards ---------- */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}
.card.subtle { box-shadow: none; background: transparent; border: 1px dashed var(--border); }
.card h2 { margin-top: 0; }

.grid-2 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.list { list-style: none; padding: 0; margin: 0; }
.list li + li { border-top: 1px solid var(--line); }
.list-link {
    display: flex; flex-direction: column;
    padding: .85rem .15rem;
    color: var(--text);
    min-height: var(--tap);
}
.list-link:active { background: var(--brand-light); }
.list-title { font-weight: 600; color: var(--ink); }
.list-sub   { color: var(--muted); font-size: .85rem; margin-top: 2px; }

/* ---------- Tile grid (Customers / Projects) ---------- */
.tile-grid {
    display: grid; gap: .75rem;
    grid-template-columns: 1fr;
}
@media (min-width: 540px) { .tile-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 820px) { .tile-grid { grid-template-columns: 1fr 1fr 1fr; } }

.tile {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    color: var(--text);
    box-shadow: var(--shadow-sm);
    transition: transform .08s ease, box-shadow .1s ease;
    min-height: 88px;
    position: relative;
    display: flex; flex-direction: column; gap: .25rem;
    border-left: 4px solid var(--brand);
}
.tile:active { transform: scale(.985); box-shadow: var(--shadow); }
.tile-title { font-weight: 800; font-size: 1.05rem; color: var(--ink); }
.tile-sub   { color: var(--muted); font-size: .85rem; }
.tile-meta  { margin-top: .5rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

.pill {
    display: inline-block;
    background: var(--brand-light);
    color: var(--brand-dark);
    border-radius: 999px;
    padding: .2rem .65rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .02em;
}
.pill-blue { background: #e8efff; color: #2a4ea4; }
.pill-status-open    { background: #eef2ff; color: #3b5bdb; }
.pill-status-active  { background: #fff1e1; color: #d96710; }
.pill-status-paused  { background: #f5f5f5; color: #555; }
.pill-status-done    { background: #e7f6ec; color: #2e7d32; }

/* ---------- Forms ---------- */
.stack { display: flex; flex-direction: column; gap: .9rem; }
.row-2 { display: grid; gap: .8rem; grid-template-columns: 1fr; }
@media (min-width: 520px) { .row-2 { grid-template-columns: 1fr 1fr; } }

label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--muted); }
label > span { font-weight: 600; color: var(--ink); }

input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
input[type="number"], input[type="date"], input[type="file"], input[type="search"],
select, textarea {
    width: 100%;
    font: inherit;
    color: var(--text);
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .85rem .95rem;
    min-height: var(--tap);
    outline: none;
    transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
    appearance: none; -webkit-appearance: none;
    box-shadow: inset 0 1px 0 rgba(15, 23, 42, .02);
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input:hover, select:hover, textarea:hover { border-color: #cdd1d7; }
input:focus, select:focus, textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(244, 129, 36, .18);
    background: #fffdfa;
}
input::placeholder, textarea::placeholder { color: #adb1ba; }

/* Strip Safari/Chrome native search styling */
input[type="search"] {
    -webkit-appearance: none;
    appearance: none;
}
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration { display: none; }

/* File input gets its own button styling */
input[type="file"] {
    padding: .55rem .7rem;
    cursor: pointer;
}
input[type="file"]::-webkit-file-upload-button,
input[type="file"]::file-selector-button {
    background: var(--brand-light);
    color: var(--brand-dark);
    border: none;
    border-radius: 6px;
    padding: .5rem .85rem;
    margin-right: .65rem;
    font: inherit; font-weight: 700;
    cursor: pointer;
}
input[type="file"]::-webkit-file-upload-button:hover,
input[type="file"]::file-selector-button:hover { background: var(--brand); color: #fff; }

/* Native date / number controls a bit nicer */
input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: .55;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

label.check {
    flex-direction: row; align-items: center; gap: .6rem;
    color: var(--ink); font-size: .95rem; font-weight: 500;
}
label.check input { width: auto; min-height: 0; accent-color: var(--brand); }

.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .25rem; }

.btn {
    -webkit-appearance: none; appearance: none;
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .8rem 1.15rem;
    font: inherit; font-weight: 700;
    cursor: pointer;
    min-height: var(--tap);
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    transition: background .1s ease, border-color .1s ease, color .1s ease;
    letter-spacing: .01em;
}
.btn:hover { background: var(--brand-light); border-color: var(--brand); color: var(--brand-dark); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-ghost { background: var(--brand-light); border-color: var(--brand-light); color: var(--brand-dark); }
.btn-ghost:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-sm { padding: .45rem .8rem; font-size: .85rem; min-height: 38px; }
.btn-block { width: 100%; }

/* Floating Action Button */
.fab {
    position: fixed;
    right: 16px;
    bottom: calc(var(--tabbar-h) + var(--safe-bot) + 16px);
    z-index: 25;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 0 1.15rem;
    height: 52px;
    font-weight: 800;
    font-size: .95rem;
    box-shadow: 0 6px 20px rgba(244, 129, 36, .35);
    display: inline-flex; align-items: center; gap: .4rem;
}
.fab:hover { background: var(--brand-dark); text-decoration: none; color: #fff; }
.fab svg { width: 22px; height: 22px; }

/* ---------- Flash ---------- */
.flash {
    padding: .8rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    border: 1px solid;
    font-size: .9rem;
    font-weight: 500;
}
.flash-success { background: #e8f5e9; border-color: #a5d6a7; color: var(--ok); }
.flash-error   { background: #fdecea; border-color: #f5c6c2; color: var(--err); }
.flash-warn    { background: #fff4e0; border-color: #ffd58a; color: var(--warn); }

/* ---------- Section tabs (inside Project detail) ---------- */
.tabs {
    display: flex; gap: .15rem; overflow-x: auto;
    margin: 0 -1rem 1rem -1rem;
    padding: 0 1rem;
    -webkit-overflow-scrolling: touch;
    background: transparent;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    padding: .55rem 1rem;
    color: var(--muted);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 999px;
    white-space: nowrap;
    min-height: 40px;
    display: inline-flex; align-items: center;
    font-weight: 700;
    font-size: .88rem;
}
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.is-active { color: #fff; background: var(--brand); border-color: var(--brand); }
.panel { display: none; }
.panel.is-active { display: block; }

/* ---------- Entry list ---------- */
.entry-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .55rem; }
.entry {
    background: var(--card);
    border-radius: var(--radius);
    padding: .85rem 1rem;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--brand);
}
.entry-head { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .3rem; }
.entry-head strong { color: var(--ink); }
.entry-body { margin: .25rem 0; }
.entry-body.pre { white-space: pre-wrap; }
.entry-meta { font-size: .75rem; margin-top: .4rem; }

/* ---------- Photos ---------- */
.photo-grid {
    display: grid; gap: .65rem;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}
.photo {
    margin: 0;
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--brand);
    display: flex; flex-direction: column;
}
.photo > a { display: block; cursor: zoom-in; }
.photo img { aspect-ratio: 1 / 1; object-fit: cover; width: 100%; background: #f3f4f6; }
.photo figcaption { padding: .55rem .7rem .7rem; font-size: .8rem; color: var(--text); }
.photo-caption { font-weight: 600; color: var(--ink); margin-bottom: .25rem; }
.photo .entry-actions { margin-top: .5rem; }

/* ---------- ToDos ---------- */
.todo-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .45rem; }
.todo {
    display: flex; gap: .65rem; align-items: flex-start;
    background: var(--card);
    border-radius: var(--radius);
    padding: .7rem .85rem;
    box-shadow: var(--shadow-sm);
}
.todo.is-done { background: #fafafb; }
.todo.is-done .todo-title { text-decoration: line-through; color: var(--muted); }
.todo-body { flex: 1; }
.todo-title { font-weight: 700; color: var(--ink); }
.todo-details { color: var(--text); margin: .2rem 0; }
.todo-check { margin: 0; }
.check-btn {
    width: 42px; height: 42px;
    border-radius: 50%;
    border: 2px solid var(--brand);
    background: #fff;
    color: var(--brand);
    font-size: 1.2rem; font-weight: 800;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.todo.is-done .check-btn { background: var(--brand); color: #fff; }

/* ============================================================
   LOGIN
   ============================================================ */
body.is-login {
    background:
        radial-gradient(1200px 600px at 100% -10%, rgba(244,129,36,.18), transparent 60%),
        radial-gradient(1000px 500px at -10% 110%, rgba(232,78,50,.14), transparent 60%),
        #f4f5f7;
    min-height: 100vh;
}
.login-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 2rem 1rem;
}
.login-card {
    width: 100%; max-width: 400px;
    background: var(--card);
    padding: 1.75rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(15, 23, 42, .12);
    text-align: center;
    border-top: 4px solid var(--brand);
}
.login-logo { width: 96px; height: auto; margin: 0 auto .75rem; }
.login-card h1 { font-size: 1.4rem; margin: .25rem 0; }
.login-card .stack { text-align: left; margin-top: 1.1rem; }

/* ============================================================
   REPORT / PRINT
   ============================================================ */
.report {
    background: #fff;
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.report-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap;
    border-bottom: 2px solid var(--brand);
    padding-bottom: 1rem; margin-bottom: 1.25rem;
}
.report-header img { width: 80px; height: 80px; object-fit: contain; }
.report-header h1 { font-size: 1.5rem; }
.report-title-block { flex: 1; }
.report-section { margin: 1.25rem 0; page-break-inside: avoid; }
.report-section h2 {
    border-bottom: 1px solid var(--brand);
    padding-bottom: .3rem;
    color: var(--ink);
    margin-bottom: .75rem;
}
.report-section table {
    width: 100%; border-collapse: collapse; font-size: .9rem;
}
.report-section th, .report-section td {
    text-align: left; padding: .45rem .6rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
.report-section th {
    background: #f7f8fa;
    font-weight: 700; color: var(--ink);
    font-size: .8rem; text-transform: uppercase; letter-spacing: .04em;
}
.report-section tfoot td { font-weight: 800; background: var(--brand-light); color: var(--ink); border-bottom: 0; }
.report-meta { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem 1.5rem; font-size: .9rem; }
.report-meta dt { color: var(--muted); }
.report-meta dd { margin: 0; color: var(--ink); font-weight: 600; }
.report-actions {
    display: flex; gap: .5rem; flex-wrap: wrap;
    margin-bottom: 1rem;
}
.report-photos {
    display: grid; gap: .5rem;
    grid-template-columns: repeat(3, 1fr);
}
.report-photos figure { margin: 0; }
.report-photos img { aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; }
.report-photos figcaption { font-size: .75rem; color: var(--muted); padding: .25rem 0; }
.report-note {
    background: #fafafb;
    border-left: 3px solid var(--brand);
    padding: .65rem .8rem;
    margin: .5rem 0;
    border-radius: 0 6px 6px 0;
}

/* ============================================================
   Searchbar
   ============================================================ */
.searchbar {
    position: relative;
    margin: 0 0 1.1rem;
}
.searchbar input[type="search"] {
    width: 100%;
    height: 52px;
    padding: 0 3rem 0 3rem;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M10 4a6 6 0 1 0 3.8 10.6l4.3 4.3 1.4-1.4-4.3-4.3A6 6 0 0 0 10 4zm0 2a4 4 0 1 1 0 8 4 4 0 0 1 0-8z' fill='%236b7280'/></svg>") no-repeat 1rem center;
    background-size: 20px 20px;
    font-size: 1rem;
    box-shadow: var(--shadow-sm);
}
.searchbar input[type="search"]:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(244, 129, 36, .18), var(--shadow-sm);
    background-color: #fffdfa;
}
.searchbar-clear {
    position: absolute; right: .55rem; top: 50%;
    transform: translateY(-50%);
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--brand-light); color: var(--brand-dark);
    font-weight: 800; font-size: 1.2rem; line-height: 1;
    text-decoration: none;
}
.searchbar-clear:hover { background: var(--brand); color: #fff; text-decoration: none; }

/* ============================================================
   Collapsible "add" form: button at top, form opens below
   ============================================================ */
.add-form { margin: 0 0 1rem; }
.add-form > summary {
    list-style: none;
    cursor: pointer;
    -webkit-appearance: none; appearance: none;
}
.add-form > summary::-webkit-details-marker { display: none; }
.add-form > summary::marker { content: ""; }

.add-form-toggle {
    display: flex; align-items: center; justify-content: center;
    gap: .55rem;
    background: var(--brand);
    color: #fff;
    border-radius: var(--radius);
    padding: .9rem 1.1rem;
    font: inherit; font-weight: 800;
    font-size: 1rem;
    min-height: 52px;
    box-shadow: 0 4px 12px rgba(244, 129, 36, .25);
    transition: background .1s ease, transform .05s ease;
    user-select: none;
}
.add-form-toggle:hover { background: var(--brand-dark); }
.add-form-toggle:active { transform: translateY(1px); }

.add-form .add-icon {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .25);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.1rem; font-weight: 800;
    transition: transform .15s ease;
}
.add-form[open] .add-icon { transform: rotate(45deg); }
.add-form[open] > summary {
    background: var(--ink);
    color: #fff;
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: none;
}
.add-form[open] > summary.add-form-toggle:hover { background: #2b2c33; }

.add-form .add-form-body {
    margin-top: 0;
    border-radius: 0 0 var(--radius) var(--radius);
    border-top: none;
    animation: addFormReveal .18s ease-out;
}
@keyframes addFormReveal {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Inline action buttons inside entries
   ============================================================ */
.entry-actions {
    display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
    margin-top: .55rem;
    font-size: .85rem;
}
.btn-action, .btn-action-danger {
    -webkit-appearance: none; appearance: none;
    display: inline-flex; align-items: center; justify-content: center;
    gap: .25rem;
    padding: .4rem .8rem;
    border-radius: 8px;
    background: var(--brand-light);
    color: var(--brand-dark);
    border: 1px solid transparent;
    font: inherit; font-weight: 700; font-size: .85rem;
    cursor: pointer;
    text-decoration: none;
    line-height: 1;
    min-height: 32px;
}
.btn-action:hover { background: var(--brand); color: #fff; text-decoration: none; }
.btn-action:active { transform: translateY(1px); }

.btn-action-danger {
    background: #fdecea; color: var(--err);
}
.btn-action-danger:hover { background: var(--err); color: #fff; text-decoration: none; }

/* legacy classes still used in a few views map to the new look */
.link        { display: inline-flex; align-items: center; padding: .4rem .8rem;
               border-radius: 8px; background: var(--brand-light); color: var(--brand-dark);
               font-weight: 700; font-size: .85rem; min-height: 32px; }
.link:hover  { background: var(--brand); color: #fff; text-decoration: none; }
.link-danger { background: #fdecea; color: var(--err); }
.link-danger:hover { background: var(--err); color: #fff; }

/* ============================================================
   Inline confirm via <details>
   ============================================================ */
.confirm-inline { display: inline-block; }
.confirm-inline > summary {
    cursor: pointer; list-style: none;
    -webkit-appearance: none;
}
.confirm-inline > summary::-webkit-details-marker { display: none; }
.confirm-inline > summary::marker { content: ""; }
.confirm-form {
    margin-top: .5rem;
    padding: .65rem .8rem;
    background: #fff5f5;
    border: 1px solid #f5c6c2;
    border-radius: var(--radius-sm);
    display: flex; flex-direction: column; gap: .5rem;
}
.confirm-form p { margin: 0; color: var(--err); font-weight: 600; }
.confirm-form input[type="text"], .confirm-form textarea {
    background: #fff; border: 1px solid var(--border);
}
.confirm-form button { align-self: flex-start; }

.btn-danger {
    background: var(--err); color: #fff; border-color: var(--err);
}
.btn-danger:hover { background: #8d1d23; border-color: #8d1d23; color: #fff; }
.btn-danger-ghost {
    background: transparent; border: 1px solid #f5c6c2; color: var(--err);
}
.btn-danger-ghost:hover { background: #fdecea; border-color: var(--err); color: var(--err); }

/* ============================================================
   People rows in time form (Person | Start | Ende | ×)
   ============================================================ */
.people-rows { display: flex; flex-direction: column; gap: .55rem; }
.people-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, auto) 36px;
    gap: .4rem;
    align-items: center;
}
.person-time-range {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: .35rem;
    min-width: 0;
}
.person-time-range input { min-width: 0; }
.person-sep {
    color: var(--muted);
    font-size: .85rem;
    font-weight: 600;
    padding: 0 .1rem;
    user-select: none;
}
@media (min-width: 521px) {
    .person-time-range {
        grid-template-columns: 110px auto 110px;
    }
}
@media (max-width: 520px) {
    .people-row {
        grid-template-columns: minmax(0, 1fr) 36px;
        grid-template-areas:
            "name   remove"
            "times  times";
        row-gap: .45rem;
    }
    .people-row .person-name        { grid-area: name; }
    .people-row .row-remove         { grid-area: remove; }
    .people-row .person-time-range  { grid-area: times; }
}
.people-row input { width: 100%; }
.row-remove {
    -webkit-appearance: none; appearance: none;
    width: 36px; height: 100%;
    min-height: var(--tap);
    border-radius: 8px;
    background: #fdecea; color: var(--err);
    border: 1px solid transparent;
    font-size: 1.2rem; font-weight: 800; line-height: 1;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.row-remove:hover { background: var(--err); color: #fff; }
.people-rows[data-people-rows] .people-row:only-child .row-remove { visibility: hidden; }

.people-row.has-error .person-start,
.people-row.has-error .person-end {
    border-color: var(--err);
    background: #fff5f5;
    box-shadow: 0 0 0 3px rgba(193, 39, 45, .12);
}
.people-row.has-error::after {
    content: "Ende muss nach Start sein";
    grid-column: 1 / -1;
    color: var(--err);
    font-size: .8rem;
    font-weight: 600;
    margin-top: -.15rem;
}

/* ============================================================
   Filter chips (ToDos page)
   ============================================================ */
.filter-bar {
    display: flex; gap: .4rem; overflow-x: auto;
    padding-bottom: .4rem; margin-bottom: .75rem;
    scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
.chip {
    flex: 0 0 auto;
    padding: .45rem .9rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--border);
    color: var(--ink);
    font-weight: 700; font-size: .85rem;
    white-space: nowrap;
    text-decoration: none;
    min-height: 36px;
    display: inline-flex; align-items: center;
}
.chip:hover { background: var(--brand-light); color: var(--brand-dark); text-decoration: none; }
.chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.filter-toggle {
    margin-bottom: 1rem;
    font-size: .85rem;
}
.link-toggle {
    display: inline-flex; align-items: center;
    padding: .3rem .7rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--border);
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
}
.link-toggle:hover { background: var(--brand-light); color: var(--brand-dark); text-decoration: none; }
.link-toggle.is-active { color: var(--ink); }

/* ============================================================
   Material thumbnail
   ============================================================ */
.material-thumb {
    display: block; max-width: 260px;
    border-radius: var(--radius-sm); overflow: hidden;
    margin: 0 0 .5rem;
    box-shadow: var(--shadow-sm);
}
.material-thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

/* ============================================================
   Lightbox (in-page photo preview)
   ============================================================ */
.lightbox {
    position: fixed; inset: 0; z-index: 60;
    background: rgba(15, 15, 18, .92);
    display: none;
    align-items: center; justify-content: center;
    padding: 1rem;
}
.lightbox.is-open { display: flex; }
.lightbox img {
    max-width: 100%; max-height: 90vh;
    border-radius: 6px;
    box-shadow: 0 12px 60px rgba(0, 0, 0, .5);
}
.lightbox-close {
    position: absolute; top: 18px; right: 18px;
    width: 44px; height: 44px; border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, .15);
    color: #fff; font-size: 1.6rem; font-weight: 800;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .28); }

@media print {
    .appbar, .tabbar, .report-actions, .fab { display: none !important; }
    body.is-app { padding: 0 !important; background: #fff; }
    .app-main { padding: 0 !important; max-width: none; }
    .report { box-shadow: none; padding: 0; border-radius: 0; }
    a[href]:after { content: ""; } /* don't print URLs */
    .entry, .card, .tile { box-shadow: none; }
    .report-photos { grid-template-columns: repeat(3, 1fr); }
    .report-photos img { aspect-ratio: 4 / 3; }
    .report-section { break-inside: avoid; }
}
