/* ============ Grundwerte ============ */
:root {
  --bg: #0D1117;
  --bg2: #0F141A;
  --surface: #151A21;
  --surface2: #1B222B;
  --surface3: #222A35;
  --line: #232A33;
  --line2: #2F3742;
  --text: #E6EDF3;
  --muted: #8B949E;
  --dim: #6E7681;
  --accent: #58A6FF;
  --accent2: #79B8FF;
  --accent-bg: rgba(88, 166, 255, .12);
  --accent-glow: rgba(88, 166, 255, .28);
  --danger: #F85149;
  --danger-bg: rgba(248, 81, 73, .12);
  --warn: #D29922;
  --warn-bg: rgba(210, 153, 34, .12);
  --ok: #3FB950;
  --ok-bg: rgba(63, 185, 80, .12);
  --radius: 14px;
  --radius-sm: 10px;
  --tap: 44px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --top-h: 60px;
  --sal: env(safe-area-inset-left);
  --sar: env(safe-area-inset-right);
  --sab: env(safe-area-inset-bottom);
  --sat: env(safe-area-inset-top);
  --gutter: max(16px, var(--sal));
  --gutter-r: max(16px, var(--sar));
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 16px); }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh; overflow-x: hidden;
  overscroll-behavior-y: none;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(88,166,255,.07), transparent 60%),
    radial-gradient(700px 400px at -10% 110%, rgba(88,166,255,.04), transparent 60%);
}
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { font-size: 16px; } /* verhindert Zoom auf iOS */
a { color: var(--accent); }
.mono { font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace; font-feature-settings: "tnum"; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
::selection { background: var(--accent-glow); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
svg { flex: none; }

/* ============ Laden ============ */
.boot { min-height: 100dvh; display: grid; place-items: center; }
.boot.inline { min-height: 160px; }
.spinner { width: 28px; height: 28px; border: 2px solid var(--line2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skel { border-radius: 8px; background: linear-gradient(90deg, var(--surface) 0%, var(--surface2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skel-row { height: 64px; margin-bottom: 1px; border-radius: 0; }
.skel-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

/* ============ Login ============ */
.login {
  min-height: 100dvh; display: grid; place-items: center;
  padding: calc(24px + var(--sat)) var(--gutter-r) calc(24px + var(--sab)) var(--gutter);
}
.login-card {
  width: 100%; max-width: 400px; padding: 36px 28px 28px;
  background: linear-gradient(180deg, rgba(27,34,43,.75), rgba(21,26,33,.75));
  backdrop-filter: blur(20px) saturate(140%); -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--line2); border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.04);
  animation: rise .5s var(--ease) both;
}
.login-card .brand { justify-content: center; margin-bottom: 22px; }
.login-card .brand img { height: 48px; max-width: 220px; }
.login-card .brand .mark { width: 48px; height: 48px; }
.login-card h1 { font-size: 22px; margin: 0 0 4px; text-align: center; letter-spacing: -.02em; }
.login-card > p { text-align: center; margin: 0 0 26px; }
.login-card .f { animation: rise .5s var(--ease) both; }
.login-card .f:nth-of-type(1) { animation-delay: .06s; }
.login-card .f:nth-of-type(2) { animation-delay: .12s; }
.login-card .f:nth-of-type(3) { animation-delay: .18s; }
.login-card .btn.primary { animation: rise .5s .2s var(--ease) both; }
.login-card .btn + .btn { margin-top: 8px; }
.shake { animation: shake .4s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.secure-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 18px; font-size: 12px; color: var(--dim); }
.secure-note svg { width: 14px; height: 14px; }

/* ============ Formulare ============ */
label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 6px; letter-spacing: .02em; }
.in {
  width: 100%; height: var(--tap); padding: 0 12px;
  background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--radius-sm); outline: none;
  transition: border-color .15s, box-shadow .2s, background .15s;
  -webkit-appearance: none; appearance: none;
}
select.in {
  padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238B949E' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
.in:hover { border-color: #3a434f; }
.in:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-bg); background: #10161e; }
.in::placeholder { color: var(--dim); }
input[type=number].in { -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.in.invalid { border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-bg); }
.hint { font-size: 12px; color: var(--dim); margin-top: 6px; line-height: 1.4; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 4px 0 10px; }
.err:empty { min-height: 0; margin: 0; }
.err:not(:empty) { animation: rise .25s var(--ease); }
.pw-meter { height: 4px; border-radius: 2px; background: var(--line2); margin-top: 8px; overflow: hidden; }
.pw-meter i { display: block; height: 100%; width: 0; border-radius: 2px; transition: width .3s var(--ease), background .3s; }

/* ============ Buttons ============ */
.btn {
  position: relative; height: var(--tap); padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid var(--line2);
  background: var(--surface2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 500; font-size: 14px; white-space: nowrap; user-select: none; -webkit-user-select: none; text-decoration: none; color: var(--text);
  transition: background .15s, border-color .15s, transform .12s var(--ease), box-shadow .2s, opacity .2s;
  touch-action: manipulation;
}
.btn:hover { border-color: #3d4652; background: var(--surface3); }
.btn:active { transform: scale(.96); }
.btn.primary { background: linear-gradient(180deg, #62adff, #4a98f0); border-color: transparent; color: #071019; font-weight: 600; box-shadow: 0 4px 14px rgba(88,166,255,.25), inset 0 1px 0 rgba(255,255,255,.25); }
.btn.primary:hover { background: linear-gradient(180deg, #7bbaff, #5aa3f5); box-shadow: 0 6px 20px rgba(88,166,255,.35), inset 0 1px 0 rgba(255,255,255,.25); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-bg); border-color: rgba(248,81,73,.6); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface2); }
.btn.block { width: 100%; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.icon { width: var(--tap); padding: 0; }
.btn.sm.icon { width: 34px; }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn svg { width: 18px; height: 18px; }
.btn.busy { color: transparent !important; pointer-events: none; }
.btn.busy::after { content: ""; position: absolute; width: 18px; height: 18px; border: 2px solid currentColor; border-color: rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.primary.busy::after { border-color: rgba(7,16,25,.3); border-top-color: #071019; }

/* ============ Kopfzeile & Navigation ============ */
.shell { display: flex; flex-direction: column; min-height: 100dvh; }
.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px; min-height: calc(var(--top-h) + var(--sat));
  padding: var(--sat) var(--gutter-r) 0 var(--gutter);
  background: rgba(13, 17, 23, .78);
  backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid transparent; transition: border-color .2s, background .2s;
}
.top.scrolled { border-bottom-color: var(--line); background: rgba(13, 17, 23, .88); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -.01em; min-width: 0; color: inherit; text-decoration: none; }
.brand img { height: 30px; max-width: 150px; object-fit: contain; display: block; }
.brand .mark { width: 30px; height: 30px; color: var(--accent); display: block; }
.brand .name { white-space: nowrap; }
.brand .name small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.nav { display: flex; gap: 2px; margin-left: 12px; padding: 4px; border-radius: 12px; background: rgba(21,26,33,.6); border: 1px solid var(--line); position: relative; }
.nav a {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 9px;
  color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14px; transition: color .2s;
}
.nav a:hover { color: var(--text); }
.nav a.on { color: var(--text); }
.nav .pill { position: absolute; z-index: 0; top: 4px; height: 34px; border-radius: 9px; background: var(--surface3); box-shadow: inset 0 1px 0 rgba(255,255,255,.04); transition: transform .35s var(--ease), width .35s var(--ease); }
.nav svg { width: 17px; height: 17px; }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  background: var(--danger); color: #fff; display: inline-block; box-shadow: 0 0 0 2px var(--bg);
}
.badge.pop { animation: pop-badge .45s var(--spring); }
@keyframes pop-badge { 0% { transform: scale(.4); } 100% { transform: scale(1); } }
.top .spacer { flex: 1; }
.status { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 14px; font-size: 12px; color: var(--muted); background: rgba(21,26,33,.6); border: 1px solid var(--line); white-space: nowrap; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); transition: background .3s; }
.status.on i { background: var(--ok); animation: live 2.4s ease-in-out infinite; }
.status.off { color: var(--warn); border-color: rgba(210,153,34,.35); }
.status.off i { background: var(--warn); }
button.status { font: inherit; font-size: 12px; cursor: pointer; transition: background .2s, border-color .2s; }
button.status:hover { background: var(--surface2); }
.status .ex { display: none; width: 16px; height: 16px; border-radius: 50%; background: var(--warn); color: #0D1117; font-size: 11px; font-weight: 800; line-height: 16px; text-align: center; }
.status.off .ex { display: inline-block; animation: pop-badge .45s var(--spring); }
.status.off i { display: none; }
.status-pop {
  position: fixed; z-index: 60; width: min(300px, calc(100vw - 24px)); padding: 14px 16px; border-radius: 14px;
  background: rgba(30, 37, 47, .96); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line2); box-shadow: 0 16px 40px rgba(0,0,0,.5); font-size: 13px;
  transform-origin: top right; animation: pop .22s var(--ease);
}
.status-pop.out { animation: pop-out .18s var(--ease) forwards; }
.status-pop .sp-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 14px; }
.status-pop .sp-h svg { width: 18px; height: 18px; flex: none; }
.status-pop.off .sp-h svg { color: var(--warn); }
.status-pop.on .sp-h svg { color: var(--ok); }
.status-pop.sync .sp-h svg { color: var(--accent); }
.status-pop p { margin: 0; color: var(--muted); line-height: 1.45; }
.status-pop .sp-n { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--warn); font-weight: 600; }
@media (max-width: 640px) { .status.off span { display: none; } .status.off { width: 30px; height: 30px; padding: 0; justify-content: center; border-radius: 50%; } .status.off .ex { width: 18px; height: 18px; line-height: 18px; } }
@keyframes live { 0%, 100% { box-shadow: 0 0 0 0 rgba(63,185,80,.5); } 50% { box-shadow: 0 0 0 5px rgba(63,185,80,0); } }
.user-btn { display: flex; align-items: center; gap: 8px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #071019; background: linear-gradient(135deg, #79b8ff, #4a98f0); flex: none; }

main {
  flex: 1; width: 100%; max-width: 1320px; margin: 0 auto;
  padding: 24px var(--gutter-r) calc(48px + var(--sab)) var(--gutter);
}
.view { animation: view-in .35s var(--ease) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.head h2 { margin: 0; font-size: 26px; letter-spacing: -.025em; line-height: 1.15; }
.head .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Bottom-Tabbar (Telefon & Tablet hochkant) */
.tabbar { display: none; }
.fab { display: none; }

/* ============ Hero (Logo + Slogan) ============ */
.hero {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 28px;
  padding: 26px 28px; margin-bottom: 18px; border-radius: 20px; border: 1px solid var(--line2);
  background:
    radial-gradient(500px 220px at 12% 50%, rgba(88,166,255,.16), transparent 70%),
    radial-gradient(400px 200px at 100% 0%, rgba(121,184,255,.08), transparent 70%),
    linear-gradient(180deg, rgba(27,34,43,.7), rgba(21,26,33,.7));
  animation: rise .5s var(--ease) both;
}
.hero::after { /* feines Raster im Hintergrund */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(400px 200px at 15% 50%, #000, transparent 75%); mask-image: radial-gradient(400px 200px at 15% 50%, #000, transparent 75%);
}
.hero > * { position: relative; z-index: 1; }
.hero-logo { position: relative; width: 132px; height: 132px; flex: none; display: grid; place-items: center; }
.hero-logo .ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 55%, rgba(88,166,255,.15) 65%, #58A6FF 85%, #cfe6ff 92%, transparent 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px)); mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  animation: spin 3.2s linear infinite;
}
.hero-logo .ring::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(88,166,255,.18); }
.hero-logo .orbit { position: absolute; inset: -10px; border-radius: 50%; border: 1px dashed rgba(88,166,255,.18); animation: spin 14s linear infinite reverse; }
.hero-logo .orbit i { position: absolute; top: 50%; left: -4px; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: #9fd0ff; box-shadow: 0 0 12px 3px rgba(88,166,255,.8); }
.hero-logo .glow { position: absolute; inset: 18px; border-radius: 50%; background: radial-gradient(circle, rgba(88,166,255,.35), transparent 70%); filter: blur(10px); animation: breathe 3.5s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(.9); opacity: .6; } 50% { transform: scale(1.1); opacity: 1; } }
.hero-img { position: relative; width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; background: rgba(13,17,23,.85); border: 1px solid var(--line2); box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 10px 30px rgba(0,0,0,.4); animation: float 5s ease-in-out infinite; }
.hero-img img { width: 86%; height: 86%; object-fit: contain; transform: scale(var(--logo-scale, 1)); transition: transform .3s var(--ease); }
.hero-img .mark { width: 48px; height: 48px; color: var(--accent); transform: scale(var(--logo-scale, 1)); transition: transform .3s var(--ease); }
.fav-row { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.fav-prev { width: 72px; height: 72px; border-radius: 16px; border: 1px dashed var(--line2); background: var(--bg2); display: grid; place-items: center; overflow: hidden; flex: none; }
.fav-prev img { width: 100%; height: 100%; object-fit: cover; animation: pop .4s var(--spring); }
.fav-tab { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 14px; border-radius: 10px 10px 0 0; background: var(--surface3); border: 1px solid var(--line2); border-bottom: 0; font-size: 12px; color: var(--muted); }
.fav-tab span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav-tab-ico { width: 16px; height: 16px; flex: none; }
.fav-tab-ico img { width: 16px; height: 16px; object-fit: cover; display: block; }
.range-f { margin-top: 16px; }
.range-f span { display: flex !important; justify-content: space-between; }
.range-f b { color: var(--accent); font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; height: 28px; -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--line2); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line2); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-bg), 0 2px 6px rgba(0,0,0,.4); }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-bg); }
.hero-preview { display: grid; place-items: center; padding: 22px 0 8px; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.hero-text { flex: 1; min-width: 0; }
.hero-kicker { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); opacity: .85; }
.slogan { margin: 6px 0 6px; font-size: clamp(30px, 5vw, 48px); line-height: 1.05; letter-spacing: -.035em; font-weight: 750; }
.slogan span {
  background: linear-gradient(100deg, #58A6FF 0%, #b9dcff 30%, #58A6FF 50%, #3b82d6 70%, #58A6FF 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer-text 4s linear infinite;
}
@keyframes shimmer-text { to { background-position: -250% 0; } }
.hero .sub { color: var(--muted); font-size: 13px; }
.hero .add-desk { align-self: flex-end; }
@media (max-width: 640px) {
  .hero { flex-direction: column; text-align: center; gap: 14px; padding: 26px 18px 22px; border-radius: 18px; }
  .hero::after { -webkit-mask-image: radial-gradient(260px 180px at 50% 30%, #000, transparent 75%); mask-image: radial-gradient(260px 180px at 50% 30%, #000, transparent 75%); }
  .hero-logo { width: 112px; height: 112px; }
  .hero-img { width: 82px; height: 82px; }
  .hero-img .mark { width: 40px; height: 40px; }
  .hero-logo .orbit { inset: -8px; }
  .slogan { font-size: 34px; margin: 4px 0; }
  .hero-kicker { font-size: 10px; letter-spacing: .1em; }
}
@media (max-width: 370px) { .hero-logo { width: 92px; height: 92px; } .hero-img { width: 66px; height: 66px; } .slogan { font-size: 28px; } }

/* ============ Leuchtender Hintergrund (Aurora) ============ */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora i { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; opacity: .5; will-change: transform; }
.aurora i:nth-child(1) { top: -30vmax; left: -15vmax; background: radial-gradient(circle, rgba(88,166,255,.10), transparent 60%); animation: drift1 26s ease-in-out infinite alternate; }
.aurora i:nth-child(2) { bottom: -35vmax; right: -20vmax; background: radial-gradient(circle, rgba(63,120,220,.10), transparent 60%); animation: drift2 32s ease-in-out infinite alternate; }
.aurora i:nth-child(3) { top: 30%; left: 40%; width: 40vmax; height: 40vmax; background: radial-gradient(circle, rgba(121,184,255,.05), transparent 60%); animation: drift3 38s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(18vmax, 12vmax) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-16vmax, -10vmax) scale(1.1); } }
@keyframes drift3 { to { transform: translate(-20vmax, 10vmax) scale(.9); } }
.login { position: relative; }

/* ============ Lichtkegel unter der Maus ============ */
.stat, .card, .hero, .ucard, .parts.grid .part { --mx: -999px; --my: -999px; }
.stat::after, .card::after, .ucard::after, .parts.grid .part::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(260px circle at var(--mx) var(--my), rgba(88,166,255,.10), transparent 60%);
}
.card, .ucard { position: relative; }
@media (hover: hover) { .stat:hover::after, .card:hover::after, .ucard:hover::after, .parts.grid .part:hover::after { opacity: 1; } }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0; border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx) var(--my), rgba(88,166,255,.10), transparent 60%);
}

/* ============ Bestands-Ring ============ */
.gauge { position: relative; width: 132px; height: 132px; flex: none; display: grid; place-items: center; }
.gauge svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge circle { fill: none; stroke-width: 6; }
.gauge .g-bg { stroke: var(--line2); }
.gauge .g-fg { stroke: url(#gg); stroke-linecap: round; transition: stroke-dashoffset 1.2s var(--ease), stroke .3s; filter: drop-shadow(0 0 6px rgba(88,166,255,.45)); }
.gauge.warn .g-fg { stroke: var(--warn); filter: drop-shadow(0 0 6px rgba(210,153,34,.5)); }
.gauge.bad .g-fg { stroke: var(--danger); filter: drop-shadow(0 0 6px rgba(248,81,73,.5)); }
.gauge .g-orbit { position: absolute; inset: -9px; border-radius: 50%; border: 1px dashed rgba(88,166,255,.16); animation: spin 18s linear infinite; }
.gauge .g-orbit i { position: absolute; top: -3px; left: 50%; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: #9fd0ff; box-shadow: 0 0 10px 2px rgba(88,166,255,.8); }
.gauge .g-c { text-align: center; line-height: 1.1; }
.gauge .g-c b { display: block; font-size: 26px; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.gauge .g-c small { font-size: 11px; color: var(--muted); }
.gauge.bad .g-c b { color: var(--danger); }
.gauge.warn .g-c b { color: var(--warn); }

/* ============ Ring-Varianten (Login, Nachbestellung) ============ */
.login-ring { display: grid; place-items: center; margin: -6px 0 18px; }
.login-ring .hero-logo { width: 120px; height: 120px; }
.login-ring .hero-img { width: 86px; height: 86px; }
.order-head { display: flex; align-items: center; gap: 16px; }
.hero-logo.mini { width: 64px; height: 64px; }
.hero-logo.mini .hero-img { width: 46px; height: 46px; animation: none; }
.hero-logo.mini .orbit { inset: -6px; }
.hero-logo.mini .orbit i { width: 6px; height: 6px; margin-top: -3px; left: -3px; }
.hero-logo.mini .glow { inset: 10px; }
.ring-num { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hero-logo.alert .ring { background: conic-gradient(from 0deg, transparent 0 55%, rgba(248,81,73,.15) 65%, #F85149 85%, #ffd0cc 92%, transparent 100%); }
.hero-logo.alert .glow { background: radial-gradient(circle, rgba(248,81,73,.35), transparent 70%); }
.hero-logo.alert .orbit { border-color: rgba(248,81,73,.2); }
.hero-logo.alert .orbit i { background: #ffb4ad; box-shadow: 0 0 12px 3px rgba(248,81,73,.8); }
.hero-logo.alert .ring-num { color: var(--danger); }
.hero-logo.good .ring { background: conic-gradient(from 0deg, transparent 0 55%, rgba(63,185,80,.15) 65%, #3FB950 85%, #c8f5d0 92%, transparent 100%); }
.hero-logo.good .glow { background: radial-gradient(circle, rgba(63,185,80,.3), transparent 70%); }
.hero-logo.good .orbit i { background: #a8efb5; box-shadow: 0 0 12px 3px rgba(63,185,80,.8); }
.hero-logo.good .ring-num { color: var(--ok); }

/* Warn-Kachel: pulsierendes Symbol */
.stat.alert svg { animation: alert-pulse 2s ease-in-out infinite; }
@keyframes alert-pulse { 0%, 100% { transform: scale(1); filter: none; } 50% { transform: scale(1.18); filter: drop-shadow(0 0 6px rgba(248,81,73,.8)); } }

@media (max-width: 899px) {
  .gauge { width: 104px; height: 104px; }
  .gauge .g-c b { font-size: 21px; }
}
@media (max-width: 640px) {
  .gauge { position: absolute; top: 14px; right: 14px; width: 64px; height: 64px; }
  .gauge .g-orbit { inset: -5px; }
  .gauge .g-c b { font-size: 13px; }
  .gauge .g-c small { display: none; }
  .gauge circle { stroke-width: 8; }
  .order-head { gap: 12px; }
}

/* ============ Kennzahlen ============ */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stat {
  position: relative; overflow: hidden; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: inherit; text-decoration: none; transition: border-color .2s, transform .2s var(--ease);
  animation: rise .45s var(--ease) both;
}
.stat:nth-child(2) { animation-delay: .04s; } .stat:nth-child(3) { animation-delay: .08s; } .stat:nth-child(4) { animation-delay: .12s; }
a.stat:hover { border-color: var(--line2); transform: translateY(-1px); }
.stat b { display: block; font-size: 26px; font-weight: 650; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.stat svg { position: absolute; right: 12px; top: 12px; width: 18px; height: 18px; color: var(--dim); }
.stat.alert { border-color: rgba(248,81,73,.35); background: linear-gradient(180deg, rgba(248,81,73,.08), var(--surface) 70%); }
.stat.alert b, .stat.alert svg { color: var(--danger); }

/* ============ Werkzeugleiste ============ */
.toolbar {
  position: sticky; top: calc(var(--top-h) + var(--sat)); z-index: 20;
  display: flex; gap: 8px; align-items: center; margin: 0 calc(-1 * var(--gutter)) 14px; padding: 10px var(--gutter-r) 10px var(--gutter);
  background: linear-gradient(180deg, rgba(13,17,23,.92) 70%, rgba(13,17,23,0));
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.search { position: relative; flex: 1 1 280px; min-width: 0; }
.search > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--dim); pointer-events: none; transition: color .2s; }
.search:focus-within > svg { color: var(--accent); }
.search .in { padding-left: 40px; padding-right: 40px; }
.search .in::-webkit-search-cancel-button { display: none; }
.search .clear { position: absolute; right: 5px; top: 50%; transform: translateY(-50%) scale(.6); opacity: 0; pointer-events: none; width: 34px; height: 34px; border: 0; background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer; display: grid; place-items: center; transition: .2s var(--ease); }
.search .clear.show { opacity: 1; transform: translateY(-50%) scale(1); pointer-events: auto; }
.search .clear svg { width: 16px; height: 16px; }
.search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 11px ui-monospace, monospace; color: var(--dim); border: 1px solid var(--line2); border-radius: 5px; padding: 1px 6px; pointer-events: none; transition: opacity .2s; }
.search .clear.show ~ kbd, .search:focus-within kbd { opacity: 0; }
.filters { display: flex; gap: 8px; align-items: center; min-width: 0; }
.filters select.in { width: auto; max-width: 200px; }
.chip {
  height: var(--tap); padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--line2); background: var(--bg2);
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--muted); user-select: none; white-space: nowrap; flex: none;
  transition: color .2s, background .2s, border-color .2s, transform .12s var(--ease);
}
.chip:hover { color: var(--text); border-color: #3a434f; }
.chip:active { transform: scale(.96); }
.chip svg { width: 16px; height: 16px; }
.chip.on { color: var(--danger); border-color: rgba(248,81,73,.5); background: var(--danger-bg); }
.chip.icon { width: var(--tap); padding: 0; justify-content: center; }
.chip .flip { transition: transform .3s var(--ease); }
.chip.desc .flip { transform: scaleY(-1); }
.seg { position: relative; display: inline-flex; flex: none; border: 1px solid var(--line2); border-radius: var(--radius-sm); background: var(--bg2); padding: 3px; }
.seg button { position: relative; z-index: 1; height: calc(var(--tap) - 8px); width: 40px; border: 0; background: transparent; color: var(--dim); cursor: pointer; display: grid; place-items: center; border-radius: 7px; transition: color .2s; }
.seg button.on { color: var(--text); }
.seg::before { content: ""; position: absolute; top: 3px; left: 3px; width: 40px; height: calc(var(--tap) - 8px); border-radius: 7px; background: var(--surface3); transition: transform .3s var(--ease); }
.seg.right::before { transform: translateX(40px); }
.seg svg { width: 18px; height: 18px; }
.result-info { font-size: 12px; color: var(--dim); margin: -6px 0 10px 2px; min-height: 16px; }

/* ============ Artikelliste ============ */
.parts { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.part {
  display: grid; grid-template-columns: 120px minmax(0, 1fr) minmax(0, 170px) 140px auto; gap: 16px; align-items: center;
  padding: 10px 12px 10px 18px; border-top: 1px solid var(--line); position: relative;
  transition: background .2s;
}
.part:first-child { border-top: 0; }
@media (hover: hover) { .part:hover { background: #19202a; } }
.part::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent; transition: background .3s; }
.part.low::before { background: var(--danger); }
.part.warn::before { background: var(--warn); }
.part.enter { animation: item-in .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 22ms); }
@keyframes item-in { from { opacity: 0; transform: translateY(6px); } }
.part.flash { animation: flash 1.1s var(--ease); }
@keyframes flash { 0% { background: rgba(88,166,255,.16); } }
.leaving { animation: leave .3s var(--ease) forwards !important; pointer-events: none; }
mark { background: rgba(88,166,255,.22); color: inherit; border-radius: 3px; padding: 0 1px; }
.skel-title { width: 220px; height: 30px; }
.vt .view { animation: none; }
@keyframes leave { to { opacity: 0; transform: translateX(-12px); } }
.part .mn { font-weight: 650; color: var(--accent); cursor: pointer; font-size: 14px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.part .mn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part .nm { min-width: 0; cursor: pointer; }
.part .nm b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.part .nm small { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; margin-top: 1px; flex-wrap: wrap; }
.part .loc { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.part .loc span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.part .loc svg { width: 14px; height: 14px; color: var(--dim); }
.part .lvl { font-size: 12px; color: var(--muted); min-width: 0; }
.part .lvl .bar { height: 5px; border-radius: 3px; background: var(--line2); margin-top: 6px; overflow: hidden; }
.part .lvl .bar i { display: block; height: 100%; width: 0; background: var(--ok); border-radius: 3px; transition: width .5s var(--ease), background .3s; }
.part.low .lvl .bar i { background: var(--danger); }
.part.warn .lvl .bar i { background: var(--warn); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; padding: 1px 7px; border-radius: 6px; background: var(--surface2); border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; }
.tag.red { color: var(--danger); border-color: rgba(248,81,73,.4); background: var(--danger-bg); }
.tag.blue { color: var(--accent); border-color: rgba(88,166,255,.35); background: var(--accent-bg); }
.tag.green { color: var(--ok); border-color: rgba(63,185,80,.35); background: var(--ok-bg); }
.tag.amber { color: var(--warn); border-color: rgba(210,153,34,.4); background: var(--warn-bg); }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); animation: blink 1s ease-in-out infinite; flex: none; }
@keyframes blink { 50% { opacity: .3; } }

/* Mengensteuerung */
.qty { display: flex; align-items: center; background: var(--bg2); border: 1px solid var(--line2); border-radius: 13px; overflow: hidden; transition: border-color .2s, box-shadow .2s; flex: none; }
.qty:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-bg); }
.qty button {
  width: var(--tap); height: var(--tap); border: 0; background: transparent; cursor: pointer; color: var(--text);
  display: grid; place-items: center; user-select: none; -webkit-user-select: none; touch-action: manipulation; -webkit-touch-callout: none;
  transition: background .15s, color .15s;
}
.qty button svg { width: 18px; height: 18px; transition: transform .15s var(--spring); }
@media (hover: hover) { .qty button:hover { background: var(--surface2); } }
.qty button:active, .qty button.held { background: var(--accent-bg); color: var(--accent); }
.qty button:active svg, .qty button.held svg { transform: scale(.8); }
.qty button:disabled { color: var(--dim); opacity: .5; }
.qty .val { position: relative; width: 58px; height: var(--tap); border-left: 1px solid var(--line); border-right: 1px solid var(--line); overflow: hidden; }
.qty input {
  width: 100%; height: 100%; border: 0; background: transparent; text-align: center; font-weight: 650; font-size: 17px; outline: none; padding: 0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-variant-numeric: tabular-nums;
}
.qty input:focus { background: var(--accent-bg); }
.qty .val.up input { animation: tick-up .3s var(--ease); }
.qty .val.down input { animation: tick-down .3s var(--ease); }
@keyframes tick-up { from { transform: translateY(60%); opacity: 0; color: var(--ok); } }
@keyframes tick-down { from { transform: translateY(-60%); opacity: 0; color: var(--danger); } }
.part.low .qty input { color: var(--danger); }
.qty .ripple { position: absolute; border-radius: 50%; background: var(--accent-glow); transform: scale(0); animation: ripple .5s var(--ease); pointer-events: none; }
@keyframes ripple { to { transform: scale(2.4); opacity: 0; } }
.qty button { position: relative; overflow: hidden; }

/* Kacheln */
.parts.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; border: 0; background: transparent; overflow: visible; }
.parts.grid .part {
  grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "mn mn" "nm nm" "loc loc" "lvl lvl" "qty qty";
  gap: 6px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 16px; overflow: hidden;
  transition: border-color .2s, transform .25s var(--ease), box-shadow .25s;
}
@media (hover: hover) { .parts.grid .part:hover { border-color: var(--line2); transform: translateY(-2px); box-shadow: 0 12px 28px rgba(0,0,0,.3); } }
.parts.grid .part::before { width: auto; height: 3px; right: 0; bottom: auto; }
.parts.grid .mn { grid-area: mn; }
.parts.grid .nm { grid-area: nm; }
.parts.grid .nm b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 2.9em; }
.parts.grid .loc { grid-area: loc; display: flex; }
.parts.grid .lvl { grid-area: lvl; margin: 4px 0 8px; }
.parts.grid .qty { grid-area: qty; }
.parts.grid .qty .val { flex: 1; }
.parts.grid .qty button { width: 56px; }

.empty { text-align: center; padding: 64px 20px; color: var(--muted); border: 1px dashed var(--line2); border-radius: var(--radius); animation: rise .4s var(--ease); }
.empty svg { width: 40px; height: 40px; color: var(--dim); margin-bottom: 10px; }
.empty .btn { margin-top: 16px; }
.empty.good svg { color: var(--ok); }
.more { display: flex; justify-content: center; margin-top: 14px; }

/* ============ Nachbestellung ============ */
.olist { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.orow { display: grid; grid-template-columns: 130px minmax(0, 1fr) minmax(0, 160px) 70px 60px 110px 140px; gap: 14px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.orow.enter { animation: item-in .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms); }
.orow:first-child { border-top: 0; }
.orow.headrow { background: var(--bg2); font-size: 12px; color: var(--muted); padding-top: 10px; padding-bottom: 10px; }
.orow .r { text-align: right; }
.orow .mn { font-weight: 650; }
.orow .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.orow .order { font-size: 20px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.orow .lbl { display: none; }
.order-sum { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.print-head { display: none; }

/* ============ Benutzer ============ */
.ulist { display: grid; gap: 10px; }
.ucard { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); animation: item-in .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms); transition: opacity .3s; }
.ucard.off { opacity: .65; }
.ucard .who b { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ucard .who small { color: var(--dim); font-size: 12px; }
.ucard select.in { width: auto; height: 34px; font-size: 14px; }
.ucard .acts { display: flex; gap: 6px; }

/* ============ Karten / Einstellungen ============ */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 14px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; animation: rise .45s var(--ease) both; }
.card:nth-child(2) { animation-delay: .05s; } .card:nth-child(3) { animation-delay: .1s; } .card:nth-child(4) { animation-delay: .15s; } .card:nth-child(5) { animation-delay: .2s; }
.card h3 { margin: 0 0 4px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.card h3 svg { width: 18px; height: 18px; color: var(--accent); }
.card > p { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; cursor: pointer; border-top: 1px solid var(--line); }
.switch input { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 14px; background: var(--line2); position: relative; cursor: pointer; transition: background .25s; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.3); transition: transform .3s var(--spring); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); }
.logo-prev { height: 100px; border: 1px dashed var(--line2); border-radius: 12px; display: grid; place-items: center; margin-bottom: 12px; background: var(--bg2); transition: border-color .2s, background .2s; }
.logo-prev.drag { border-color: var(--accent); background: var(--accent-bg); }
.logo-prev img { max-height: 70px; max-width: 80%; animation: pop .4s var(--spring); }
.logo-prev .mark { width: 44px; height: 44px; color: var(--accent); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13px; margin-bottom: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.blist { list-style: none; padding: 0; margin: 0 0 14px; font-size: 13px; }
.blist li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.blist a { text-decoration: none; }
.sec-list { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.sec-list li { display: flex; gap: 10px; padding: 7px 0; color: var(--muted); }
.sec-list svg { width: 16px; height: 16px; color: var(--ok); margin-top: 2px; }

/* ============ Dialoge ============ */
dialog {
  width: min(580px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--line2); border-radius: 20px;
  background: var(--surface); color: var(--text); box-shadow: 0 30px 90px rgba(0,0,0,.6);
  display: flex; flex-direction: column; overflow: hidden;
}
dialog:not([open]) { display: none; }
dialog[open] { animation: pop .3s var(--ease); }
dialog.closing { animation: pop-out .2s var(--ease) forwards; }
dialog::backdrop { background: rgba(1, 4, 9, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade-in .25s var(--ease); }
dialog.closing::backdrop { animation: fade-out .2s var(--ease) forwards; }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(10px); } }
@keyframes pop-out { to { opacity: 0; transform: scale(.97) translateY(6px); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
dialog form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.dlg-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px 14px 20px; border-bottom: 1px solid var(--line); }
.dlg-h h3 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
.dlg-b { padding: 18px 20px; overflow-y: auto; overscroll-behavior: contain; flex: 1; min-height: 0; }
.dlg-f { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 18px calc(14px + var(--sab)); border-top: 1px solid var(--line); background: var(--bg2); }
.dlg-f .left { margin-right: auto; }
.grab { display: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }
.draft-note { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 16px; border-radius: 10px; font-size: 13px; background: var(--accent-bg); border: 1px solid rgba(88,166,255,.3); animation: rise .3s var(--ease); }
.draft-note svg { width: 18px; height: 18px; color: var(--accent); }
.draft-note span { flex: 1; }
.save-state { font-size: 12px; color: var(--dim); display: flex; align-items: center; gap: 6px; margin-right: auto; min-width: 0; }
.save-state svg { width: 14px; height: 14px; }
.save-state.saved { color: var(--ok); }
.tabs { display: flex; gap: 4px; padding: 3px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 16px; }
.tabs button { flex: 1; height: 32px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 500; transition: background .2s, color .2s; }
.tabs button.on { background: var(--surface3); color: var(--text); }
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; animation: item-in .3s var(--ease) both; animation-delay: calc(var(--i, 0) * 20ms); }
.hist li:first-child { border-top: 0; }
.hist .d { font-weight: 700; font-variant-numeric: tabular-nums; }
.hist .d.p { color: var(--ok); } .hist .d.m { color: var(--danger); } .hist .d.z { color: var(--muted); }
.hist small { color: var(--dim); display: block; }
.qty-quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: -6px; margin-bottom: 14px; }

/* ============ Toasts ============ */
#toasts {
  position: fixed; z-index: 1000; left: 50%; transform: translateX(-50%); bottom: calc(24px + var(--sab));
  display: flex; flex-direction: column-reverse; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 14px; background: rgba(30, 37, 47, .94); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line2); box-shadow: 0 16px 40px rgba(0,0,0,.45); font-size: 14px;
  animation: toast-in .4s var(--spring) both; pointer-events: auto;
}
.toast svg { width: 18px; height: 18px; flex: none; }
.toast.ok svg { color: var(--ok); }
.toast.err { border-color: rgba(248,81,73,.5); } .toast.err svg { color: var(--danger); }
.toast.warn { border-color: rgba(210,153,34,.5); } .toast.warn svg { color: var(--warn); }
.toast span { flex: 1; }
.toast button { border: 0; background: transparent; color: var(--accent); font-weight: 600; cursor: pointer; padding: 4px 6px; }
.toast.out { animation: toast-out .25s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }
.offline-bar { position: sticky; top: calc(var(--top-h) + var(--sat)); z-index: 25; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 16px; font-size: 13px; background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid rgba(210,153,34,.3); animation: slide-down .3s var(--ease); }
@keyframes slide-down { from { transform: translateY(-100%); opacity: 0; } }

/* ============ View Transitions ============ */
::view-transition-old(main) { animation: vt-out .18s var(--ease) both; }
::view-transition-new(main) { animation: vt-in .3s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-4px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); } }
main { view-transition-name: main; }

/* ============ Responsiv ============ */
/* Großer Desktop */
@media (min-width: 1400px) {
  .part { grid-template-columns: 140px minmax(0, 1fr) minmax(0, 200px) 170px auto; }
}
/* Laptop / Tablet quer */
@media (max-width: 1100px) {
  .part { grid-template-columns: 110px minmax(0, 1fr) minmax(0, 130px) 120px auto; gap: 12px; }
  .orow { grid-template-columns: 120px minmax(0, 1fr) 70px 60px 100px 130px; }
  .orow .loc { display: none; }
}
/* Tablet hochkant & Telefon: Bottom-Navigation */
@media (max-width: 899px) {
  :root { --top-h: 56px; }
  .nav, .top .uname { display: none; }
  .tabbar {
    display: grid; grid-template-columns: repeat(var(--n, 4), 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 6px var(--sar) calc(6px + var(--sab)) var(--sal);
    background: rgba(13, 17, 23, .86); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
    border-top: 1px solid var(--line);
  }
  .tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0 4px; color: var(--dim); text-decoration: none; font-size: 11px; font-weight: 500; transition: color .2s; }
  .tabbar a svg { width: 24px; height: 24px; transition: transform .3s var(--spring); }
  .tabbar a.on { color: var(--accent); }
  .tabbar a.on svg { transform: translateY(-1px) scale(1.08); }
  .tabbar a::before { content: ""; position: absolute; top: -6px; left: 50%; width: 24px; height: 3px; margin-left: -12px; border-radius: 0 0 3px 3px; background: var(--accent); transform: scaleX(0); transition: transform .3s var(--ease); }
  .tabbar a.on::before { transform: scaleX(1); }
  .tabbar .badge { position: absolute; top: 0; left: calc(50% + 4px); }
  main { padding-bottom: calc(110px + var(--sab)); }
  #toasts { bottom: calc(84px + var(--sab)); }
  .fab {
    display: grid; place-items: center; position: fixed; z-index: 29; right: max(18px, var(--sar)); bottom: calc(84px + var(--sab));
    width: 56px; height: 56px; border-radius: 18px; border: 0; cursor: pointer; color: #071019;
    background: linear-gradient(180deg, #6db3ff, #4a98f0); box-shadow: 0 10px 28px rgba(88,166,255,.4), inset 0 1px 0 rgba(255,255,255,.3);
    animation: fab-in .45s .15s var(--spring) both; transition: transform .2s var(--spring);
  }
  .fab:active { transform: scale(.9); }
  .fab svg { width: 26px; height: 26px; }
  @keyframes fab-in { from { transform: scale(0) rotate(-90deg); } }
  .add-desk { display: none !important; }
  #toasts.with-fab { bottom: calc(150px + var(--sab)); }
  .toolbar { flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .search { flex: 1 1 100%; }
  .search kbd { display: none; }
  .filters { flex: 1 1 100%; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter-r)) 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter-r) 2px var(--gutter); -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 20px), transparent); mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 20px), transparent); }
  .filters::-webkit-scrollbar { display: none; }
  .filters select.in { flex: none; max-width: 190px; }
}
@media (max-width: 899px) and (min-width: 641px) {
  .part { grid-template-columns: 110px minmax(0, 1fr) 110px auto; }
  .part .loc { display: none; }
}
/* Telefon */
@media (max-width: 640px) {
  main { padding-top: 14px; }
  .head { margin-bottom: 14px; }
  .head h2 { font-size: 24px; }
  .brand .name { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 8px; }
  .stat { padding: 12px 14px; }
  .stat b { font-size: 22px; }
  .part .nm b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
  .filters select.in { max-width: 170px; height: 38px; font-size: 14px; }
  .filters .chip { height: 38px; }
  .filters .chip.icon { width: 38px; }
  .filters .seg button, .filters .seg::before { height: 30px; }
  .part {
    grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "mn qty" "nm qty" "lvl lvl";
    gap: 2px 12px; padding: 12px 12px 12px 16px;
  }
  .part .mn { grid-area: mn; }
  .part .nm { grid-area: nm; }
  .part .loc { display: none; }
  .part .lvl { grid-area: lvl; margin-top: 8px; display: flex; align-items: center; gap: 10px; }
  .part .lvl .bar { flex: 1; margin-top: 0; }
  .part .qty { grid-area: qty; align-self: center; }
  .part .lvl .where { display: inline-flex; }
  .parts.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .parts.grid .part { padding: 12px; grid-template-areas: "mn mn" "nm nm" "lvl lvl" "qty qty"; }
  .parts.grid .part .lvl { display: block; margin: 2px 0 6px; }
  .parts.grid .qty button { width: 40px; }
  .parts.grid .qty input { font-size: 16px; }
  .orow, .orow.headrow { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .orow.headrow { display: none; }
  .orow .mn { grid-column: 1; }
  .orow .order { grid-column: 2; grid-row: 1 / span 2; align-self: center; text-align: right; }
  .orow .nm { grid-column: 1; white-space: normal; }
  .orow .meta { grid-column: 1 / -1; display: flex; gap: 12px; color: var(--muted); font-size: 12px; }
  .orow .loc, .orow .st, .orow .mi { display: none; }
  .orow .act { grid-column: 1 / -1; margin-top: 6px; }
  .orow .act .btn { width: 100%; }
  .orow .lbl { display: inline; }
  .ucard { grid-template-columns: auto minmax(0, 1fr); }
  .ucard .role, .ucard .acts { grid-column: 1 / -1; }
  .ucard .role select { width: 100%; }
  .ucard .acts .btn { flex: 1; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .grid3 > :last-child { grid-column: 1 / -1; }

  /* Dialoge als Bottom-Sheet */
  dialog {
    width: 100vw; max-width: 100vw; max-height: calc(100dvh - var(--sat) - 12px); margin: auto 0 0; border-radius: 22px 22px 0 0;
    border-bottom: 0;
  }
  dialog[open] { animation: sheet-in .38s var(--ease); }
  dialog.closing { animation: sheet-out .25s var(--ease) forwards; }
  @keyframes sheet-in { from { transform: translateY(100%); } }
  @keyframes sheet-out { to { transform: translateY(100%); } }
  .grab { display: block; width: 38px; height: 5px; border-radius: 3px; background: var(--line2); margin: 8px auto -4px; flex: none; }
  .dlg-f .btn { flex: 1; }
  .dlg-f .left { flex: 0 0 auto; }
  .save-state { display: none; }
}
@media (min-width: 641px) { .orow .meta { display: none; } .part .lvl .where { display: none; } }
/* Sehr schmale Telefone (iPhone SE / mini) */
@media (max-width: 370px) {
  .qty button { width: 40px; }
  .qty .val { width: 48px; }
  .head h2 { font-size: 22px; }
  .parts.grid { grid-template-columns: 1fr; }
}
/* Telefon quer: niedriger Kopf */
@media (max-height: 500px) and (orientation: landscape) {
  :root { --top-h: 48px; }
  .tabbar a { flex-direction: row; justify-content: center; gap: 6px; padding: 4px 0; }
  .tabbar a svg { width: 20px; height: 20px; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .toolbar { position: static; }
}

/* ============ Druck ============ */
@media print {
  @page { margin: 14mm; }
  body::before, .top, .tabbar, .fab, .no-print, #toasts, .offline-bar { display: none !important; }
  html, body, main { background: #fff !important; color: #000 !important; padding: 0 !important; }
  .view { animation: none; }
  .print-head { display: block; margin-bottom: 10px; font-size: 12px; }
  .head h2 { color: #000; }
  .olist { border: 1px solid #999; background: #fff; border-radius: 0; }
  .orow { grid-template-columns: 110px minmax(0, 1fr) 120px 60px 50px 90px !important; color: #000; border-color: #ccc; break-inside: avoid; }
  .orow.headrow { display: grid !important; background: #eee; color: #000; }
  .orow .act { display: none !important; }
  .orow .loc, .orow .st, .orow .mi { display: block !important; }
  .orow .meta { display: none !important; }
  .orow .order { color: #000; grid-row: auto !important; grid-column: auto !important; font-size: 14px; }
  .orow .mn, .orow .nm { grid-column: auto !important; }
}
/* Weniger Bewegung */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
