/* Portal-Vorführung · Aufbau und Farben nach dem Kundenportal-Vorbild, hell und dunkel */
:root {
  --banner-h: 34px;
  --side-w: 16rem;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --accent: #e4002b;
  --accent-text: #ff6577;
  --accent-ink: #fff;
  --bg: #0e1525; --side: #0f1726; --card: #121b2d; --card-2: #17213a; --line: #222d42; --line-2: #2c3953;
  --text: #e7ecf6; --muted: #8e9ab1; --field: #0e1525; --hover: #19243b; --active: #1a2438;
  --ok-bg: rgba(34, 197, 94, .14); --ok: #4ade80;
  --warn-bg: rgba(245, 158, 11, .14); --warn: #fbbf24;
  --bad-bg: rgba(239, 68, 68, .15); --bad: #ff8a8a;
  --info-bg: rgba(59, 130, 246, .16); --info: #7db4ff;
  --neu-bg: rgba(148, 163, 184, .15); --neu: #b5c0d3;
  --shadow: 0 8px 30px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --accent-text: #c1001f;
  --bg: #f3f5f9; --side: #ffffff; --card: #ffffff; --card-2: #f7f9fc; --line: #dfe4ec; --line-2: #c9d1de;
  --text: #172033; --muted: #5a667b; --field: #ffffff; --hover: #eef2f8; --active: #fdecee;
  --ok-bg: #dcfce7; --ok: #166534; --warn-bg: #fef3c7; --warn: #92400e; --bad-bg: #fee2e2; --bad: #991b1b;
  --info-bg: #dbeafe; --info: #1e40af; --neu-bg: #e8edf4; --neu: #3b475b;
  --shadow: 0 8px 30px -14px rgba(20, 30, 60, .25);
  color-scheme: light;
}
@media (max-width: 640px) { :root { --banner-h: 62px; } }

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; font-family: var(--font); font-size: 14px; line-height: 1.5; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); } .mono { font-family: var(--mono); } .num { font-variant-numeric: tabular-nums; text-align: right; }
.icon { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.s4 { width: 16px; height: 16px; } .icon.s3 { width: 13px; height: 13px; } .icon.s5 { width: 20px; height: 20px; }

/* AGILIVIS-Rahmen */
.agv-bar { position: fixed; inset: 0 0 auto 0; z-index: 60; min-height: var(--banner-h); display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; padding: 5px 14px; background: #0b0f17; border-bottom: 1px solid rgba(255, 255, 255, .09); color: #c9d2de; font-size: 12px; }
.agv-bar img { height: 15px; width: auto; display: block; }
.agv-bar .agv-brand { display: inline-flex; align-items: center; gap: 8px; color: #e8edf4; font-weight: 600; }
.agv-bar .agv-proj { color: #fff; font-weight: 600; }
.agv-bar .agv-tag { padding: 1px 8px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 9999px; font-size: 11px; color: #f2c8a8; white-space: nowrap; }
.agv-bar .agv-back { margin-left: auto; color: #ffb27e; text-decoration: none; font-weight: 600; white-space: nowrap; }
.agv-bar .agv-back:hover { text-decoration: underline; }
.agv-bar .sep { opacity: .4; }
@media (max-width: 640px) { .agv-bar .sep.hide-sm { display: none; } .agv-bar .agv-tag { order: 5; } }

/* Sidebar */
.sidebar { position: fixed; top: var(--banner-h); bottom: 0; left: 0; z-index: 50; width: var(--side-w); display: flex; flex-direction: column; background: var(--side); border-right: 1px solid var(--line); overflow-y: auto; }
.side-close { display: none; justify-content: flex-end; padding: 8px 12px 0; }
.logo-wrap { padding: 20px 20px 12px; }
.logo-wrap img { height: 26px; width: auto; display: block; }
.logo-wrap .logo-light { display: none; }
:root[data-theme="light"] .logo-wrap .logo-dark { display: none; }
:root[data-theme="light"] .logo-wrap .logo-light { display: block; }
.logo-wrap p { margin-top: 8px; font-size: 12px; color: var(--muted); }
.cust-box { padding: 10px 20px 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cust-box small { display: block; font-size: 11px; color: var(--muted); }
.cust-box b { font-size: 13px; font-weight: 600; }
.nav { padding: 10px 12px; flex: 1; }
.grp { margin-bottom: 4px; }
.grp-head { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 11px 12px; border-radius: 8px; font-weight: 600; font-size: 14px; text-align: left; }
.grp-head:hover { background: var(--hover); }
.grp-head[aria-current="true"] { background: var(--card-2); }
.grp-head .icon { color: var(--muted); transition: transform .2s; }
.grp-head[aria-expanded="true"] .icon { transform: rotate(180deg); }
.sub { margin: 4px 0 8px 12px; padding-left: 0; border-left: 1px solid var(--line); }
.sub a { display: flex; align-items: center; gap: 12px; margin: 2px 0 2px 12px; padding: 9px 12px; border-radius: 8px; text-decoration: none; font-size: 14px; color: var(--muted); position: relative; }
.sub a:hover { background: var(--hover); color: var(--text); }
.sub a[aria-current="page"] { background: var(--active); color: var(--text); font-weight: 600; }
.sub a[aria-current="page"]::before { content: ''; position: absolute; left: -13px; top: 4px; bottom: 4px; width: 3px; border-radius: 3px; background: var(--accent); }
.verw { padding: 14px 12px; border-top: 1px solid var(--line); margin: 6px 12px 0; padding-left: 0; padding-right: 0; }
.verw h3 { padding: 0 12px 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.verw a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); font-size: 14px; }
.verw a:hover { background: var(--hover); color: var(--text); }
.verw a[aria-current="page"] { background: var(--active); color: var(--text); font-weight: 600; }
.side-foot { padding: 12px 20px 16px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }

/* Hauptbereich */
.main { padding-top: var(--banner-h); padding-left: var(--side-w); min-height: 100vh; }
.topbar { position: sticky; top: var(--banner-h); z-index: 30; background: var(--bg); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; gap: 12px; padding: 12px 24px 0; flex-wrap: wrap; }
.top-row.second { padding: 10px 24px 12px; justify-content: space-between; }
.top-row h1 { font-size: 15px; font-weight: 600; }
.cust-select { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.field { border: 1px solid var(--line-2); background: var(--field); border-radius: 8px; padding: 8px 12px; font-size: 14px; color: var(--text); }
.field:focus { outline: 2px solid var(--accent-text); outline-offset: 1px; }
select.field { max-width: 100%; }
.badge { display: inline-flex; align-items: center; border-radius: 9999px; background: var(--card-2); border: 1px solid var(--line); padding: 2px 10px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.theme { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.theme button { width: 42px; height: 34px; display: grid; place-items: center; border-radius: 7px; color: var(--muted); }
.theme button:hover { color: var(--text); }
.theme button[aria-pressed="true"] { background: var(--card-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.icon-btn { display: none; width: 36px; height: 36px; place-items: center; border-radius: 8px; border: 1px solid var(--line); background: var(--card); }
.scrim { position: fixed; inset: var(--banner-h) 0 0 0; z-index: 45; background: rgba(5, 8, 15, .6); }
.page { padding: 24px; max-width: 1280px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head h2 { font-size: 20px; font-weight: 600; }
.page-head p { font-size: 12px; color: var(--muted); }
.lead { margin-bottom: 16px; color: var(--muted); }

@media (max-width: 1023px) {
  .main { padding-left: 0; }
  .icon-btn { display: grid; }
  .sidebar { transform: translateX(-100%); visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s; }
  .sidebar.open { transform: none; visibility: visible; transition: transform .25s ease; box-shadow: var(--shadow); }
  .side-close { display: flex; }
  .top-row { padding-left: 16px; padding-right: 16px; }
  .page { padding: 16px; }
}
@media (max-width: 640px) { .cust-select .lbl-txt { display: none; } .cust-select select { max-width: 62vw; } }

/* Karten, Tabellen, Chips */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.pad { padding: 20px; } .pad-s { padding: 14px 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 8px; padding: 9px 16px; font-weight: 500; border: 1px solid var(--line-2); background: var(--card); transition: background .15s; }
.btn:hover:not(:disabled) { background: var(--hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.1); }
.link { color: var(--accent-text); text-decoration: none; font-weight: 500; }
.link:hover { text-decoration: underline; }
.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 9999px; padding: 2px 10px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); } .chip.info { background: var(--info-bg); color: var(--info); } .chip.neutral { background: var(--neu-bg); color: var(--neu); }
.tag { display: inline-block; border: 1px dashed var(--line-2); border-radius: 6px; padding: 0 6px; font-size: 10px; letter-spacing: .05em; color: var(--muted); text-transform: uppercase; }
.tag.solid { border-style: solid; }

.kpis { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { padding: 20px; display: flex; flex-direction: column; gap: 6px; min-height: 140px; }
.kpi small { color: var(--muted); font-size: 14px; }
.kpi strong { font-size: 30px; line-height: 1.1; font-weight: 600; }
.kpi .link { margin-top: auto; }
@media (max-width: 900px) { .kpis { grid-template-columns: minmax(0, 1fr); } .kpi { min-height: 0; } }
.stack > * + * { margin-top: 16px; } .stack-s > * + * { margin-top: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.statbar { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 32px; padding: 18px 20px; }
.stat { min-width: 140px; }
.stat small { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.stat strong { display: block; margin-top: 4px; font-size: 24px; font-weight: 600; }
.statbar .btn { margin-left: auto; }
@media (max-width: 640px) { .statbar .btn { margin-left: 0; width: 100%; } }

.tabs { display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.tabs button { padding: 7px 14px; border-radius: 7px; color: var(--muted); font-weight: 500; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.search { position: relative; flex: 1 1 260px; max-width: 360px; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { width: 100%; padding-left: 36px; padding-right: 34px; }
.search .clear { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; display: grid; place-items: center; color: var(--muted); border-radius: 6px; }

table.rt { width: 100%; border-collapse: collapse; }
table.rt th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 14px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.rt td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.rt.compact td { padding-top: 8px; padding-bottom: 8px; }
table.rt tr:last-child td { border-bottom: 0; }
table.rt tbody tr:hover { background: var(--hover); }
table.rt tr.sel { background: var(--active); }
table.rt th.num, table.rt td.num { text-align: right; }
table.rt .chk { width: 44px; padding-right: 0; }
.card.tbl { overflow: hidden; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.ord-id { font-weight: 600; color: var(--text); text-decoration: none; }
.ord-id:hover { color: var(--accent-text); text-decoration: underline; }
.sub-line { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 2px; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; margin-top: 12px; color: var(--muted); }
.pager .btns { display: flex; gap: 8px; }
.bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 16px; border-color: var(--accent); }
.bulk b { font-weight: 600; }
.empty { text-align: center; padding: 48px 16px; }
.empty .ico { width: 56px; height: 56px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 14px; background: var(--card-2); color: var(--muted); }
.empty h3 { font-size: 16px; font-weight: 600; } .empty p { color: var(--muted); margin: 6px 0 14px; }

@media (max-width: 760px) {
  table.rt thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.rt, table.rt tbody, table.rt tr, table.rt td { display: block; width: 100%; }
  table.rt tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  table.rt tr:last-child { border-bottom: 0; }
  table.rt td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.rt td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: none; }
  table.rt td.chk, table.rt td.first { justify-content: flex-start; text-align: left; }
  table.rt td.chk::before, table.rt td.first::before { content: none; }
  table.rt td.chk { width: auto; padding: 0 0 6px; }
}

/* Detail */
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--text); }
.det-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1000px) { .det-grid { grid-template-columns: minmax(0, 1fr); } }
.card h3 { font-size: 15px; font-weight: 600; }
.card .hd { padding: 14px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tl { list-style: none; margin: 0; padding: 4px 0 0; }
.tl li { position: relative; display: flex; gap: 12px; padding: 0 0 16px; color: var(--muted); }
.tl li:last-child { padding-bottom: 0; }
.tl li::before { content: ''; position: absolute; left: 7px; top: 18px; bottom: 0; width: 2px; background: var(--line-2); }
.tl li:last-child::before { content: none; }
.tl .dot { width: 16px; height: 16px; border-radius: 9999px; border: 2px solid var(--line-2); background: var(--card); flex: none; margin-top: 2px; }
.tl li.done { color: var(--text); } .tl li.done .dot { background: var(--ok); border-color: var(--ok); }
.tl li.now .dot { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px rgba(228, 0, 43, .2); }
.tl li.now { color: var(--text); font-weight: 600; }
dl.kv { margin: 0; }
dl.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
dl.kv > div:last-child { border-bottom: 0; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.note { border-radius: 10px; padding: 12px 14px; border: 1px solid; font-size: 13px; }
.note.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.note.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.note.info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.run { border: 1px solid var(--accent); border-radius: 12px; padding: 14px 16px; background: var(--card-2); }
.run .tagline { display: inline-block; margin-bottom: 8px; padding: 2px 10px; border-radius: 9999px; border: 1px solid var(--accent); color: var(--accent-text); font-size: 12px; font-weight: 600; }
.run ul { list-style: none; margin: 10px 0 0; padding: 0; }
.run li { display: flex; gap: 8px; align-items: center; padding: 2px 0; color: var(--muted); font-size: 13px; }
.run li.done { color: var(--ok); } .run li.now { color: var(--text); }
.bar { height: 6px; border-radius: 9999px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); transition: width .5s ease; }

/* Hilfe, Einstellungen */
details.faq { border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
details.faq + details.faq { margin-top: 10px; }
details.faq summary { padding: 14px 16px; cursor: pointer; font-weight: 600; list-style-position: inside; }
details.faq p { padding: 0 16px 14px; color: var(--muted); }
.set-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row b { font-weight: 600; } .set-row p { color: var(--muted); font-size: 12px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

dialog.dlg { border: 1px solid var(--line-2); background: var(--card); color: var(--text); border-radius: 14px; padding: 22px; width: min(30rem, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog.dlg::backdrop { background: rgba(5, 8, 15, .6); }
dialog.dlg h3 { font-size: 18px; margin-bottom: 10px; }
dialog.dlg .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 90; max-width: calc(100vw - 32px); border-radius: 10px; border: 1px solid var(--line-2); background: var(--card); padding: 10px 16px; box-shadow: var(--shadow); font-size: 13px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
