/* neja Lager – Stylesheet. Handy zuerst (A-31): große Schaltflächen, Fotos groß, wenig Text. Keine fremden Schriften (A-35). */

:root {
    --brand: #3a3a3a;
    --bg: #f4f4f2;
    --surface: #ffffff;
    --text: #222222;
    --muted: #6b6b6b;
    --line: #dddddb;
    --ok: #2e7d4f;
    --ok-bg: #e7f4ec;
    --warn: #9a5b00;
    --warn-bg: #fff3dc;
    --danger: #b3261e;
    --danger-bg: #fdeceb;
    --info: #1f5f8b;
    --info-bg: #e8f1f8;
    --radius: 10px;
    --tap: 48px;
    font-size: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.45;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: var(--info); }
img { max-width: 100%; }
code { font-family: ui-monospace, Consolas, monospace; background: #efefed; padding: 1px 5px; border-radius: 4px; }
h1, h2 { line-height: 1.2; }
h1 { font-size: 1.5rem; margin: 0 0 .6rem; }
h2 { font-size: 1.15rem; margin: 0 0 .6rem; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* Kopfzeile und Menü */
.topbar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top));
    background: var(--surface); border-bottom: 3px solid var(--brand);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--brand); font-weight: 600; min-height: 40px; }
.brand-logo { height: 30px; width: auto; display: block; }
.brand-name { font-size: 1.05rem; letter-spacing: .02em; }
.nav-desktop { display: none; }
.nav-mobile { position: relative; }
.nav-mobile summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
    min-height: var(--tap); padding: 0 12px; border-radius: var(--radius); font-weight: 600; color: var(--brand);
}
.nav-mobile summary::-webkit-details-marker { display: none; }
.burger, .burger::before, .burger::after { display: block; width: 20px; height: 2px; background: var(--brand); position: relative; }
.burger::before, .burger::after { content: ""; position: absolute; left: 0; }
.burger::before { top: -6px; } .burger::after { top: 6px; }
.nav-mobile nav {
    position: absolute; right: 0; top: calc(100% + 6px); width: min(80vw, 300px);
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,.15); padding: 6px; display: flex; flex-direction: column;
}
.nav-mobile nav a { padding: 12px 14px; border-radius: 8px; text-decoration: none; color: var(--text); min-height: var(--tap); }
.nav-mobile nav a.is-active { background: var(--bg); font-weight: 600; }
.nav-user { padding: 8px 14px 10px; font-size: .85rem; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }

@media (min-width: 960px) {
    .nav-mobile { display: none; }
    .nav-desktop { display: flex; flex-wrap: wrap; gap: 2px; justify-content: flex-end; }
    .nav-desktop a { padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--text); font-size: .95rem; }
    .nav-desktop a.is-active { background: var(--brand); color: #fff; }
    .nav-desktop a:hover:not(.is-active) { background: var(--bg); }
}

/* Inhalt */
.main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 16px; }
.page-title { margin-top: 4px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.page-head .page-title { margin: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card-narrow { max-width: 520px; margin-left: auto; margin-right: auto; }
.footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); font-size: .9rem; border-top: 1px solid var(--line); background: var(--surface); }
.footer a { color: var(--muted); }
.empty { color: var(--muted); font-style: italic; margin: .4rem 0; }
.note { background: var(--bg); border-left: 3px solid var(--line); padding: 6px 10px; margin: 8px 0; border-radius: 4px; white-space: normal; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin: 4px 0; }

/* Hinweise */
.alert { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; border: 1px solid transparent; }
.alert ul { margin: 6px 0; padding-left: 1.2rem; }
.alert-success { background: var(--ok-bg); border-color: #b7dfc6; }
.alert-error { background: var(--danger-bg); border-color: #f2c3c0; }
.alert-warn { background: var(--warn-bg); border-color: #f0d49c; }
.alert-info { background: var(--info-bg); border-color: #bcd5e8; }
.password-box .otp { font-family: ui-monospace, Consolas, monospace; font-size: 1.6rem; letter-spacing: .05em; margin: 6px 0; user-select: all; }

/* Schaltflächen */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: var(--tap); padding: 0 18px; border-radius: var(--radius);
    border: 1px solid var(--line); background: var(--surface); color: var(--text);
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: #bbb; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { filter: brightness(1.15); }
.btn-danger { color: var(--danger); border-color: #e7b3af; }
.btn-warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn-block { width: 100%; }
.btn-big { min-height: 56px; font-size: 1.05rem; }
.btn-small { min-height: 38px; padding: 0 12px; font-size: .9rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
:focus-visible { outline: 3px solid #f0a000; outline-offset: 2px; }

/* Formulare */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .95rem; }
.form-inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 10px 0; }
.form-inline label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .9rem; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=month], select, textarea {
    font: inherit; font-weight: 400; width: 100%; min-height: var(--tap); padding: 10px 12px;
    border: 1px solid #c9c9c6; border-radius: 8px; background: #fff; color: var(--text);
}
textarea { min-height: 80px; resize: vertical; }
input[type=file] { font: inherit; font-weight: 400; }
.form label.check, label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; min-height: var(--tap); }
input[type=checkbox] { width: 24px; height: 24px; flex: none; accent-color: var(--brand); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 0; }
legend { font-weight: 600; padding: 0 6px; }
.filters select { min-width: 160px; }

/* Startseite */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile {
    display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--text); min-height: 90px;
}
.tile-count { font-size: 2rem; font-weight: 700; line-height: 1; color: var(--muted); }
.tile.has-items { border-color: var(--brand); box-shadow: inset 4px 0 0 var(--brand); }
.tile.has-items .tile-count { color: var(--brand); }
.tile-new.has-items { box-shadow: inset 4px 0 0 var(--info); border-color: var(--info); }
.tile-new.has-items .tile-count { color: var(--info); }
.install-hint { border-color: var(--info); background: var(--info-bg); }

/* Listen */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.list-item:last-child { border-bottom: 0; }
.cards-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.row-card {
    display: flex; justify-content: space-between; gap: 12px; padding: 14px; text-decoration: none; color: var(--text);
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-height: 64px;
}
.row-card:hover { border-color: #bbb; }
.row-main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.row-main .small { flex-basis: 100%; }
.row-side { text-align: right; color: var(--muted); flex: none; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0 8px 14px; border-left: 2px solid var(--line); margin-left: 4px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; }
.tabs a { white-space: nowrap; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: .92rem; }
.tabs a.is-active { background: var(--brand); color: #fff; border-color: var(--brand); }
.toc ul { margin: 0; padding-left: 1.2rem; columns: 2 220px; }

/* Status */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--bg); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge-offen { background: var(--info-bg); color: var(--info); border-color: #bcd6ea; }
.badge-angenommen, .badge-teilweise { background: var(--warn-bg); color: var(--warn); border-color: #f0d49c; }
.badge-teilgeliefert { background: #f3e9ff; color: #6a3fa0; border-color: #d9c4f2; }
.badge-erledigt, .badge-eingegangen { background: var(--ok-bg); color: var(--ok); border-color: #b7dfc6; }
.badge-gestrichen, .badge-storniert { background: #eee; color: #777; text-decoration: line-through; }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: #f0d49c; }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: #f2c3c0; }
.state-ok { color: var(--ok); }
.state-warn { color: var(--warn); }
.state-danger { color: var(--danger); font-weight: 700; }

/* Sorten */
.sort-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.sort-card {
    display: flex; gap: 12px; padding: 10px; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); text-decoration: none; color: var(--text); align-items: flex-start;
}
.sort-card.state-warn { border-color: #f0d49c; }
.sort-card.state-danger { border-color: #f2c3c0; }
.sort-photo, .sort-thumb { flex: none; object-fit: cover; border-radius: 8px; background: #ecece9; }
.sort-photo { width: 104px; height: 104px; }
.sort-thumb { width: 56px; height: 56px; }
.sort-photo.is-empty, .sort-thumb.is-empty, .sort-photo-large.is-empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .75rem; text-align: center; }
.sort-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sort-name { font-weight: 600; }
.figures { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: .88rem; color: var(--muted); }
.fig b { color: var(--text); }
.fig-free b { font-size: 1.25rem; }
.sort-detail { display: grid; gap: 16px; }
.sort-photo-large { width: 100%; max-height: 420px; object-fit: contain; border-radius: var(--radius); background: #ecece9; display: block; min-height: 160px; }
@media (min-width: 720px) { .sort-detail { grid-template-columns: minmax(260px, 420px) 1fr; } }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 12px 0; }
.facts div { background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.facts dt { font-size: .8rem; color: var(--muted); }
.facts dd { margin: 0; font-size: 1.25rem; font-weight: 700; }
.facts-wide { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.facts-wide dd { font-size: 1rem; font-weight: 600; }

/* Auswahl- und Abhaklisten */
.pick-list, .check-list { display: flex; flex-direction: column; gap: 8px; }
.pick-row, .check-row {
    display: flex; align-items: center; gap: 12px; padding: 8px 10px; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius);
}
.pick-row.is-picked, .check-row.is-checked { border-color: var(--brand); box-shadow: inset 4px 0 0 var(--brand); }
.pick-info { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 2px; }
.pick-warn { color: var(--danger); font-weight: 600; }
.pick-qty { flex: none; width: 96px; }
.pick-qty input { text-align: center; font-size: 1.15rem; font-weight: 700; }
.check-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; font-weight: 400 !important; flex-direction: row !important; cursor: pointer; }
.check-main input[type=checkbox] { width: 30px; height: 30px; }
.extra-rows { display: flex; flex-direction: column; gap: 8px; }
.extra-row { display: flex; gap: 10px; align-items: center; }
.extra-row label:first-child { flex: 1; }

/* Tabellen */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: .82rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.table .num { text-align: right; white-space: nowrap; }
.table .neg { color: var(--danger); }
.table .pos { color: var(--ok); }
.table tr.is-inactive td { color: var(--muted); }
.table tr.is-deviation td { background: var(--warn-bg); }
.month-nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.month-nav .form-inline { margin: 0; }
.month-nav input[type=month] { width: auto; min-height: 38px; }

/* Installation */
.install-status { font-weight: 600; }
.install-status.is-ok { color: var(--ok); }
.install-steps { display: grid; gap: 12px; }
@media (min-width: 720px) { .install-steps { grid-template-columns: 1fr 1fr; } }
.install-steps .is-current { border-color: var(--brand); box-shadow: inset 4px 0 0 var(--brand); }
.push-status.is-ok { color: var(--ok); font-weight: 600; }
.push-status.is-warn { color: var(--warn); }

@media print {
    .topbar, .footer, .actions, form { display: none !important; }
    body { background: #fff; }
    .card { border: 0; padding: 0; }
}

/* Abhakliste auf schmalen Handys: Name ganz lesbar, Foto klein */
.check-text { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.check-text .sort-name { font-weight: 600; overflow-wrap: break-word; hyphens: auto; }
@media (max-width: 420px) {
    .check-row { gap: 8px; padding: 8px; }
    .check-main { gap: 8px; }
    .check-main .sort-thumb { width: 40px; height: 40px; }
    .check-row .pick-qty { width: 72px; }
}
