/* BIKEFILL · Screen-Styles (Print-Layout liegt in print.css) */

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: #f0f2f5;
  min-height: 100vh; min-height: 100dvh;
  color: #222;
  padding-bottom: env(safe-area-inset-bottom);
}

.hidden { display: none !important; }

/* ── Login ────────────────────────────────────────────────────────────── */
.login-screen {
  position: fixed; inset: 0; z-index: 200;
  background: linear-gradient(135deg, #c1003a 0%, #7a0024 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  background: white; border-radius: 14px; padding: 32px 28px;
  width: 100%; max-width: 440px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}
.login-logo-img {
  display: block; margin: 0 auto 14px; width: 220px; max-width: 100%;
}
.login-title {
  text-align: center; color: #c1003a;
  font-size: 1.15rem; font-weight: 900;
  letter-spacing: 1.2px;
  margin-bottom: 24px;
  text-transform: uppercase;
}
.login-form { display: flex; flex-direction: column; gap: 8px; }
.login-form label {
  font-size: 0.78rem; font-weight: bold; color: #555;
  text-transform: uppercase; letter-spacing: 0.4px; margin-top: 10px;
}
.login-form input {
  padding: 12px 14px; border: 2px solid #ddd; border-radius: 8px;
  font-size: 16px; background: #fafafa;
}
.login-form input:focus { outline: none; border-color: #c1003a; background: white; }
.role-choice { display: flex; gap: 8px; }
.role-btn {
  flex: 1; padding: 14px 10px; border: 2px solid #ddd; background: white;
  border-radius: 8px; font-size: 0.95rem; font-weight: bold; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: border-color 0.15s, background 0.15s;
  color: #333;
}
.role-btn small { font-size: 0.7rem; font-weight: normal; color: #888; }
.role-btn:hover { border-color: #c1003a; }
.role-btn.active {
  background: #c1003a; color: white; border-color: #c1003a;
}
.role-btn.active small { color: rgba(255,255,255,0.85); }

/* ── Header ───────────────────────────────────────────────────────────── */
.app-header {
  background: #c1003a; color: white;
  display: flex; align-items: center; padding: 8px 12px; gap: 10px;
}
.header-logo {
  height: 40px; width: auto; flex-shrink: 0;
  background: white; border-radius: 6px; padding: 2px;
}
.header-left { display: flex; flex-direction: column; flex: 1; line-height: 1.15; min-width: 0; }
.header-left strong {
  font-size: 0.95rem; letter-spacing: 0.4px; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.header-left small { font-size: 0.72rem; opacity: 0.85; }

@media (max-width: 480px) {
  .app-header { padding: 6px 8px; gap: 6px; }
  .header-logo { height: 30px; }
  .header-left strong { font-size: 0.78rem; }
  .header-left small { font-size: 0.64rem; line-height: 1.1; }
  .user-chip {
    font-size: 0.62rem; padding: 3px 6px;
    max-width: 85px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .btn-icon { width: 28px; height: 28px; font-size: 0.9rem; }
  .sync-dot { width: 8px; height: 8px; }
  .header-right { gap: 6px; }
}
.header-right { display: flex; align-items: center; gap: 10px; }
.user-chip {
  background: rgba(255,255,255,0.18); padding: 5px 10px; border-radius: 14px;
  font-size: 0.78rem; font-weight: bold; white-space: nowrap;
}
.sync-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #4caf50; flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.4);
  transition: background 0.3s;
}
.sync-dot.offline { background: #ff9800; }
.sync-dot.error   { background: #f44336; }
.btn-icon {
  background: rgba(255,255,255,0.18); border: none; color: white;
  width: 40px; height: 40px; border-radius: 8px; font-size: 1.15rem;
  cursor: pointer; touch-action: manipulation;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon:hover { background: rgba(255,255,255,0.28); }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-icon.spinning { animation: spin 0.6s linear; pointer-events: none; }

/* ── Tabs ─────────────────────────────────────────────────────────────── */
.app-tabs {
  display: flex; background: #a3002f;
  position: sticky; top: 0; z-index: 10;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tab-btn {
  flex: 1; min-width: 100px;
  padding: 12px 8px; border: none; background: transparent;
  color: rgba(255,255,255,0.75); font-size: 0.84rem; font-weight: bold;
  cursor: pointer; border-bottom: 3px solid transparent;
  transition: all 0.15s; touch-action: manipulation;
  white-space: nowrap;
}
.tab-btn:hover { background: rgba(255,255,255,0.07); color: white; }
.tab-btn.active { color: white; border-bottom-color: white; background: rgba(255,255,255,0.12); }
.tab-count {
  display: inline-block; background: rgba(255,255,255,0.22);
  padding: 1px 7px; border-radius: 10px; margin-left: 4px;
  font-size: 0.72rem; font-weight: bold;
}
.tab-btn.active .tab-count { background: white; color: #c1003a; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.tab-header {
  display: flex; align-items: center; gap: 10px;
  border-bottom: 2px solid #c1003a; padding-bottom: 8px; margin-bottom: 12px;
}
.tab-header h2 { flex: 1; border: none !important; padding: 0 !important; margin: 0 !important; }
.tab-header-actions { display: flex; gap: 6px; }

.card-desc { font-size: 0.85rem; color: #666; margin-bottom: 12px; }

.import-header {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.import-header h2 {
  margin: 0; padding: 0; border: none;
}
.rule-hint {
  display: inline-block;
  background: #fff3cd;
  color: #842029;
  border: 2px solid #dc3545;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 1rem;
  letter-spacing: 0.3px;
  font-weight: 900;
}
.role-hint { font-size: 0.82rem; color: #999; margin-top: 8px; }

/* ── Scan-Box ─────────────────────────────────────────────────────────── */
.scan-box {
  background: #e8f4ff;
  border: 2px solid #0d6efd;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}
.scan-box label {
  display: block; font-weight: bold; color: #084298;
  margin-bottom: 8px; font-size: 0.92rem;
}
.scan-input {
  width: 100%; padding: 12px 14px;
  font-family: 'Courier New', monospace; font-size: 1.1rem; font-weight: bold;
  border: 2px solid #0d6efd; border-radius: 6px;
  background: white; letter-spacing: 1px;
}
.scan-input:focus { outline: none; border-color: #c1003a; box-shadow: 0 0 0 3px rgba(193,0,58,0.15); }
.scan-feedback {
  min-height: 22px; margin-top: 8px;
  font-size: 0.88rem; font-weight: bold;
}
.scan-feedback.success { color: #0a3622; }
.scan-feedback.error   { color: #842029; }

/* ── Übersichts-Grid (Excel-Import-Tab) ───────────────────────────────── */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.ov-col {
  background: #fafafa;
  border-radius: 8px;
  padding: 12px;
  border-top: 4px solid #ccc;
}
.ov-col.angefordert { border-top-color: #f0c040; }
.ov-col.ausgedruckt { border-top-color: #6b21a8; }
.ov-col.in_montage  { border-top-color: #fd7e14; }
.ov-col.fertig      { border-top-color: #1d6f42; }
.ov-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px;
}
.ov-title {
  font-weight: bold; color: #333; font-size: 0.92rem;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.ov-count {
  font-size: 1.6rem; font-weight: 900; color: #c1003a;
}
.ov-items { display: flex; flex-direction: column; gap: 4px; }
.ov-item {
  background: white; border-radius: 5px; padding: 6px 8px;
  font-size: 0.78rem; cursor: pointer; border: 1px solid #eee;
  display: flex; flex-direction: column; gap: 2px;
}
.ov-item:hover { border-color: #c1003a; background: #fff7ec; }
.ov-item-id { font-family: 'Courier New', monospace; color: #888; font-size: 0.7rem; }
.ov-item-name { font-weight: bold; color: #222; line-height: 1.15; }
.ov-item-meta { font-size: 0.7rem; color: #666; }
.ov-item .li-position {
  font-size: 0.74rem; padding: 3px 7px; margin-top: 4px;
}
.ov-more { text-align: center; font-size: 0.72rem; color: #888; padding: 4px; font-style: italic; }
.ov-empty { text-align: center; color: #aaa; padding: 12px; font-size: 0.78rem; font-style: italic; }

/* ── Lager-View (Mobile-first) ────────────────────────────────────────── */
.lager-view {
  max-width: 640px; margin: 0 auto; padding: 16px 12px;
}
.lager-card {
  background: white; border-radius: 12px; padding: 20px 16px 18px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  text-align: center;
}
.lager-card h2 {
  font-size: 1.25rem; color: #084298;
  padding: 0; border: none; margin-bottom: 10px;
}
.lager-formats {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; flex-wrap: wrap; margin-bottom: 14px;
}
.lager-format-chip {
  display: inline-block;
  background: #084298; color: white;
  padding: 6px 12px; border-radius: 20px;
  font-family: 'Courier New', monospace;
  font-weight: bold; font-size: 0.86rem;
  white-space: nowrap;
}
.lager-format-or {
  color: #888; font-weight: bold; font-size: 0.78rem;
  letter-spacing: 1.2px; padding: 0 2px;
}
.scan-input-lg {
  font-size: 1.4rem; padding: 18px 14px; text-align: center;
  letter-spacing: 1.5px; min-height: 60px;
  width: 100%;
}
.lager-hint {
  font-size: 0.78rem; color: #888; margin-top: 8px;
  font-style: italic;
}

.lager-stats {
  margin-top: 14px; padding: 12px 6px;
  background: white; border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
}
.lager-stat-item {
  display: flex; flex-direction: column; align-items: center;
  padding: 4px 2px; min-width: 0;
}
.lager-stat-item .stat-n {
  font-size: 1.3rem; font-weight: bold; color: #c1003a;
}
.lager-stat-item .stat-label {
  color: #666; text-transform: uppercase;
  font-size: 0.62rem; letter-spacing: 0.4px;
  text-align: center; white-space: nowrap;
}

@media (max-width: 380px) {
  .lager-card h2 { font-size: 1.1rem; }
  .lager-format-chip { font-size: 0.78rem; padding: 5px 10px; }
  .scan-input-lg { font-size: 1.2rem; padding: 16px 10px; min-height: 54px; }
  .lager-stat-item .stat-n { font-size: 1.1rem; }
  .lager-stat-item .stat-label { font-size: 0.58rem; }
}

/* ── Wizard / Field-Inputs ───────────────────────────────────────────── */
.wizard-context {
  background: #f0f2f5; border-radius: 8px; padding: 12px;
  margin-bottom: 14px; font-size: 0.9rem;
}
.wizard-context .wc-id { font-family: 'Courier New', monospace; font-weight: bold; color: #c1003a; }
.wizard-context .wc-name { font-weight: bold; font-size: 1.05rem; margin-top: 4px; }
.wizard-context .wc-meta { color: #666; font-size: 0.82rem; margin-top: 2px; }

.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 0.82rem; font-weight: bold; color: #555;
  text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 4px;
}
.field-hint { font-size: 0.78rem; margin-top: 4px; min-height: 18px; }
.field-hint.error { color: #842029; font-weight: bold; }
.field-hint.ok    { color: #0a3622; font-weight: bold; }

/* ── Lager-Detail-Modal-Erweiterungen ─────────────────────────────────── */
.checklist {
  display: flex; flex-direction: column; gap: 8px;
  margin: 14px 0;
  padding: 14px;
  background: #fff7e6;
  border: 2px solid #ffc107;
  border-radius: 8px;
}
.checklist-title {
  font-size: 0.82rem; font-weight: bold; color: #856404;
  text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 4px;
}
.checklist label {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.95rem; font-weight: bold; color: #333;
  cursor: pointer; padding: 8px 10px;
  background: white; border-radius: 6px;
  border: 1px solid #f0e4b0;
}
.checklist label.checked {
  background: #d1e7dd; border-color: #28a745; color: #0a3622;
}
.checklist input[type="checkbox"] {
  width: 22px; height: 22px; accent-color: #c1003a; cursor: pointer;
}

.zielinfo-tag {
  display: inline-block; padding: 3px 10px; border-radius: 6px;
  font-size: 0.78rem; font-weight: bold; margin-left: 6px;
}
.zielinfo-tag.verkauf { background: #cfe2ff; color: #084298; }
.zielinfo-tag.intern  { background: #e2e3e5; color: #383d41; }

/* ── Main ─────────────────────────────────────────────────────────────── */
.app-main { max-width: 1000px; margin: 0 auto; padding: 14px; }

.card {
  background: white; border-radius: 10px; padding: 16px;
  margin-bottom: 14px; box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.toolbar .btn { flex: 0 0 auto; min-width: 160px; }

.selection-bar {
  display: none; margin-top: 12px; padding: 10px 12px;
  background: #fff3cd; border: 2px solid #ffc107; border-radius: 8px;
  align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 0.88rem; font-weight: bold; color: #856404;
}
.selection-bar.visible { display: flex; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  padding: 11px 16px; border: none; border-radius: 7px;
  font-size: 0.92rem; font-weight: bold; cursor: pointer;
  transition: opacity 0.15s, transform 0.05s;
  touch-action: manipulation; min-height: 42px;
}
.btn:hover { opacity: 0.88; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-primary   { background: #c1003a; color: white; }
.btn-success   { background: #1d6f42; color: white; }
.btn-warning   { background: #fd7e14; color: white; }
.btn-danger    { background: #dc3545; color: white; }
.btn-secondary { background: #6c757d; color: white; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; min-height: 32px; }
.btn-block { width: 100%; }

/* ── Filter / Suche ───────────────────────────────────────────────────── */
.filter-row {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px;
}
.filter-btn {
  background: white; border: 2px solid #ddd; border-radius: 22px;
  padding: 10px 16px; font-size: 0.85rem; font-weight: bold;
  cursor: pointer; color: #666; min-height: 40px;
  touch-action: manipulation;
}
.filter-btn:active { transform: scale(0.97); }
.filter-btn.active { background: #c1003a; color: white; border-color: #c1003a; }

.search-input {
  width: 100%; padding: 9px 12px; border: 2px solid #ddd; border-radius: 6px;
  font-size: 16px; background: #fafafa; margin-bottom: 8px;
}
.search-input:focus { outline: none; border-color: #c1003a; background: white; }

.count-line { font-size: 0.78rem; color: #999; margin-bottom: 8px; }

/* ── Liste ────────────────────────────────────────────────────────────── */
.list-item {
  background: white; border-radius: 8px; padding: 12px;
  margin-bottom: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  display: flex; align-items: center; gap: 12px;
  border-left: 4px solid #28a745;
  transition: box-shadow 0.15s;
}
.list-item.dringend { border-left-color: #dc3545; }
.list-item.selected { background: #fff7e6; box-shadow: 0 1px 3px rgba(193,0,58,0.15); border-left-color: #c1003a; }

.li-checkbox {
  width: 22px; height: 22px; cursor: pointer; flex-shrink: 0;
  accent-color: #c1003a;
}
.li-del {
  background: transparent; border: none; cursor: pointer;
  font-size: 1.2rem; padding: 0;
  width: 44px; height: 44px; border-radius: 8px;
  color: #999; flex-shrink: 0; opacity: 0.6;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
  touch-action: manipulation;
}
.li-del:hover, .li-del:active { opacity: 1; background: #f8d7da; color: #842029; }
.reorder-tag {
  display: inline-block; background: #fff3cd; color: #856404;
  border-radius: 10px; padding: 1px 8px; margin-left: 4px;
  font-size: 0.7rem; font-weight: bold; vertical-align: middle;
}
.btn-row-del {
  background: transparent; border: none; cursor: pointer;
  font-size: 1.1rem; padding: 0;
  width: 36px; height: 36px; border-radius: 6px;
  color: #999; opacity: 0.7;
  display: inline-flex; align-items: center; justify-content: center;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
  touch-action: manipulation;
}
.btn-row-del:hover, .btn-row-del:active {
  opacity: 1; background: #f8d7da; color: #842029;
}
.li-main { flex: 1; min-width: 0; cursor: pointer; }
.li-id   { font-family: 'Courier New', monospace; font-size: 0.78rem; color: #888; }
.li-title { font-weight: bold; font-size: 1rem; color: #111; margin: 2px 0; }
.li-sub   { font-size: 0.78rem; color: #666; }
.li-meta  { font-size: 0.76rem; color: #555; margin-top: 4px; }

.li-position {
  display: inline-block; margin-top: 6px;
  padding: 5px 10px; border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-weight: 900; font-size: 0.92rem;
  letter-spacing: 0.6px;
}
.li-position.vor { background: #cfe2ff; color: #084298; border: 2px solid #084298; }
.li-position.in  { background: #ffe0cc; color: #884d11; border: 2px solid #884d11; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 0.7rem; font-weight: bold; text-transform: uppercase; white-space: nowrap;
}
.badge-yellow { background: #fff3cd; color: #856404; }
.badge-purple { background: #e9d5ff; color: #6b21a8; }
.badge-blue   { background: #cfe2ff; color: #084298; }
.badge-orange { background: #ffe0cc; color: #884d11; }
.badge-green  { background: #d1e7dd; color: #0a3622; }
.badge-red    { background: #f8d7da; color: #842029; }
.badge-gray   { background: #e2e3e5; color: #383d41; }

.empty-state {
  text-align: center; color: #888; padding: 40px 16px;
  font-size: 0.95rem; line-height: 1.5;
  background: #fafafa; border-radius: 8px; border: 2px dashed #ddd;
}
.empty-state .emoji { font-size: 2rem; display: block; margin-bottom: 8px; opacity: 0.5; }
.empty-state strong { color: #444; }

.alert {
  padding: 12px 14px; border-radius: 8px;
  margin-bottom: 12px; font-size: 0.92rem; font-weight: bold;
  display: flex; align-items: flex-start; gap: 10px;
  line-height: 1.4;
}
.alert::before {
  font-size: 1.15rem; line-height: 1; flex-shrink: 0;
}
.alert-error::before   { content: '⛔'; }
.alert-success::before { content: '✓'; }
.alert-info::before    { content: 'ℹ'; }
.alert-error   { background: #f8d7da; color: #842029; border: 2px solid #dc3545; }
.alert-success { background: #d1e7dd; color: #0a3622; border: 2px solid #28a745; }
.alert-info    { background: #cff4fc; color: #055160; border: 2px solid #0dcaf0; }

/* ── Modals ───────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 150; align-items: flex-start; justify-content: center; padding: 20px;
  overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white; border-radius: 10px; padding: 22px;
  max-width: 520px; width: 100%; margin: auto;
  max-height: 90vh; overflow-y: auto;
}
.modal-wide { max-width: 820px; }
.modal h3 {
  font-size: 1.1rem; color: #333; margin-bottom: 12px;
  padding-bottom: 8px; border-bottom: 2px solid #c1003a;
}
.modal-row {
  display: flex; justify-content: space-between; padding: 6px 0;
  border-bottom: 1px solid #f0f0f0; font-size: 0.9rem; gap: 12px;
}
.modal-row:last-of-type { border-bottom: none; }
.ml { color: #888; flex-shrink: 0; }
.mv { font-weight: bold; text-align: right; word-break: break-word; }
.modal-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1; min-width: 120px; }
.modal-close {
  background: white; border: 2px solid #ddd; color: #666;
  padding: 12px 18px; border-radius: 8px; font-size: 0.95rem;
  cursor: pointer; min-height: 44px; font-weight: bold;
  touch-action: manipulation;
}
.modal-close:active { background: #f0f2f5; }

/* ── Import-Vorschau-Tabelle ─────────────────────────────────────────── */
.imp-summary { font-size: 0.85rem; color: #666; margin-bottom: 10px; }
.imp-table-wrap {
  max-height: 50vh; overflow: auto; border: 1px solid #eee; border-radius: 6px;
}
.imp-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.imp-table th {
  background: #f0f2f5; padding: 6px 8px; text-align: left;
  border-bottom: 1px solid #ddd; position: sticky; top: 0;
}
.imp-table td { padding: 5px 8px; border-bottom: 1px solid #f0f0f0; }
.imp-table tr.rej { background: #fff5f5; color: #842029; }
.imp-table tr.acc { background: #f5fff7; }
.imp-table tr.blocking {
  background: #f8d7da !important;
  color: #842029;
  font-weight: bold;
  border-left: 4px solid #dc3545;
}

.warn-tag {
  display: inline-block;
  background: #fff3cd; color: #856404;
  border: 1px solid #ffc107; border-radius: 4px;
  padding: 2px 6px; font-size: 0.72rem; font-weight: bold;
  white-space: nowrap;
}

/* ── Verlaufslog im Detail ───────────────────────────────────────────── */
.log-section {
  margin-top: 14px;
}
.log-title {
  font-size: 0.74rem; color: #999; text-transform: uppercase;
  font-weight: bold; margin-bottom: 6px; letter-spacing: 0.4px;
}
.log-entry {
  font-size: 0.78rem; color: #555; padding: 4px 0;
  border-bottom: 1px solid #f0f0f0;
}

/* ── Print-Root: ausgeblendet auf dem Screen ────────────────────────── */
.print-root { display: none; }
