/* ==========================================================================
   EventManager – Oberfläche (mobile first, ohne Framework)
   ========================================================================== */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-50: #eef2ff;
  --success: #16a34a; --success-50: #dcfce7;
  --warning: #d97706; --warning-50: #fef3c7;
  --danger: #dc2626;  --danger-50: #fee2e2;
  --info: #2563eb;    --info-50: #dbeafe;
  --sidebar: #0f172a;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #1e293b;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, .18);
  --sidebar-w: 248px;
  --topbar-h: 58px;
  --bottom-h: 62px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120; --surface: #111827; --surface-2: #0f172a; --border: #1f2937; --text: #e5e7eb; --muted: #94a3b8;
    --primary-50: #1e1b4b; --success-50: #052e16; --warning-50: #3a2604; --danger-50: #3b0a0a; --info-50: #0b1e44;
    --sidebar: #020617; --sidebar-active: #111827; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1120; --surface: #111827; --surface-2: #0f172a; --border: #1f2937; --text: #e5e7eb; --muted: #94a3b8;
  --primary-50: #1e1b4b; --success-50: #052e16; --warning-50: #3a2604; --danger-50: #3b0a0a; --info-50: #0b1e44;
  --sidebar: #020617; --sidebar-active: #111827; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; }
pre { background: var(--surface-2); border: 1px solid var(--border); padding: .75rem; border-radius: var(--radius-sm); overflow-x: auto; }
.icon { width: 1.15em; height: 1.15em; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: -.2em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; } .skip-link:focus { left: 1rem; top: 1rem; z-index: 999; background: var(--surface); padding: .5rem 1rem; }
.muted { color: var(--muted); } .small { font-size: .85em; } .nowrap { white-space: nowrap; }
.text-right { text-align: right; } .text-center { text-align: center; }
.text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-warning { color: var(--warning); }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.flex { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; } .flex-1 { flex: 1; } .gap-sm { gap: .25rem; } .between { justify-content: space-between; }
.stack > * + * { margin-top: 1rem; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Layout ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; z-index: 60; transform: translateX(-100%); transition: transform .2s ease; overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom);
}
body.sidebar-open .sidebar { transform: none; }
.backdrop { position: fixed; inset: 0; background: rgba(2, 6, 23, .5); z-index: 55; display: none; }
body.sidebar-open .backdrop { display: block; }
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 1rem; }
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; font-weight: 700; font-size: 1.05rem; text-decoration: none !important; }
.brand.big { color: var(--text); font-size: 1.35rem; justify-content: center; margin-bottom: 1.25rem; }
.brand-logo { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--primary); color: #fff; font-size: .85rem; font-weight: 800; letter-spacing: .5px; }
.tenant-switch, .tenant-name { margin: 0 1rem .75rem; }
.tenant-switch select { width: 100%; background: var(--sidebar-active); color: #fff; border-color: #334155; }
.tenant-name { font-size: .85rem; color: #94a3b8; padding: .4rem .6rem; border: 1px solid #1e293b; border-radius: var(--radius-sm); }
.nav { padding: 0 .6rem; flex: 1; }
.nav-link, .nav-sub a {
  display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; border-radius: 8px; color: var(--sidebar-text);
  text-decoration: none !important; cursor: pointer; list-style: none; font-weight: 500; min-height: 42px;
}
.nav-link::-webkit-details-marker { display: none; }
.nav-link:hover, .nav-sub a:hover { background: var(--sidebar-active); color: #fff; }
.nav-link.active { color: #fff; background: var(--sidebar-active); }
.nav-link .chev { margin-left: auto; transition: transform .15s; opacity: .6; }
.nav-group[open] .chev { transform: rotate(180deg); }
.nav-sub { padding: .15rem 0 .4rem 2.2rem; }
.nav-sub a { padding: .45rem .7rem; font-size: .92rem; min-height: 38px; }
.nav-sub a.active { color: #fff; background: rgba(99, 102, 241, .25); }
.sidebar-foot { padding: 1rem; }
.sidebar-foot a { color: #64748b; }

.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar-h); display: flex; align-items: center; gap: .5rem;
  padding: 0 .75rem; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.global-search { flex: 1; display: flex; align-items: center; gap: .4rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 .8rem; max-width: 560px; color: var(--muted); }
.global-search input { border: 0; background: transparent; padding: .5rem 0; width: 100%; box-shadow: none !important; outline: none; }
.topbar-actions { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); text-decoration: none; }
.icon-btn .icon { width: 1.35em; height: 1.35em; }
.only-mobile { display: inline-grid; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; font-size: .8rem; cursor: pointer; list-style: none; }
.avatar::-webkit-details-marker { display: none; }
.content { padding: 1rem .75rem calc(var(--bottom-h) + 1.5rem); width: 100%; max-width: 1500px; margin: 0 auto; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; display: flex; justify-content: space-around; align-items: stretch;
  height: calc(var(--bottom-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border);
}
.bottom-nav a, .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .7rem; color: var(--muted); background: none; border: 0; text-decoration: none !important; font-family: inherit; cursor: pointer; }
.bottom-nav .icon { width: 1.45em; height: 1.45em; }
.bottom-nav .active { color: var(--primary); }
.bottom-nav .scan-fab .icon { background: var(--primary); color: #fff; width: 46px; height: 46px; padding: 11px; border-radius: 50%; margin-top: -18px; box-shadow: var(--shadow-lg); }

@media (min-width: 1024px) {
  .sidebar { transform: none; }
  .shell { margin-left: var(--sidebar-w); }
  .only-mobile, .bottom-nav, .backdrop { display: none !important; }
  .content { padding: 1.5rem 2rem 3rem; }
  .topbar { padding: 0 2rem; }
}

/* ---------- Seitenkopf ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); font-size: .9rem; margin-top: .2rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: .25rem; }
.breadcrumb a { color: var(--muted); }

/* ---------- Karten / Raster ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .85rem 1rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; font-size: 1rem; }
.card + .card { margin-top: 1rem; }
.grid > .card + .card, .grid > * + .card { margin-top: 0; }
.card-flush .table-wrap { border: 0; }
.grid { display: grid; gap: 1rem; }
.grid-2, .grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 639px) { .grid-4 .stat { flex-direction: column; align-items: flex-start; gap: .4rem; padding: .8rem; } .grid-4 .stat-value { font-size: 1.15rem; } .grid-4 .stat-icon { width: 36px; height: 36px; } }
@media (min-width: 640px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(4, 1fr); } .grid-main { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); } }
.grid-main { display: grid; gap: 1rem; align-items: start; }

.stat { padding: 1rem; display: flex; gap: .85rem; align-items: center; }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); }
.stat-icon .icon { width: 1.4em; height: 1.4em; }
.stat-value { font-size: 1.45rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .85rem; }
.stat.warn .stat-icon { background: var(--warning-50); color: var(--warning); }
.stat.danger .stat-icon { background: var(--danger-50); color: var(--danger); }
.stat.ok .stat-icon { background: var(--success-50); color: var(--success); }

dl.details { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: .45rem .75rem; margin: 0; }
dl.details dt { color: var(--muted); font-size: .88rem; }
dl.details dd { margin: 0; word-break: break-word; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 40px; padding: .5rem .95rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer;
  text-decoration: none !important; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); border-color: #cbd5e1; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost.danger, .btn.danger-text { color: var(--danger); }
.btn-sm { min-height: 32px; padding: .25rem .6rem; font-size: .85rem; }
.btn-lg { min-height: 50px; padding: .7rem 1.4rem; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.inline-form { display: inline; }
.btn-group { display: inline-flex; flex-wrap: wrap; gap: .35rem; }
@media (max-width: 640px) { .page-actions .btn span.hide-sm { display: none; } }

/* ---------- Formulare ---------- */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: .55rem .7rem; width: 100%; min-height: 42px;
}
textarea { min-height: 80px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); vertical-align: -3px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
input[readonly] { background: var(--surface-2); }
.field { margin-bottom: .9rem; }
.field > label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .3rem; }
.field.check label { font-weight: 500; display: flex; gap: .5rem; align-items: center; cursor: pointer; }
.field .hint { color: var(--muted); font-size: .8rem; }
.field-error { color: var(--danger); font-size: .82rem; margin-top: .25rem; }
.req { color: var(--danger); }
.form-grid { display: grid; grid-template-columns: 1fr; column-gap: 1rem; }
@media (min-width: 700px) { .form-grid { grid-template-columns: repeat(2, 1fr); } .form-grid .span-2 { grid-column: span 2; } .form-grid-3 { grid-template-columns: repeat(3, 1fr); } .form-grid-4 { grid-template-columns: repeat(4, 1fr); } .form-grid .span-all { grid-column: 1 / -1; } }
.form-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; padding-top: .5rem; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; margin-bottom: 1rem; }
.filters > * { flex: 1 1 160px; }
.filters .btn { flex: 0 0 auto; }
.filters .field { margin: 0; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem 1rem; margin: 0 0 1rem; }
legend { font-weight: 600; padding: 0 .35rem; }

/* ---------- Tabellen (mobil als Karten) ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
th a { color: inherit; }
tbody tr:hover { background: color-mix(in srgb, var(--primary) 4%, transparent); }
tr[data-href] { cursor: pointer; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.actions { text-align: right; white-space: nowrap; }
tr.sub td:first-child { padding-left: 2rem; }
tr.sub td { font-size: .92em; color: var(--muted); }
tr.row-warn { background: var(--warning-50); }
tr.row-danger { background: var(--danger-50); }
tfoot td { font-weight: 600; }
@media (max-width: 760px) {
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr { border-bottom: 1px solid var(--border); padding: .5rem .25rem; }
  table.responsive td { border: 0; padding: .2rem .75rem; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  table.responsive td::before { content: attr(data-label); color: var(--muted); font-size: .82rem; text-align: left; flex-shrink: 0; }
  table.responsive td[data-label=""]::before, table.responsive td:not([data-label])::before { content: none; }
  table.responsive td.primary-cell { font-weight: 600; font-size: 1rem; text-align: left; justify-content: flex-start; }
  table.responsive td.actions { justify-content: flex-end; }
  table.responsive tr.sub td:first-child { padding-left: 1.5rem; }
  table.responsive tfoot { display: block; }
}

/* ---------- Badges / Hinweise ---------- */
.badge { display: inline-flex; align-items: center; gap: .25rem; padding: .12rem .55rem; border-radius: 999px; font-size: .76rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge-success { background: var(--success-50); color: var(--success); border-color: transparent; }
.badge-warning { background: var(--warning-50); color: var(--warning); border-color: transparent; }
.badge-danger { background: var(--danger-50); color: var(--danger); border-color: transparent; }
.badge-info { background: var(--info-50); color: var(--info); border-color: transparent; }
.badge-primary { background: var(--primary-50); color: var(--primary); border-color: transparent; }
.badge-muted { opacity: .8; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.alert { display: flex; gap: .6rem; align-items: flex-start; padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid transparent; }
.alert > div { flex: 1; }
.alert-success { background: var(--success-50); color: var(--success); }
.alert-error, .alert-danger { background: var(--danger-50); color: var(--danger); }
.alert-warning { background: var(--warning-50); color: var(--warning); }
.alert-info { background: var(--info-50); color: var(--info); }
.alert-close { background: none; border: 0; color: inherit; font-size: 1.3rem; line-height: 1; cursor: pointer; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state .error-code { font-size: 4rem; font-weight: 800; color: var(--primary); }
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); min-width: 60px; }
.progress > span { display: block; height: 100%; background: var(--success); }
.progress.warn > span { background: var(--warning); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: .65rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; text-decoration: none !important; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .count { font-size: .75rem; background: var(--surface-2); border-radius: 999px; padding: 0 .45rem; margin-left: .25rem; }

/* ---------- Dropdown / Dialog ---------- */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .35rem; z-index: 70; }
.dropdown-menu.right { left: auto; right: 0; }
.dropdown-menu a, .dropdown-menu button { display: flex; gap: .5rem; align-items: center; width: 100%; padding: .55rem .7rem; border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; text-align: left; cursor: pointer; text-decoration: none !important; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); }
.dropdown-head { padding: .5rem .7rem .6rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; }
dialog { border: 0; border-radius: 14px; padding: 0; width: min(640px, calc(100vw - 1.5rem)); max-height: calc(100vh - 2rem); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(2, 6, 23, .55); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: .9rem 1rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.dialog-head h2 { margin: 0; font-size: 1.05rem; }
.dialog-body { padding: 1rem; }
.dialog-foot { padding: .75rem 1rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 100; right: 1rem; bottom: calc(var(--bottom-h) + 1rem); display: flex; flex-direction: column; gap: .5rem; max-width: min(420px, calc(100vw - 2rem)); }
@media (min-width: 1024px) { .toasts { bottom: 1.5rem; } }
.toast { padding: .75rem 1rem; border-radius: var(--radius); background: var(--text); color: var(--surface); box-shadow: var(--shadow-lg); animation: toast-in .2s ease; }
.toast.success { background: var(--success); color: #fff; } .toast.error { background: var(--danger); color: #fff; } .toast.warning { background: var(--warning); color: #fff; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }

/* ---------- Autocomplete ---------- */
.ac { position: relative; }
.ac-list { position: absolute; z-index: 80; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); max-height: 320px; overflow-y: auto; }
.ac-item { padding: .55rem .75rem; cursor: pointer; display: flex; justify-content: space-between; gap: .75rem; }
.ac-item:hover, .ac-item.active { background: var(--primary-50); }
.ac-item small { color: var(--muted); }

/* ---------- Vorschläge (Zubehör) ---------- */
.suggestions { border: 1px dashed var(--primary); background: var(--primary-50); border-radius: var(--radius); padding: .75rem; margin-top: .75rem; }
.suggestions h4 { margin: 0 0 .5rem; display: flex; gap: .4rem; align-items: center; color: var(--primary); font-size: .92rem; }
.suggestion { display: flex; align-items: center; gap: .5rem; padding: .4rem 0; border-top: 1px solid color-mix(in srgb, var(--primary) 15%, transparent); flex-wrap: wrap; }
.suggestion:first-of-type { border-top: 0; }
.suggestion .name { flex: 1 1 200px; }
.suggestion input[type="number"] { width: 80px; min-height: 34px; padding: .25rem .4rem; }

/* ---------- Positionseditor ---------- */
.items-editor .item-row { display: grid; gap: .5rem; grid-template-columns: 1fr 1fr; padding: .75rem; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: .5rem; background: var(--surface); position: relative; }
.items-editor .item-row .f-title { grid-column: 1 / -1; }
.items-editor .item-row .f-desc { grid-column: 1 / -1; }
.items-editor .item-row label { font-size: .72rem; color: var(--muted); display: block; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.items-editor .item-row input, .items-editor .item-row select, .items-editor .item-row textarea { min-height: 36px; padding: .35rem .5rem; }
.items-editor .item-row textarea { min-height: 38px; }
.items-editor .row-total { font-weight: 700; text-align: right; align-self: end; padding-bottom: .4rem; }
.items-editor .row-tools { display: flex; gap: .25rem; justify-content: flex-end; align-items: end; }
.items-editor .item-row.is-heading { background: var(--surface-2); }
.items-editor .item-row.is-heading .num-field, .items-editor .item-row.is-text .num-field { display: none; }
.items-editor .drag { cursor: grab; }
@media (min-width: 700px) {
  .items-editor .item-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .items-editor .item-row .f-title { grid-column: span 3; }
  .items-editor .item-row .row-tools { grid-column: span 3; }
}
@media (min-width: 1360px) {
  .items-editor .item-row { grid-template-columns: 105px minmax(160px, 1fr) 64px 54px 48px 58px 90px 56px 50px 95px 150px; align-items: end; gap: .4rem; }
  .items-editor .item-row .f-title { grid-column: auto; }
  .items-editor .item-row .row-tools { grid-column: auto; }
  .items-editor .item-row .f-desc { grid-column: 2 / 10; }
}
.items-editor .row-tools label.num-field { display: flex; align-items: center; gap: .2rem; font-size: .75rem; margin-right: auto; text-transform: none; }
.items-editor .row-tools .btn-sm { min-height: 30px; padding: .2rem .45rem; }

.totals { margin-left: auto; max-width: 380px; }
.totals table td { border: 0; padding: .3rem .5rem; }
.totals tr.grand td { font-size: 1.15rem; font-weight: 700; border-top: 2px solid var(--text); }

/* ---------- Kalender ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; flex-wrap: wrap; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--border); gap: 1px; }
.calendar .dow { background: var(--surface-2); text-align: center; font-size: .75rem; font-weight: 600; color: var(--muted); padding: .4rem 0; }
.calendar .day { background: var(--surface); min-height: 96px; padding: .3rem; font-size: .8rem; overflow: hidden; }
.calendar .day.other { background: var(--surface-2); color: var(--muted); }
.calendar .day.today .dnum { background: var(--primary); color: #fff; border-radius: 50%; }
.calendar .dnum { display: inline-grid; place-items: center; width: 24px; height: 24px; font-weight: 600; }
.cal-event { display: block; margin-top: 2px; padding: 1px 5px; border-radius: 4px; color: #fff; font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none !important; }
@media (max-width: 700px) { .calendar .day { min-height: 64px; } .cal-event { font-size: 0; height: 6px; padding: 0; } }

/* Einsatzplanung (Zeitleiste) */
.plan { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.plan table { min-width: 900px; table-layout: fixed; }
.plan th:first-child, .plan td:first-child { width: 190px; position: sticky; left: 0; background: var(--surface); z-index: 2; }
.plan th:first-child { background: var(--surface-2); }
.plan td { vertical-align: top; padding: .3rem; height: 56px; border-left: 1px solid var(--border); }
.plan th.today, .plan td.today { background: color-mix(in srgb, var(--primary) 6%, var(--surface)); }
.plan th.weekend, .plan td.weekend { background: var(--surface-2); }
.shift { display: block; padding: 2px 6px; border-radius: 5px; font-size: .72rem; color: #fff; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none !important; background: var(--primary); }
.shift.absence { background: repeating-linear-gradient(45deg, #94a3b8, #94a3b8 6px, #a3b1c6 6px, #a3b1c6 12px); color: #0f172a; }
.shift.requested { opacity: .75; outline: 2px dashed rgba(255,255,255,.7); outline-offset: -3px; }
.shift.open { background: var(--danger); }

/* ---------- Scanner ---------- */
.scanner { max-width: 720px; margin: 0 auto; }
.scanner-view { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; display: grid; place-items: center; color: #94a3b8; }
.scanner-view video { width: 100% !important; height: 100% !important; object-fit: cover; }
#reader { width: 100%; }
#reader__dashboard_section_csr button, #reader button { font: inherit; }
.scan-input { display: flex; gap: .5rem; margin-top: .75rem; }
/* Kamera nur auf Geräten mit Touch-Bedienung (Smartphone/Tablet); am PC mit Maus genügt Handscanner/Tastatur */
@media (hover: hover) and (pointer: fine) {
  [data-camera="mobile"] .scanner-view, [data-camera="mobile"] [data-scan-start] { display: none; }
  [data-camera="mobile"] .scan-input { margin-top: 0; }
  .grid > [data-camera="mobile"] { align-self: start; }
}
.scan-input input { font-size: 1.1rem; font-family: ui-monospace, monospace; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: .75rem; }
.mode-switch label { display: flex; align-items: center; justify-content: center; gap: .4rem; padding: .7rem; border: 2px solid var(--border); border-radius: var(--radius); cursor: pointer; font-weight: 600; background: var(--surface); }
.mode-switch input { display: none; }
.mode-switch input:checked + span { color: var(--primary); }
.mode-switch label:has(input:checked) { border-color: var(--primary); background: var(--primary-50); }
.scan-log { list-style: none; padding: 0; margin: 0; max-height: 320px; overflow-y: auto; }
.scan-log li { padding: .5rem .75rem; border-left: 4px solid var(--border); margin-bottom: .35rem; background: var(--surface-2); border-radius: 4px; font-size: .9rem; }
.scan-log li.success { border-color: var(--success); } .scan-log li.warning { border-color: var(--warning); } .scan-log li.error { border-color: var(--danger); }
.scan-result { margin-top: 1rem; }
.flash-ok { animation: flash-ok .6s; } .flash-err { animation: flash-err .6s; }
@keyframes flash-ok { 0% { box-shadow: 0 0 0 6px var(--success); } 100% { box-shadow: none; } }
@keyframes flash-err { 0% { box-shadow: 0 0 0 6px var(--danger); } 100% { box-shadow: none; } }

/* ---------- Etiketten-Vorschau ---------- */
.code-preview { display: inline-block; background: #fff; padding: 6px; border-radius: 6px; border: 1px solid var(--border); }
.code-preview canvas { display: block; width: 96px; height: 96px; image-rendering: pixelated; }

/* ---------- Gast / Login ---------- */
body.guest { min-height: 100vh; background: radial-gradient(circle at 20% 0%, #312e81 0, transparent 50%), radial-gradient(circle at 100% 100%, #0e7490 0, transparent 45%), #0f172a; }
.guest-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.guest-card { width: min(420px, 100%); background: var(--surface); border-radius: 16px; padding: 2rem 1.5rem; box-shadow: var(--shadow-lg); }

/* ---------- Diverses ---------- */
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: .55rem 0; border-bottom: 1px solid var(--border); display: flex; gap: .75rem; justify-content: space-between; align-items: center; }
.list-plain li:last-child { border-bottom: 0; }
.kbd { font-family: ui-monospace, monospace; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 .35rem; font-size: .85em; }
.perm-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 800px) { .perm-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .perm-grid { grid-template-columns: repeat(3, 1fr); } }
.token-box { font-family: ui-monospace, monospace; background: var(--warning-50); border: 1px solid var(--warning); padding: .75rem; border-radius: var(--radius-sm); word-break: break-all; }
.swatch { width: 18px; height: 18px; border-radius: 4px; display: inline-block; vertical-align: middle; border: 1px solid var(--border); }
input[type="color"] { padding: 2px; width: 60px; }
.sticky-actions { position: sticky; bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom)); z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); padding: .6rem 0; border-top: 1px solid var(--border); }
@media (min-width: 1024px) { .sticky-actions { bottom: 0; } }
/* Firmenlogo */
.brand-custom { background: #fff; border-radius: 10px; padding: .4rem .6rem; max-width: 190px; display: flex; align-items: center; min-height: 44px; }
.brand-custom img { max-height: 40px; max-width: 100%; object-fit: contain; display: block; }
.logo-preview { width: 160px; height: 80px; border: 1px dashed var(--border); border-radius: var(--radius-sm); display: grid; place-items: center; background: #fff; padding: .4rem; flex-shrink: 0; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
/* Hinweise mit Status-Farbe (Live-Prüfung) und Listen in Karten mit Innenabstand */
.field .hint.text-danger { color: var(--danger); }
.field .hint.text-success { color: var(--success); }
.list-plain.card-body { padding: .25rem 1rem; }
/* Defektmeldung */
.severity-options { display: grid; gap: .5rem; }
.severity { display: flex; align-items: flex-start; gap: .6rem; padding: .7rem .8rem; border: 2px solid var(--border); border-radius: var(--radius); cursor: pointer; background: var(--surface); }
.severity input { margin-top: .2rem; }
.severity span { display: flex; flex-direction: column; }
.severity small { color: var(--muted); }
.severity:has(input:checked) { border-color: var(--primary); background: var(--primary-50); }
.severity.sev-danger:has(input:checked) { border-color: var(--danger); background: var(--danger-50); }
.severity.sev-warning:has(input:checked) { border-color: var(--warning); background: var(--warning-50); }
.severity.sev-info:has(input:checked) { border-color: var(--info); background: var(--info-50); }
.target-card { border: 2px solid var(--success); border-radius: var(--radius); padding: .8rem; background: var(--success-50); }
.target-card dl.details dd, .target-card dl.details dt { color: var(--text); }
.defect-photo { max-width: 100%; max-height: 420px; border-radius: var(--radius); border: 1px solid var(--border); display: block; }
@media (min-width: 700px) { .severity-options { grid-template-columns: repeat(3, 1fr); } }

/* Vereinfachte Projektansicht (Mitarbeiter) */
.section-title { font-size: 1rem; font-weight: 700; margin: 1rem 0 .6rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pcards { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.pcard { display: flex; flex-direction: column; gap: .35rem; padding: 1rem; color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.pcard:hover { border-color: var(--primary); box-shadow: var(--shadow-lg); }
.pcard-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.pcard-head strong { flex: 1; min-width: 0; font-size: 1.05rem; }
.pcard-meta { color: var(--muted); font-size: .9rem; display: flex; align-items: center; gap: .35rem; }
.pcard-shift { background: var(--primary-50); color: var(--primary); border-radius: var(--radius-sm); padding: .35rem .55rem; font-size: .9rem; }
.pcard-progress { display: flex; align-items: center; gap: .6rem; }
.pcard-progress .progress { flex: 1; }
.quick-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
@media (max-width: 639px) { .quick-actions .btn { flex: 1 1 100%; justify-content: center; } }
.team-list { list-style: none; margin: 0; padding: 0; }
.team-list li { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .65rem 1rem; border-top: 1px solid var(--border); }
