/* =========================================================================
   Cardeck – Design-System „Werkstatt-Instrumententafel"
   Dunkel, utilitär, hoher Kontrast. Signal-Orange-Akzent, technische Typo.
   ========================================================================= */

:root {
    /* Flächen – motors.at-nah: warmes Near-Black/Charcoal, flach */
    --bg:          #141414;
    --surface:     #1b1b1b;
    --surface-2:   #232323;
    --surface-3:   #2b2b2b;
    --border:      #333333;       /* Haarlinie */
    --border-strong: #474747;

    /* Text */
    --text:        #f2f2f0;
    --muted:       #9a9a96;        /* motors.at-Grau #919191 */
    --faint:       #6c6c68;

    /* Akzent – Kupfer → Amber (motors.at) */
    --copper:      #ce6f2f;
    --amber:       #ed9512;
    --accent:      #ed9512;        /* primär, hell genug für Kontrast */
    --accent-600:  #ce6f2f;        /* Hover = Kupfer */
    --accent-ink:  #1a1003;        /* dunkle Schrift auf Amber */
    --accent-soft: rgba(237,149,18,.14);
    --accent-glow: rgba(206,111,47,.32);
    --brand-rule:  linear-gradient(90deg, #ce6f2f 0%, #ed9512 100%);

    /* Status (Ampel, hell genug für dunklen Grund) */
    --danger:  #f0453a;  --danger-soft:  rgba(240,69,58,.15);
    --warning: #ed9512;  --warning-soft: rgba(237,149,18,.15);
    --success: #46b66e;  --success-soft: rgba(70,182,110,.15);
    --info:    #0091ce;  --info-soft:    rgba(0,145,206,.16);   /* motors.at-Blau */
    --neutral: #9a9a96;  --neutral-soft: rgba(154,154,150,.15);

    /* Flach & scharfkantig */
    --radius:    5px;
    --radius-sm: 3px;
    --shadow:    none;

    --display: "Saira Condensed", "Arial Narrow", sans-serif;
    --body:    "Saira", system-ui, sans-serif;
    --mono:    "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--body);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background-color: var(--bg);
    /* Blueprint-Gitter: zwei feine Linienraster überlagert */
    background-image:
        linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
        radial-gradient(1100px 460px at 100% -10%, rgba(206,111,47,.07), transparent 60%);
    background-size: 30px 30px, 30px 30px, 100% 100%;
    background-attachment: fixed;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }

.icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* ---------- Typografie ---------- */
h1 {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.7rem;
    letter-spacing: .01em;
    margin: .1rem 0 1rem;
    text-transform: uppercase;
}
h2 {
    font-family: var(--display);
    font-weight: 600;
    font-size: .92rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 1.8rem 0 .7rem;
    display: flex; align-items: center; gap: .55rem;
}
h2::before { /* Akzent-Tick */
    content: ""; width: 14px; height: 3px; border-radius: 2px;
    background: var(--accent); flex-shrink: 0;
}
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* ---------- Topbar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; height: 56px; padding: 0 1rem;
    padding-top: env(safe-area-inset-top);
    background: rgba(13,16,20,.82);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.topbar::after { /* Kupfer→Amber Marken-Linie (Boxengassen-Rule) */
    content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
    background: var(--brand-rule);
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); }
.brand .logo { height: 22px; width: auto; display: block; }
.brand .sub {
    font-family: var(--display); font-weight: 600; font-size: 1.05rem;
    letter-spacing: .16em; text-transform: uppercase; color: var(--text);
    padding-left: .6rem; border-left: 1px solid var(--border-strong);
}
.topbar-right { display: flex; align-items: center; gap: .6rem; }

/* Breadcrumb-Pfad linksbündig über der Überschrift */
.breadcrumb {
    display: flex; flex-wrap: wrap; align-items: center; gap: .3rem;
    margin: -.2rem 0 .8rem;
    font-family: var(--display); font-size: .82rem;
}
.breadcrumb:empty { display: none; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb > span:not(.current) { color: var(--faint); }
.breadcrumb .current { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.topbar .user { color: var(--muted); font-size: .85rem; font-weight: 500; }

/* ---------- Content ---------- */
.content { max-width: 960px; margin: 0 auto; padding: 1.1rem 1rem 6.5rem; }

/* ---------- Bottom-Navigation ---------- */
.bottomnav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    display: flex;
    background: rgba(18,23,30,.92);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a {
    position: relative; flex: 1;
    display: flex; flex-direction: column; align-items: center; gap: .2rem;
    padding: .55rem .25rem .6rem;
    color: var(--faint); font-size: .64rem; font-weight: 600;
    letter-spacing: .06em; text-transform: uppercase;
    transition: color .15s;
}
.bottomnav a:hover { color: var(--muted); }
.bottomnav a.active { color: var(--accent); }
.bottomnav a.active::before {
    content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 30px; height: 2px; border-radius: 0 0 2px 2px; background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

/* ---------- Karten & Listen ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem;
    margin-bottom: .8rem;
    box-shadow: var(--shadow);
}
.card-list { display: flex; flex-direction: column; gap: .55rem; }

.list-item {
    position: relative;
    display: flex; align-items: center; gap: .85rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .8rem .9rem;
    overflow: hidden;
    transition: border-color .15s, transform .15s, background .15s;
}
a.list-item:hover { border-color: var(--border-strong); transform: translateX(2px); background: var(--surface-2); }
.list-item.is-muted { opacity: .5; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; color: var(--text); }
.list-item .sub { color: var(--muted); font-size: .82rem; margin-top: .1rem; }
.list-item .sub .num { color: var(--text); }
.list-item > .chev { color: var(--accent); }
/* „Anzeigen"-Pfeil (orange) in Zeilen mit mehreren Bedienelementen */
.chev-link { display: inline-flex; align-items: center; justify-content: center; color: var(--accent); padding: .15rem .25rem; }
.chev-link:hover { color: var(--accent-strong, var(--accent)); transform: translateX(2px); }

/* Status-Farbstreifen links (Modifier .accent-{farbe}) */
.list-item.accent-danger,  .list-item.accent-warning,
.list-item.accent-success, .list-item.accent-info,
.list-item.accent-accent { padding-left: 1.05rem; }
.list-item[class*="accent-"]::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
}
.list-item.accent-danger::before  { background: var(--danger); }
.list-item.accent-warning::before { background: var(--warning); }
.list-item.accent-success::before { background: var(--success); }
.list-item.accent-info::before    { background: var(--info); }
.list-item.accent-accent::before  { background: var(--accent); }

/* Thumb / Icon-Kachel */
.thumb {
    width: 50px; height: 50px; border-radius: var(--radius-sm); flex-shrink: 0;
    object-fit: cover; background: var(--surface-3);
    display: grid; place-items: center; color: var(--accent);
    border: 1px solid var(--border);
}
/* Foto-Thumbnail in Listen nur am Desktop; mobil bleibt das kompakte Icon. */
.thumb-foto { display: none; }
@media (min-width: 700px) {
    .thumb-foto { display: block; }
    .thumb-icon { display: none; }
}

/* Ersatzteil-Kategorien als Auswahl (Kacheln, am Desktop mehrspaltig) */
.cat-grid { display: grid; grid-template-columns: 1fr; gap: .55rem; }
@media (min-width: 700px) { .cat-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } }
.cat-count { color: var(--muted); font-weight: 400; }
/* „Bei & weiter behalten"-Auswahl über dem Ersatzteil-Formular */
.keep-row { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .9rem; margin: 0 0 .8rem; color: var(--muted); font-size: .85rem; }
.keep-row label { display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; }
.keep-row input { accent-color: var(--accent); }

/* Audit-Log: geänderte Felder (alt → neu) */
.audit-changes { margin-top: .35rem; font-size: .8rem; color: var(--muted); display: grid; gap: .1rem; }
.audit-feld { color: var(--text); }
.audit-alt { color: var(--danger); }
.audit-neu { color: var(--success); }
.livesearch-field { width: 100%; margin-bottom: .8rem; }
.livesearch-field input { flex: 1; }

/* ---------- KPI / Kennzahlen ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; margin-bottom: .4rem; }
/* Auf schmalen Geräten nur 2 KPI-Kacheln (verhindert Zeilenumbruch) */
@media (max-width: 699px) { .kpi.hide-mobile { display: none; } }
.kpi {
    display: flex; align-items: center; gap: .75rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: .85rem .9rem;
}
.kpi .kpi-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.kpi .kpi-val { font-family: var(--display); font-weight: 700; font-size: 1.5rem; line-height: 1; }
.kpi .kpi-lbl { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; }
.kpi.is-danger  .kpi-ico { background: var(--danger-soft);  color: var(--danger); }
.kpi.is-warning .kpi-ico { background: var(--warning-soft); color: var(--warning); }
.kpi.is-accent  .kpi-ico { background: var(--accent-soft);  color: var(--accent); }
.kpi.is-info    .kpi-ico { background: var(--info-soft);    color: var(--info); }

/* ---------- Badges / Status-Pills ---------- */
.badge {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .2rem .6rem; border-radius: 999px;
    font-size: .72rem; font-weight: 700; letter-spacing: .03em;
    white-space: nowrap; border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-info    { background: var(--info-soft);    color: var(--info); }
.badge-muted, .badge-neutral { background: var(--neutral-soft); color: var(--neutral); }
.badge.solid::before { display: none; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .68rem 1.1rem; border-radius: var(--radius-sm); border: 1px solid transparent;
    font-family: var(--body); font-size: .95rem; font-weight: 600; cursor: pointer;
    background: var(--accent); color: var(--accent-ink);
    transition: filter .15s, transform .05s, background .15s, border-color .15s;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: .42rem .72rem; font-size: .82rem; }
.btn-block { display: flex; width: 100%; }
.btn-outline { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--surface-3); filter: none; }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); filter: none; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-success { background: var(--success); color: #06281b; }
.btn-icon { padding: .5rem; }

.btn-fab {
    position: fixed; right: 1rem; bottom: 5.2rem; z-index: 29;
    width: 60px; height: 60px; border-radius: 50%; padding: 0;
    background: var(--accent); color: var(--accent-ink);
    box-shadow: 0 6px 18px var(--accent-glow), 0 0 0 1px var(--accent-600);
}
.btn-fab:hover { filter: brightness(1.07); }
.btn-fab .icon { width: 28px; height: 28px; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: .55rem; align-items: center; margin-bottom: 1rem; }
.toolbar .grow { flex: 1; }

/* Klebende Aktionsleiste für lange Formulare (Titel + Speichern bleiben oben) */
.form-actionbar {
    position: sticky; top: calc(56px + env(safe-area-inset-top)); z-index: 20;
    display: flex; gap: .5rem; align-items: center;
    margin: 0 -1rem 1rem; padding: .55rem 1rem;
    background: rgba(13,16,20,.92); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.form-actionbar h1 { margin: 0; line-height: 1.2; }
.form-actionbar .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form-actionbar .btn { flex: none; }

/* Schmales Handy: Actionbar-Buttons nur als Symbol (Abbrechen = X, Speichern = größerer Haken) */
@media (max-width: 480px) {
    .form-actionbar a.btn,
    .form-actionbar button.btn { font-size: 0; gap: 0; padding-left: .5rem; padding-right: .5rem; }
    .form-actionbar button.btn .icon { width: 22px; height: 22px; }
    .form-actionbar a.btn::before {
        content: ""; width: 22px; height: 22px; background: currentColor;
        -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18'/%3E%3Cpath d='m6 6 12 12'/%3E%3C/svg%3E") center / contain no-repeat;
        mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18'/%3E%3Cpath d='m6 6 12 12'/%3E%3C/svg%3E") center / contain no-repeat;
    }
}
.searchbar { position: relative; flex: 1; }
.searchbar .icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.searchbar input { padding-left: 2.3rem !important; }

/* ---------- Detailansicht ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .15rem 1rem; }
.detail-grid .k { color: var(--faint); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; padding-top: .55rem; }
.detail-grid .v { color: var(--text); font-weight: 600; padding-bottom: .35rem; border-bottom: 1px solid var(--border); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .55rem; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); }

.lede { color: var(--muted); margin: -.4rem 0 1rem; font-size: .9rem; }
.empty {
    text-align: center; color: var(--muted); padding: 2.2rem 1rem;
    border: 1px dashed var(--border-strong); border-radius: var(--radius);
    background: rgba(255,255,255,.012);
}
.empty .icon { color: var(--faint); margin-bottom: .5rem; }
.inline-form { display: inline; }
.muted-link { color: var(--muted); font-size: .85rem; }
.powered { text-align: center; color: var(--faint); font-size: .75rem; letter-spacing: .03em; margin: 1.6rem 0 .4rem; }

/* Drag-&-Drop-Upload */
.dropzone {
    position: relative;
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--muted);
    transition: border-color .15s, background .15s, color .15s;
}
.dropzone:hover { border-color: var(--accent); background: var(--surface-2); }
.dropzone.is-dragover { border-color: var(--accent); background: rgba(237, 149, 18, .1); color: var(--text); }
.dropzone input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone .icon { color: var(--accent); }
.dropzone-text { margin-top: .45rem; font-size: .9rem; }
.dropzone-text strong { color: var(--accent); }
.dropzone-file { margin-top: .5rem; color: var(--text); font-weight: 600; word-break: break-all; }
.dropzone-file:empty { display: none; }

/* Tabs / Subnavigation */
.tabs {
    display: flex; gap: .2rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .25rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
    flex: 1 0 auto;
    display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
    padding: .5rem .7rem;
    border: 0; background: transparent;
    color: var(--muted);
    font-family: var(--display); font-weight: 600; font-size: .9rem;
    border-radius: calc(var(--radius) - 2px);
    white-space: nowrap; cursor: pointer;
    transition: background .15s, color .15s;
}
.tabs button:hover { color: var(--text); }
.tabs button.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.tabs button .icon { color: var(--accent); }
.tab-count {
    font-family: var(--mono); font-size: .72rem; font-weight: 700;
    background: var(--neutral-soft); color: var(--muted);
    padding: .05rem .4rem; border-radius: 999px; min-width: 1.2em; text-align: center;
}
.tabs button.is-active .tab-count { background: var(--surface-2); color: var(--text); }
.tab-count.is-danger { background: var(--danger-soft); color: var(--danger); }

/* Foto-Kacheln mit Kategorie + Löschen */
.photo-tile { position: relative; margin: 0; }
.photo-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; }
.photo-tile figcaption { position: absolute; left: .25rem; bottom: .25rem; right: .25rem; display: flex; flex-wrap: wrap; gap: .2rem; pointer-events: none; }
.photo-tile figcaption .badge { font-size: .62rem; padding: .05rem .35rem; }
.photo-del, .photo-edit {
    position: absolute; top: .25rem;
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; padding: 0;
    border: 0; border-radius: 50%;
    background: rgba(20, 20, 20, .7); color: #fff; cursor: pointer;
}
.photo-del { right: .25rem; }
.photo-edit { right: 2.05rem; text-decoration: none; }
.photo-del:hover { background: var(--danger); }
.photo-edit:hover { background: var(--accent); }

.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .7rem; }
.video-tile { position: relative; margin: 0; }
.video-tile video { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; }
.video-tile figcaption { margin-top: .35rem; display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
.video-tile figcaption .badge { font-size: .62rem; padding: .05rem .35rem; }
.video-tile figcaption .hashtags { color: var(--muted); font-size: .72rem; }
.video-tile .photo-del { top: .25rem; right: .25rem; }
/* Rotations-Icons oben rechts auf dem Foto-Rahmen (Foto bearbeiten) */
.photo-rotate-bar { position: absolute; top: .4rem; right: .4rem; display: flex; gap: .35rem; }
.photo-rotate-bar.left { left: .4rem; right: auto; }
.photo-rotate-bar .photo-ovl { width: 26px; height: 26px; }
.photo-rotate-bar form { margin: 0; }
.photo-ovl {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; padding: 0;
    border: 0; border-radius: 50%;
    background: rgba(20, 20, 20, .65); color: #fff; cursor: pointer;
}
.photo-ovl:hover { background: var(--accent); color: #161616; }

/* Bestätigungsdialog (native <dialog>) */
dialog.modal {
    border: 0; padding: 0; background: transparent;
    width: 420px; max-width: 92vw;
    color: var(--text);
}
dialog.modal::backdrop { background: rgba(0, 0, 0, .62); backdrop-filter: blur(2px); }
.modal-card {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 1.4rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}
.modal-card h3 { font-family: var(--display); font-size: 1.2rem; margin: 0 0 .5rem; }
.modal-card p { color: var(--muted); margin: 0 0 1.3rem; line-height: 1.5; }
.modal-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; margin-bottom: .7rem;
    border-radius: 50%; background: var(--danger-soft); color: var(--danger);
}
.modal-actions { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 380px) { .modal-actions { flex-direction: column-reverse; } .modal-actions .btn { width: 100%; } }
dialog.modal[open] { animation: modal-in .14s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Formulare ---------- */
form .row, .app-form > div { margin-bottom: .95rem; }
form label, .app-form label {
    display: block; font-family: var(--display); font-weight: 600;
    font-size: .82rem; letter-spacing: .05em; text-transform: uppercase;
    color: var(--muted); margin-bottom: .35rem;
}
form input[type=text], form input[type=email], form input[type=password],
form input[type=number], form input[type=date], form input[type=datetime-local],
form input[type=tel], form textarea, form select {
    width: 100%; padding: .68rem .75rem;
    background: var(--surface-2); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font-family: var(--body); font-size: 1rem;
}
form input::placeholder, form textarea::placeholder { color: var(--faint); }
form input:focus, form textarea:focus, form select:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
form textarea { min-height: 96px; resize: vertical; }
form select { appearance: none; background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
    background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 2rem; }

/* Gruppen-Rahmen (Fieldset) mit Titel – z.B. Schlagworte */
.field-group {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: .5rem .85rem .85rem;
    margin: 0 0 .95rem;
    min-width: 0;
}
.field-group > legend {
    padding: 0 .4rem; margin-left: -.25rem;
    font-family: var(--display); font-weight: 600;
    font-size: .82rem; letter-spacing: .05em; text-transform: uppercase;
    color: var(--muted);
}

/* Schlagwort-/Auswahl-Raster: nutzt die Breite je nach Viewport */
.tag-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .35rem .9rem;
}
.tag-grid .field-checkbox { margin: 0; padding: .15rem 0; }

/* Datumsfeld mit „leeren"-Icon in der Label-Zeile */
.date-label { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .35rem; }
.date-label label { margin-bottom: 0; }
.date-clear {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; padding: 0;
    border: 1px solid var(--border); border-radius: 50%;
    background: transparent; color: var(--muted); cursor: pointer;
    flex: 0 0 auto;
}
.date-clear:hover { color: var(--danger); border-color: var(--danger); }

/* Freie Schlagworte als Text (#…), keine Punkt-Badges */
.hashtags { color: var(--muted); font-size: .82rem; word-break: break-word; }
.photo-tile figcaption .hashtags { color: #fff; font-size: .68rem; text-shadow: 0 1px 2px rgba(0, 0, 0, .9); }

/* Filter-Chips (Kategorie-Schnellfilter je Tab) */
.filter-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 .8rem; }
/* Filterleiste: Tag-Suchfeld links + Kategorie-Chips */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0 0 .8rem; }
.filter-bar .filter-chips { margin: 0; }
.tag-search { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px; padding: .25rem .7rem; }
.tag-search svg { color: var(--muted); flex-shrink: 0; }
.tag-search input { background: transparent; border: 0; outline: none; color: var(--text); font-size: .82rem; min-width: 8.5rem; }
.tag-search input::placeholder { color: var(--faint); }
/* Filter-/Sortier-Select in einer .filter-bar (außerhalb <form>) */
.filter-select {
    appearance: none; font: inherit; font-size: .82rem; color: var(--text);
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
    padding: .3rem 1.8rem .3rem .7rem;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 14px) 55%, calc(100% - 9px) 55%;
    background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.filter-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.filter-bar .fb-label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
/* Durchsuchbarer Select (selectfilter-Controller): Lagerort-Picker */
.select-filter { display: flex; flex-direction: column; gap: .45rem; }
.select-filter .tag-search { width: 100%; }
.select-filter .tag-search input { flex: 1; }
.select-filter-list { display: flex; flex-direction: column; gap: .25rem; max-height: 230px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .3rem; background: var(--surface-2); }
.select-filter-item { text-align: left; border: 0; background: transparent; color: var(--text); padding: .45rem .6rem; border-radius: var(--radius-sm); cursor: pointer; font: inherit; }
.select-filter-item:hover { background: var(--surface); }
.select-filter-item.is-chosen { background: var(--accent); color: #161616; font-weight: 600; }
.filter-chip {
    border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
    padding: .25rem .7rem; border-radius: 999px;
    font-family: var(--display); font-weight: 600; font-size: .8rem;
    cursor: pointer; white-space: nowrap; transition: color .12s, border-color .12s, background .12s;
}
.filter-chip:hover { color: var(--text); border-color: var(--border-strong); }
.filter-chip.is-active { background: var(--accent); color: #161616; border-color: var(--accent); }

/* Dokument-Datei: Inline-Vorschau (Bild/PDF) + Aktionsleiste */
.doc-file { margin-bottom: 1rem; }
.doc-preview { display: block; }
.doc-preview img { max-width: 100%; max-height: 70vh; border: 1px solid var(--border); border-radius: var(--radius-sm); display: block; }
.doc-pdf { width: 100%; height: 70vh; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.doc-file-bar { display: flex; align-items: center; gap: .5rem; margin-top: .5rem; flex-wrap: wrap; }
.doc-file-bar .grow { flex: 1; min-width: 0; color: var(--muted); font-size: .85rem; word-break: break-all; }

/* hidden muss display-Regeln (z.B. .field-checkbox{display:flex}) schlagen –
   sonst blenden Stimulus-Controller (reveal/tabs) Flex-/Grid-Elemente nicht aus. */
[hidden] { display: none !important; }

/* Checkbox/Radio: Akzentfarbe */
form input[type=checkbox], form input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); }
.field-checkbox { display: flex; align-items: center; gap: .55rem; }
.field-checkbox label { margin: 0; text-transform: none; letter-spacing: 0; font-family: var(--body); color: var(--text); }
/* Mehrfachauswahl (expanded) – Empfänger-Checkboxen */
.app-form .checkbox { display: inline-flex; align-items: center; gap: .4rem; margin: 0 1rem .4rem 0; }
.app-form .checkbox label { display: inline; margin: 0; text-transform: none; letter-spacing: 0; font-family: var(--body); color: var(--text); font-weight: 500; }

.form-error, .app-form ul {
    color: var(--danger); font-size: .82rem; margin: .3rem 0 0; padding-left: 1.1rem;
    list-style: none;
}
.app-form ul li::before { content: "▸ "; color: var(--danger); }
.help { color: var(--faint); font-size: .82rem; margin-top: .3rem; }

/* ---------- Flash ---------- */
.flash {
    display: flex; align-items: center; gap: .55rem;
    padding: .75rem .9rem; border-radius: var(--radius-sm); margin-bottom: 1rem;
    font-weight: 600; border: 1px solid transparent;
}
.flash-success { background: var(--success-soft); color: var(--success); border-color: rgba(54,211,153,.3); }
.flash-error, .flash-danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(255,82,71,.3); }
.flash-info { background: var(--info-soft); color: var(--info); }

/* ---------- Auth ---------- */
.auth-wrap { max-width: 390px; margin: 9vh auto 0; }
.auth-logo { text-align: center; margin-bottom: 1.6rem; }
.auth-logo .logo { height: 58px; width: auto; }
.auth-logo .name { font-family: var(--display); font-weight: 700; font-size: 1.5rem; letter-spacing: .2em;
    text-transform: uppercase; margin: .9rem 0 .15rem; }
.auth-logo .tag { color: var(--copper); font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; font-style: italic; font-weight: 600; }
.auth-logo .rule { width: 64px; height: 2px; background: var(--brand-rule); margin: .7rem auto 0; }

/* ---------- Eintritts-Animation (gestaffelt) ---------- */
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
    .stagger > * { animation: riseIn .4s both; }
    .stagger > *:nth-child(1) { animation-delay: .02s; }
    .stagger > *:nth-child(2) { animation-delay: .06s; }
    .stagger > *:nth-child(3) { animation-delay: .10s; }
    .stagger > *:nth-child(4) { animation-delay: .14s; }
    .stagger > *:nth-child(5) { animation-delay: .18s; }
    .stagger > *:nth-child(6) { animation-delay: .22s; }
    .stagger > *:nth-child(n+7) { animation-delay: .26s; }
}

@media (min-width: 700px) {
    h1 { font-size: 2rem; }
    .content { padding-top: 1.6rem; }
}
