/* Lieferschein-Scanner — Oberfläche für die Teile-Annahme.
   Ruhig, flach, gut lesbar auf Werkstatt-PCs: keine Verläufe, keine schwebenden Kacheln,
   eine Akzentfarbe (Orange) für die eine Aktion, die gerade wichtig ist. */
:root {
  --navy: #1f2d3d;
  --navy-2: #2c3e52;
  --accent: #e8831f;
  --accent-2: #cf7115;
  --accent-soft: #fdf1e4;
  --bg: #f2f3f5;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #5f6b7a;
  --line: #d9dee6;
  --line-soft: #e9edf2;
  --ok: #1a7f46;
  --ok-soft: #e3f4ea;
  --warn: #b9640a;
  --warn-soft: #fdf0dc;
  --err: #c0392b;
  --err-soft: #fbe7e5;
  --info: #2457a6;
  --info-soft: #e6eefb;
  --radius: 8px;
  --control: 38px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: inherit; }
code { background: #eceff3; padding: 1px 5px; border-radius: 4px; font-size: 13px; font-family: Consolas, 'Cascadia Mono', monospace; }
.hidden, [hidden] { display: none !important; }
.ic { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none; flex-shrink: 0; vertical-align: -3px; }
.ic.fill { fill: currentColor; stroke: none; }

/* Launch splash (icon only, pulses until the server answers) */
.splash { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 90% at 20% 0%, #2f4a70 0%, #1b2a41 55%, #101a2b 100%); cursor: pointer; transition: opacity 0.35s ease; }
.splash.hide { opacity: 0; pointer-events: none; }
.splash-wrap { position: relative; width: 200px; height: 200px; }
.splash-ring { position: absolute; inset: 0; border-radius: 44px; border: 3px solid rgba(34,197,94,0.55); opacity: 0; animation: splash-ring 1.8s ease-out 0.4s infinite; }
.splash-ring.second { animation-delay: 1.3s; }
@keyframes splash-ring { 0% { transform: scale(1); opacity: 0.45; } 100% { transform: scale(1.55); opacity: 0; } }
.splash-logo { position: absolute; inset: 0; width: 200px; height: 200px; border-radius: 44px; filter: drop-shadow(0 16px 32px rgba(0,0,0,0.55)); animation: splash-pop 0.4s cubic-bezier(.2,.9,.3,1.2), splash-breathe 1.8s ease-in-out 0.4s infinite; }
@keyframes splash-pop { from { opacity: 0; transform: scale(0.5); } to { opacity: 1; transform: scale(1); } }
@keyframes splash-breathe { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.06); opacity: 0.82; } }
.splash.out .splash-logo { animation: splash-zoom-out 0.32s cubic-bezier(.4,0,.8,.4) forwards; }
.splash.out .splash-ring { animation: none; opacity: 0; }
@keyframes splash-zoom-out { from { transform: scale(1); opacity: 1; } to { transform: scale(0.15); opacity: 0; } }

/* Top bar: brand, the three work tabs, then the admin pages set apart on the right */
.topbar {
  display: flex; align-items: stretch; gap: 20px;
  padding: 0 20px; height: 54px;
  background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; white-space: nowrap; }
.brand img { border-radius: 7px; }
.nav { display: flex; flex: 1; min-width: 0; overflow-x: auto; gap: 2px; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  display: flex; align-items: center; gap: 7px;
  padding: 0 14px; text-decoration: none; position: relative;
  color: rgba(255,255,255,0.78); font-weight: 600; white-space: nowrap;
}
.nav a:hover { color: #fff; background: rgba(255,255,255,0.06); }
.nav a.active { color: #fff; }
.nav a.active::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; background: var(--accent); border-radius: 3px 3px 0 0; }
.nav .admin { display: flex; margin-left: auto; padding-left: 14px; border-left: 1px solid rgba(255,255,255,0.18); }
.nav .admin a { font-weight: 500; font-size: 14px; color: rgba(255,255,255,0.7); }
.nav .admin a.active, .nav .admin a:hover { color: #fff; }
.badge {
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; line-height: 18px;
  padding: 0 7px; border-radius: 9px; min-width: 20px; text-align: center;
}
.badge.muted { background: rgba(255,255,255,0.22); }
.badge.warn { background: var(--err); }
.badge:empty, .badge[data-zero="1"] { display: none; }
.conn { display: flex; align-items: center; gap: 7px; font-size: 13px; opacity: 0.9; white-space: nowrap; }
.conn .dot { width: 9px; height: 9px; border-radius: 50%; background: #9ca3af; }
.conn.on .dot { background: #34c46a; }
.conn.off .dot { background: #f05252; }

/* User menu in the top bar */
.user-menu { display: flex; align-items: center; gap: 10px; font-size: 13px; white-space: nowrap; }
.user-menu .user-name { font-weight: 600; color: rgba(255,255,255,0.9); }
.link-btn.light { color: rgba(255,255,255,0.75); font-weight: 500; font-size: 13px; padding: 4px 2px; }
.link-btn.light:hover { color: #fff; }

/* Login page */
.login-body { background: var(--navy); }
.login-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { background: #fff; border-radius: 10px; padding: 26px 28px 22px; width: min(420px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,0.35); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-brand img { border-radius: 10px; }
.login-brand b { display: block; font-size: 17px; }
.login-brand span { display: block; color: var(--muted); font-size: 13px; }
.login-btn { width: 100%; justify-content: center; margin-top: 4px; }
.login-hint { margin: 12px 0 0; font-size: 13px; }
.login-card .notice { margin-bottom: 14px; }

/* Users table */
table.users { border-collapse: collapse; width: 100%; font-size: 14px; }
table.users th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); padding: 7px 8px; background: #f6f8fa; white-space: nowrap; }
table.users td { padding: 7px 8px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
table.users td .sub { display: block; color: var(--muted); font-size: 12px; }
table.users td.actions { white-space: nowrap; text-align: right; }
table.users td.actions .link-btn { padding: 2px 5px; font-size: 13px; }
table.users .status-pill { font-size: 12px; }
table.users tr.empty-row td { padding: 14px 8px; color: var(--muted); text-align: center; }

/* Small dialogs (password) */
dialog.small-dialog { width: min(460px, 96vw); }
.small-dialog-body { padding: 16px 20px 4px; }

/* Layout */
main { flex: 1; padding: 22px 24px 40px; max-width: 1400px; width: 100%; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar h1 { font-size: 22px; margin: 0; font-weight: 700; letter-spacing: -0.2px; }
.spacer { flex: 1; }
.hint { color: var(--muted); font-size: 14px; margin: 4px 0 14px; line-height: 1.5; max-width: 900px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.card h3 { margin: 0 0 12px; font-size: 16px; color: var(--navy); }
.card > .hint:last-child { margin-bottom: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
label input, label select { display: block; width: 100%; margin-top: 5px; }
label.check { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 500; font-size: 14px; }
label.check input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
input, select, textarea {
  font: inherit; color: var(--text); background: #fff;
  min-height: var(--control); padding: 6px 11px; border: 1px solid var(--line); border-radius: 6px;
}
input[type="checkbox"] { min-height: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(232,131,31,0.4); outline-offset: 0; border-color: var(--accent); }
input[type="search"] { min-width: 260px; }
input::placeholder { color: #98a2b3; }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-weight: 600; min-height: var(--control); padding: 0 16px; border-radius: 6px; border: 1px solid transparent; cursor: pointer;
  background: var(--accent); color: #fff; transition: background 0.12s;
}
.btn:hover { background: var(--accent-2); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: #fff; color: var(--navy); border-color: var(--line); }
.btn.ghost:hover { background: #f4f6f9; border-color: #c5ccd6; }
.btn.danger { color: var(--err); border-color: #eebbb6; }
.btn.danger:hover { background: var(--err-soft); }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 14px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; background: transparent; color: var(--muted); width: 32px; height: 32px; border-radius: 6px; cursor: pointer; font: inherit; }
.icon-btn:hover { background: #eceff3; color: var(--navy); }
.icon-btn .ic { width: 16px; height: 16px; }
.addr { display: inline-block; font-size: 16px; padding: 8px 12px; user-select: all; }
.out { background: #1c2430; color: #e2e8f0; padding: 12px; border-radius: 6px; font-size: 13px; overflow: auto; max-height: 400px; white-space: pre-wrap; font-family: Consolas, 'Cascadia Mono', monospace; }
.btn .ic { width: 17px; height: 17px; }

/* Note lists: one bordered list, rows separated by lines */
.note-list { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.note {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center;
  padding: 12px 18px; cursor: pointer; border-top: 1px solid var(--line-soft); transition: background 0.1s;
}
.note:first-child { border-top: none; }
.note:hover { background: #fbf8f4; }
.note .icon { width: 40px; height: 40px; border-radius: 8px; background: #eef1f5; color: var(--navy); display: flex; align-items: center; justify-content: center; }
.note .icon .ic { width: 22px; height: 22px; }
.note.done .icon { background: var(--ok-soft); color: var(--ok); }
.note.error .icon { background: var(--err-soft); color: var(--err); }
.note .title { font-weight: 700; font-size: 16px; }
.note .sub { color: var(--muted); font-size: 13px; margin-top: 2px; display: flex; gap: 12px; flex-wrap: wrap; }
.note .sub .err { color: var(--err); font-weight: 600; }
.note .right { text-align: right; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.note .right .chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.note .right .btn { margin-top: 2px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef1f5; color: var(--navy); white-space: nowrap; }
.pill .ic { width: 13px; height: 13px; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.rule { background: var(--info-soft); color: var(--info); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.err { background: var(--err-soft); color: var(--err); }
.toast.with-action { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; font-weight: 500; line-height: 1.45; }
.toast.with-action .btn { background: #fff; color: var(--err); border-color: #fff; }
input.flagged { border-color: var(--warn) !important; background: #fff8ee; box-shadow: 0 0 0 2px rgba(185,100,10,0.15); }
.empty { padding: 44px 24px; text-align: center; color: var(--muted); line-height: 1.6; }
.empty b { color: var(--text); word-break: break-all; }
.empty .steps-row { display: flex; justify-content: center; gap: 28px; margin-top: 22px; flex-wrap: wrap; text-align: left; }
.empty .step-item { display: flex; gap: 10px; align-items: flex-start; max-width: 240px; font-size: 14px; }
.empty .step-item .num { width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.empty .step-item b { display: block; margin-bottom: 2px; }
.notice { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 14px; font-size: 14px; line-height: 1.5; border: 1px solid; }
.notice .ic { margin-top: 2px; }
.notice.info { background: var(--info-soft); border-color: #c7d7f2; color: #1d3f75; }
.notice.warn { background: var(--warn-soft); border-color: #f2d3a6; color: #7a4407; }
.notice.error { background: var(--err-soft); border-color: #f0bcb7; color: #8a2a20; }
.notice b { font-weight: 700; }
.processing { display: flex; align-items: center; gap: 10px; background: var(--warn-soft); border: 1px solid #f2d3a6; color: #7a4407; padding: 10px 16px; border-radius: var(--radius); margin-bottom: 12px; font-weight: 600; }
.processing::before { content: ''; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(122,68,7,0.25); border-top-color: #b9640a; animation: spin 0.9s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Paginator */
.paginator { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 16px 0; flex-wrap: wrap; }
.paginator button { font: inherit; min-height: 34px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--line); background: #fff; cursor: pointer; min-width: 36px; color: var(--text); }
.paginator button:hover:not(:disabled) { background: #f4f6f9; }
.paginator button.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.paginator button:disabled { opacity: 0.4; cursor: default; }
.paginator .info { color: var(--muted); font-size: 13px; margin: 0 8px; }

/* Supplier directory */
.h2 { font-size: 18px; margin: 0; font-weight: 700; }
table.suppliers { border-collapse: collapse; width: 100%; font-size: 14px; }
table.suppliers th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); padding: 7px 8px; background: #f6f8fa; white-space: nowrap; }
table.suppliers td { padding: 3px 4px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
table.suppliers td input { width: 100%; min-height: 34px; padding: 4px 8px; border-radius: 5px; }
table.suppliers td.code { width: 120px; }
table.suppliers td.code input { font-weight: 700; }
table.suppliers td.x { width: 36px; text-align: center; }
table.suppliers td.name { position: relative; }
table.suppliers .learned { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--muted); background: #eef1f5; padding: 1px 6px; border-radius: 4px; pointer-events: none; }
table.suppliers .learned + input, table.suppliers td.name:has(.learned) input { padding-right: 62px; }
table.suppliers tr.empty-row td { padding: 14px 8px; color: var(--muted); text-align: center; }

/* Rules editor */
.rules { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.rules .empty { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.rules > .rule { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; }
.rules > .rule.disabled { opacity: 0.6; }
.rule-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.rule-head input[type="text"] { flex: 1; font-weight: 600; }
.rule-part { margin: 8px 0 8px 12px; padding-left: 12px; border-left: 3px solid var(--line-soft); }
.rule-part .lbl { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.cond, .act { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.cond select, .act select { min-width: 170px; }
.cond input, .act input { flex: 1; min-width: 160px; }
.link-btn { background: none; border: none; color: var(--accent-2); font: inherit; font-weight: 600; cursor: pointer; padding: 4px 4px; display: inline-flex; align-items: center; gap: 4px; }
.link-btn:hover { text-decoration: underline; }
.rule-part .match { font-size: 13px; font-weight: 500; text-transform: none; letter-spacing: 0; }
.rule-part .match select { min-height: 30px; padding: 2px 8px; font-size: 13px; }

/* Macro editor */
.macro-sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.steps { display: flex; flex-direction: column; gap: 6px; min-height: 30px; margin-bottom: 8px; }
.step { display: flex; gap: 6px; align-items: center; background: #f6f8fa; border: 1px solid var(--line-soft); border-radius: 6px; padding: 6px 8px; }
.step .type { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 4px; background: var(--navy); color: #fff; min-width: 66px; text-align: center; }
.step .type.key { background: #5b3f9e; }
.step .type.paste { background: #0f6f8c; }
.step .type.wait { background: #6b6560; }
.step input { flex: 1; min-width: 80px; min-height: 32px; padding: 4px 8px; }
.step .mini { border: none; background: transparent; cursor: pointer; color: var(--muted); padding: 2px 4px; display: inline-flex; }
.step .mini:hover { color: var(--navy); }
.step .mini .ic { width: 15px; height: 15px; }
.add-step { display: flex; gap: 6px; flex-wrap: wrap; }
.add-step button { font: inherit; font-size: 13px; padding: 5px 10px; border-radius: 6px; border: 1px dashed #b9c2d0; background: #fff; cursor: pointer; color: var(--navy); }
.add-step button:hover { border-style: solid; background: #f4f6f9; }
details.adv { margin-top: 6px; }
details.adv summary { cursor: pointer; font-weight: 600; color: var(--accent-2); font-size: 14px; list-style: none; display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; }
details.adv summary::-webkit-details-marker { display: none; }
details.adv summary::before { content: ''; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s; margin-left: 2px; }
details.adv[open] summary::before { transform: rotate(45deg); }
details.adv > div { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line-soft); }

/* Dialog */
dialog { border: none; border-radius: 10px; padding: 0; width: min(1300px, 96vw); max-height: 94vh; box-shadow: 0 20px 60px rgba(0,0,0,0.3); color: var(--text); }
dialog::backdrop { background: rgba(20,28,40,0.55); }
.dialog-body { display: flex; flex-direction: column; max-height: 94vh; }
.dialog-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 18px; }
.status-pill { font-size: 13px; font-weight: 700; padding: 3px 11px; border-radius: 999px; background: #eef1f5; }
.status-pill.open { background: var(--accent-soft); color: #8d4a06; }
.status-pill.done { background: var(--ok-soft); color: var(--ok); }
.status-pill.error { background: var(--err-soft); color: var(--err); }
.status-pill.processing { background: var(--info-soft); color: var(--info); }
.dialog-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 0; flex: 1; min-height: 0; overflow: hidden; }
.nd-fields { padding: 16px 20px; overflow: auto; }
.nd-fields h3 { font-size: 15px; margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.nd-fields .badge { background: var(--navy); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 12px; }
.fields label { margin: 0; }
.nd-pdf { border-left: 1px solid var(--line); background: #4d5259; min-height: 300px; display: flex; flex-direction: column; }
.nd-pdf iframe { width: 100%; height: 100%; border: none; min-height: 60vh; }
.nd-pdf-bar { display: flex; align-items: center; gap: 14px; padding: 6px 12px; min-height: 40px; background: #353a41; color: #e8eaed; font-size: 13px; flex-wrap: nowrap; white-space: nowrap; }
.nd-pdf-bar #nd-pdf-info { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nd-pdf-bar .spacer { display: none; }
.nd-pdf-bar label { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; margin: 0; }
.nd-pdf-bar label select, .nd-pdf-bar label input { display: inline-block; width: auto; margin: 0; }
.nd-pdf-bar label.check input { width: 15px; height: 15px; }
.nd-pdf-bar a { color: #ffc46b; text-decoration: none; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.nd-pdf-bar .small-check { margin: 0; color: #e8eaed; font-weight: 500; font-size: 13px; }
.nd-pages-wrap { position: relative; flex: 1; min-height: 0; display: flex; }
.nd-pages { flex: 1; overflow: auto; padding: 12px; }
.nd-pdf-bar select { min-height: 28px; padding: 2px 6px; font-size: 13px; border-radius: 5px; }
/* magnifier: shows the area under the mouse enlarged, always in the corner away from the cursor, never catches the mouse */
.loupe { position: absolute; width: 300px; height: 190px; border: 2px solid var(--accent); border-radius: 8px; overflow: hidden;
  background: #fff; box-shadow: 0 10px 30px rgba(0,0,0,0.45); pointer-events: none; z-index: 5; }
.loupe .loupe-img { position: absolute; inset: 0; background-repeat: no-repeat; background-color: #fff; image-rendering: auto; }
.loupe .loupe-cross { position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border: 1px solid rgba(232,131,31,0.9); border-radius: 50%; box-shadow: 0 0 0 1px rgba(255,255,255,0.8); }
.loupe .loupe-tag { position: absolute; left: 0; bottom: 0; background: rgba(31,45,61,0.88); color: #fff; font-size: 12px; padding: 2px 8px; border-top-right-radius: 6px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loupe .loupe-tag:empty { display: none; }
.nd-pages .page { position: relative; background: #fff; margin: 0 auto 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.4); max-width: 100%; }
.nd-pages .page img { display: block; width: 100%; height: auto; }
.nd-pages .pnum { position: absolute; right: 6px; top: 6px; background: rgba(0,0,0,0.55); color: #fff; font-size: 12px; padding: 1px 7px; border-radius: 4px; }
/* value boxes: flagged ones are always visible, others on hover of their field or when "alle Felder" is on */
.vbox { position: absolute; border: 2px solid rgba(36,87,166,0.7); border-radius: 3px; box-sizing: content-box; padding: 2px; margin: -2px 0 0 -2px; cursor: pointer; opacity: 0; transition: opacity 0.15s, box-shadow 0.15s; }
.vbox.flag { border-color: var(--warn); background: rgba(185,100,10,0.14); opacity: 1; box-shadow: 0 0 0 3px rgba(185,100,10,0.25); animation: vbox-blink 1.2s ease-in-out 3; }
@keyframes vbox-blink { 50% { box-shadow: 0 0 0 8px rgba(185,100,10,0.35); } }
.nd-pages.show-all .vbox, .vbox.hot { opacity: 1; }
.vbox.hot { border-color: var(--info); background: rgba(36,87,166,0.15); box-shadow: 0 0 0 4px rgba(36,87,166,0.3); z-index: 2; }
.vbox.flag.hot { border-color: #8d4a06; }
.vbox .lbl { position: absolute; left: -2px; top: -19px; background: var(--warn); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 3px; white-space: nowrap; display: none; }
.vbox.flag .lbl, .vbox.hot .lbl { display: block; }
.vbox.hot:not(.flag) .lbl { background: var(--info); }
input.locatable { cursor: crosshair; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
table.items { border-collapse: collapse; width: 100%; font-size: 14px; }
table.items th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); padding: 7px 8px; background: #f6f8fa; position: sticky; top: 0; white-space: nowrap; }
table.items td { padding: 3px 4px; border-top: 1px solid var(--line-soft); }
table.items td input { width: 100%; min-height: 34px; padding: 4px 8px; border-radius: 5px; }
table.items td.n { color: var(--muted); text-align: center; width: 30px; }
table.items td.x { width: 36px; text-align: center; }
.nd-meta { margin-top: 14px; font-size: 13px; color: var(--muted); line-height: 1.7; }
.nd-meta .warn-text { color: var(--warn); font-weight: 600; }
.nd-meta .ok-text { color: var(--ok); font-weight: 600; }
.nd-meta .err-text { color: var(--err); }
.dialog-actions { display: flex; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; background: #fafbfc; border-radius: 0 0 10px 10px; }
.dialog-actions .primary-group { display: flex; gap: 8px; margin-left: auto; }

/* Variable pause settings in the macro editor */
.extra-delay { margin-bottom: 12px; }
.extra-delay .lbl-row { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.extra-delay .row { gap: 6px; font-size: 14px; }
.extra-delay input { width: 90px; min-height: 34px; padding: 4px 8px; }
.extra-delay .hint { margin-top: 6px; }
.step input.maxms { flex: 0 0 80px; min-width: 0; }
.step .to { color: var(--muted); font-size: 13px; }

/* Provider blocks in the settings */
.provider { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; background: #fafbfc; }
.provider.active { border-color: var(--accent); background: #fffaf3; }
.provider-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.provider-head h4 { margin: 0; font-size: 15px; color: var(--navy); }
.provider-head .pill { display: none; background: var(--accent); color: #fff; }
.provider.active .provider-head .pill { display: inline-flex; }
.keystatus { font-size: 14px; font-weight: 600; margin: 4px 0 8px; min-height: 20px; }
.keystatus.ok { color: var(--ok); }
.keystatus.bad { color: var(--err); }
.keystatus.busy { color: var(--muted); }
.keyrow { display: flex; gap: 8px; align-items: center; }
.keyrow input { flex: 1; font-family: Consolas, 'Cascadia Mono', monospace; }
.keyrow .btn { white-space: nowrap; }
.keyrow-links { display: flex; gap: 16px; margin: 6px 0 10px; flex-wrap: wrap; font-size: 13px; }
.keyrow-links a.link-btn { text-decoration: none; }
.danger-link { color: var(--err) !important; }
.grid2.tight { gap: 0 12px; }
.grid2.tight label { margin-bottom: 10px; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 2px 0 12px; }
.status-line.ok { color: var(--ok); }
.status-line.bad { color: var(--err); }
.status-line.off { color: var(--muted); }

/* Toasts */
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--navy); color: #fff; padding: 11px 40px 11px 16px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,0.25); font-weight: 600; animation: slide-in 0.2s ease-out; max-width: 400px; position: relative; cursor: pointer; font-size: 14px; }
.toast::after { content: '×'; position: absolute; right: 14px; top: 9px; opacity: 0.7; font-size: 18px; line-height: 1; }
.toast:hover::after { opacity: 1; }
.toast.error { background: var(--err); }
.toast.ok { background: var(--ok); }
@keyframes slide-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 1100px) {
  #conn-text { display: none; }
  .user-menu .user-name { display: none; }
}
/* phone: big upload button at the bottom, compact toolbar */
.mobile-bar { display: none; }
@media (max-width: 700px) {
  .mobile-bar { display: flex; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: rgba(242,243,245,0.96); border-top: 1px solid var(--line); z-index: 15; }
  .mobile-bar .btn { min-height: 48px; font-size: 16px; }
  .mobile-bar #btn-upload-mobile { flex: 1; justify-content: center; }
  main { padding-bottom: 96px; }
  .toolbar h1 { width: 100%; }
  .topbar { gap: 10px; padding: 0 10px; }
  .nav a { padding: 0 9px; }
  #btn-widget-download, #btn-password { display: none; }
  .brand img { width: 24px; height: 24px; }
  .toolbar input[type="search"] { min-width: 0; flex: 1; }
  #btn-upload-open, #btn-rescan, #btn-apply-all { display: none; }
  .note { padding: 12px 14px; }
  .note .right { font-size: 12px; }
  .toasts { left: 12px; right: 12px; bottom: 90px; }
  .toast { max-width: none; }
  .dialog-actions { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}
@media (max-width: 900px) {
  .dialog-grid { grid-template-columns: 1fr; overflow: auto; }
  .nd-pdf { display: none; }
  .topbar { gap: 12px; padding: 0 12px; }
  .brand span { display: none; }
  .nav .admin { border-left: none; padding-left: 0; }
  main { padding: 16px 12px 32px; }
  .note { grid-template-columns: 1fr auto; }
  .note .icon { display: none; }
}
