* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Poppins', sans-serif; background: #fafafa; color: #1a1a1a; min-height: 100vh; padding: 40px 24px; }
.wrap { max-width: 880px; margin: 0 auto; }

.topbar { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid #ececec; gap: 16px; flex-wrap: wrap; }
.logo { height: 52px; width: auto; }
.header-left { display: flex; align-items: center; gap: 18px; }
h1 { font-weight: 600; font-size: 18px; letter-spacing: 0.01em; color: #1a1a1a; }

.btn-ghost { font-family: 'Poppins', sans-serif; font-size: 12px; font-weight: 500; background: #fff; border: 1px solid #e2e2e2; border-radius: 8px; padding: 9px 16px; cursor: pointer; color: #555; letter-spacing: 0.02em; transition: all 0.15s; }
.btn-ghost:hover { background: #f5f5f5; border-color: #d5d5d5; }

.user-chip { font-size: 11px; color: #999; letter-spacing: 0.02em; margin-right: 4px; }

.summary-bar { display: flex; gap: 12px; margin-bottom: 28px; flex-wrap: wrap; }
.summary-chip { background: #fff; border: 1px solid #ececec; border-radius: 10px; padding: 14px 20px; display: flex; flex-direction: column; gap: 3px; min-width: 100px; }
.summary-chip .num { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
.summary-chip .lbl { font-size: 11px; font-weight: 400; color: #999; letter-spacing: 0.03em; text-transform: uppercase; }
.num-ok { color: #3D5A40; } .num-warn { color: #b8860b; } .num-crit { color: #a14438; } .num-neutral { color: #1a1a1a; }

.card { background: #fff; border: 1px solid #ececec; border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.card.warn { border-color: #ecd9a8; }
.card.critical { border-color: #e3bcb3; }
.card.ordered { border-color: #b8d4c0; }

.card-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; cursor: pointer; user-select: none; }
.card-header:hover { background: #fbfbfb; }
.card-title { font-weight: 500; font-size: 14.5px; letter-spacing: 0.01em; color: #1a1a1a; }
.card-sub { font-size: 11px; font-weight: 400; color: #b3b3b3; margin-top: 3px; letter-spacing: 0.01em; }

.badge { font-size: 11.5px; font-weight: 600; padding: 5px 12px; border-radius: 20px; letter-spacing: 0.02em; }
.badge-ok { background: #eef3ee; color: #3D5A40; }
.badge-warn { background: #fbf2dd; color: #95710a; }
.badge-crit { background: #f8e6e2; color: #a14438; }
.badge-ordered { background: #e4f0e8; color: #2e6b3e; }

.card-body { padding: 0 22px 22px; border-top: 1px solid #f2f2f2; }

.meta-row { display: flex; gap: 28px; font-size: 12px; font-weight: 400; color: #999; margin: 18px 0 18px; flex-wrap: wrap; letter-spacing: 0.01em; }
.meta-row b { color: #1a1a1a; font-weight: 600; }

.boxcount-display { display: flex; align-items: baseline; gap: 10px; margin: 18px 0 18px; }
.boxcount-num { font-size: 38px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.boxcount-num.ok { color: #3D5A40; }
.boxcount-num.warn { color: #b8860b; }
.boxcount-num.critical { color: #a14438; }
.boxcount-num.ordered { color: #3D5A40; }
.boxcount-label { font-size: 12px; font-weight: 400; color: #999; letter-spacing: 0.02em; }

/* Forecast-Zeile */
.forecast-row {
  display: flex; gap: 16px; flex-wrap: wrap;
  background: #f7f7f7; border-radius: 8px;
  padding: 10px 14px; margin-bottom: 16px;
  font-size: 12px; color: #666;
}
.forecast-row span b { color: #1a1a1a; font-weight: 600; }
.forecast-row span.warn-txt { color: #b8860b; font-weight: 500; }
.forecast-row span.crit-txt { color: #a14438; font-weight: 500; }
.forecast-row span.ok-txt { color: #3D5A40; font-weight: 500; }

/* Nachbestellt-Banner */
.ordered-banner {
  background: #e8f2eb; border: 1px solid #b8d4c0; border-radius: 8px;
  padding: 11px 16px; font-size: 12px; color: #2a5c38;
  margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.ordered-banner .ob-left { display: flex; flex-direction: column; gap: 2px; }
.ordered-banner b { font-weight: 600; }
.btn-cancel-order {
  font-family: 'Poppins', sans-serif; font-size: 11px; font-weight: 500;
  background: none; border: 1px solid #8fbfa0; border-radius: 6px;
  padding: 4px 10px; cursor: pointer; color: #2a5c38; white-space: nowrap;
}
.btn-cancel-order:hover { background: #d6eadc; }

.strichliste-top { font-size: 11px; font-weight: 400; color: #b3b3b3; margin-bottom: 10px; letter-spacing: 0.02em; }
.striche { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 18px; }
.strich-group { display: flex; gap: 2px; margin-right: 6px; margin-bottom: 4px; }
.strich { width: 20px; height: 30px; border: 1.5px solid #3D5A40; border-radius: 3px; position: relative; }
.strich.used::after { content: ''; position: absolute; top: 50%; left: 50%; width: 130%; height: 1.5px; background: #c5c5c5; transform: translate(-50%, -50%) rotate(-18deg); }
.strich.used { border-color: #d8d8d8; }

.alert-box { border-radius: 8px; padding: 11px 16px; font-size: 12px; font-weight: 400; margin-bottom: 18px; letter-spacing: 0.01em; }
.alert-crit { background: #fbf0ee; border: 1px solid #f0d4cd; color: #8a3c2e; }
.alert-warn { background: #fdf8ec; border: 1px solid #f3e3b8; color: #7d5e0c; }
.alert-box b { font-weight: 600; }

.action-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-remove, .btn-add, .btn-order {
  font-family: 'Poppins', sans-serif; font-size: 12.5px; font-weight: 500;
  border-radius: 8px; padding: 10px 18px; cursor: pointer;
  letter-spacing: 0.02em; border: none; text-align: center;
}
.btn-remove { background: #fff; border: 1px solid #e2e2e2; color: #555; flex: 1; }
.btn-remove:hover { background: #f5f5f5; }
.btn-remove:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-add { background: #3D5A40; color: #fff; flex: 1; }
.btn-add:hover { background: #2e4430; }
.btn-order { background: #fff; border: 1px solid #e2e2e2; color: #555; flex: 1; }
.btn-order:hover { background: #f5f5f5; }

.expand-icon { font-size: 11px; font-weight: 400; color: #c5c5c5; margin-left: 12px; }

/* Modals */
.overlay { display: none; position: fixed; inset: 0; background: rgba(20,20,20,0.4); z-index: 200; align-items: center; justify-content: center; }
.overlay.open { display: flex; }
.modal { background: #fff; border-radius: 14px; padding: 32px; width: 380px; max-width: 92vw; box-shadow: 0 12px 40px rgba(0,0,0,0.15); }
.modal h3 { font-size: 16px; font-weight: 600; color: #1a1a1a; margin-bottom: 22px; letter-spacing: 0.01em; }
.field { margin-bottom: 16px; }
.field label { font-size: 11.5px; font-weight: 500; color: #999; display: block; margin-bottom: 6px; letter-spacing: 0.02em; text-transform: uppercase; }
.field input { width: 100%; font-family: 'Poppins', sans-serif; border: 1px solid #e2e2e2; border-radius: 8px; padding: 10px 12px; font-size: 14px; color: #1a1a1a; }
.field input:focus { outline: none; border-color: #3D5A40; }
.field-hint { font-size: 11px; color: #b3b3b3; margin-top: 6px; }
.modal-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }
.modal-btns button { font-family: 'Poppins', sans-serif; padding: 10px 22px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; border: none; letter-spacing: 0.01em; }
.btn-cancel { background: #f5f5f5; color: #666; } .btn-cancel:hover { background: #ececec; }
.btn-save { background: #3D5A40; color: #fff; } .btn-save:hover { background: #2e4430; }

.settings-row { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 10px; margin-bottom: 14px; align-items: end; }
.settings-row label { font-size: 10.5px; font-weight: 500; color: #999; display: block; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.02em; }
.settings-row input { width: 100%; font-family: 'Poppins', sans-serif; border: 1px solid #e2e2e2; border-radius: 7px; padding: 8px 10px; font-size: 13px; }
.settings-name { font-size: 13px; font-weight: 500; padding-top: 8px; color: #1a1a1a; }

/* Verlauf */
.history-section { margin-top: 36px; border-top: 1px solid #ececec; padding-top: 24px; }
.history-toggle { display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; padding: 4px 0; }
.history-toggle:hover .history-toggle-label { color: #666; }
.history-toggle-label { font-size: 12px; font-weight: 500; color: #999; letter-spacing: 0.03em; text-transform: uppercase; }
.history-arrow { font-size: 10px; color: #c5c5c5; transition: transform 0.2s; }
.history-list { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.history-empty { font-size: 12px; color: #c5c5c5; margin-top: 16px; font-style: italic; }
.history-row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: #666; padding: 10px 14px; background: #fff; border: 1px solid #ececec; border-radius: 8px; }
.history-row .h-action { font-weight: 500; color: #1a1a1a; display: flex; align-items: center; gap: 9px; }
.h-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.h-dot.removed { background: #a14438; }
.h-dot.added { background: #3D5A40; }
.h-dot.order { background: #2e6b9e; }
.history-row .h-time { color: #b3b3b3; font-size: 11px; flex-shrink: 0; margin-left: 16px; }

/* Toast Notifications */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: #1a1a1a; color: #fff; font-family: 'Poppins', sans-serif;
  font-size: 12.5px; font-weight: 400; padding: 11px 20px;
  border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  z-index: 999; opacity: 0; transition: opacity 0.2s;
  pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; }
.toast.error { background: #a14438; }
.toast.success { background: #3D5A40; }

/* ── Login-Seite ─────────────────────────────────────────── */
body.login-page { display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  background: #fff; border: 1px solid #ececec; border-radius: 16px;
  padding: 40px 36px; width: 400px; max-width: 94vw;
  box-shadow: 0 10px 40px rgba(0,0,0,0.06);
}
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-bottom: 28px; text-align: center; }
.login-brand .logo { height: 60px; }
.login-brand h1 { font-size: 17px; font-weight: 600; }
.login-brand p { font-size: 12px; color: #999; font-weight: 400; }
.login-card .field label { text-transform: none; font-size: 12px; }
.login-card .field input { padding: 12px 14px; }
.btn-login {
  width: 100%; font-family: 'Poppins', sans-serif; background: #3D5A40; color: #fff;
  border: none; border-radius: 8px; padding: 13px; font-size: 14px; font-weight: 500;
  cursor: pointer; letter-spacing: 0.02em; margin-top: 8px; transition: background 0.15s;
}
.btn-login:hover { background: #2e4430; }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; }
.login-error {
  background: #fbf0ee; border: 1px solid #f0d4cd; color: #8a3c2e;
  border-radius: 8px; padding: 10px 14px; font-size: 12.5px; margin-bottom: 16px; display: none;
}
.login-error.show { display: block; }
.login-foot { text-align: center; font-size: 11px; color: #c5c5c5; margin-top: 22px; }

/* ============================================================
   v2 – Übersichtlicheres Layout, Zahnrad pro Artikel, Mobile
   ============================================================ */

/* Rollen: Elemente nur fuer Admin */
body.role-team .admin-only { display: none !important; }

/* Topbar-Aktionen */
.topbar-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
a.btn-ghost { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.btn-primary {
  font-family: 'Poppins', sans-serif; font-size: 12.5px; font-weight: 500;
  background: #3D5A40; color: #fff; border: none; border-radius: 8px;
  padding: 9px 16px; cursor: pointer; letter-spacing: 0.02em; transition: background 0.15s; white-space: nowrap;
}
.btn-primary:hover { background: #2e4430; }

/* Karten-Kopf: Titel + kompakte Status-Zeile links, Aktionen rechts */
.card-header { gap: 14px; }
.card-head-main { min-width: 0; }
.card-head-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.card-status-line {
  font-size: 12px; color: #999; margin-top: 4px; letter-spacing: 0.01em;
  display: flex; align-items: center; gap: 7px;
}
.card-status-line.status-critical { color: #a14438; font-weight: 500; }
.card-status-line.status-warn { color: #95710a; font-weight: 500; }
.card-status-line.status-ordered { color: #2e6b3e; font-weight: 500; }
.card-status-line .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.dot.ok { background: #3D5A40; } .dot.warn { background: #d9a72a; }
.dot.crit { background: #a14438; } .dot.ordered { background: #2e6b3e; }

/* Zahnrad / Icon-Button */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid #ececec;
  background: #fff; color: #888; cursor: pointer; padding: 0; transition: all 0.15s;
}
.icon-btn:hover { background: #f5f5f5; color: #3D5A40; border-color: #d9d9d9; }

/* Chevron dreht sich beim Aufklappen */
.expand-icon { font-size: 15px; color: #c5c5c5; margin-left: 2px; transition: transform 0.2s; width: 16px; text-align: center; }
.card.open .expand-icon { transform: rotate(180deg); color: #3D5A40; }

/* Zwei-Spalten-Felder im Modal */
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Modal-Fußzeile mit Löschen links */
.modal-btns-split { justify-content: space-between; align-items: center; }
.modal-btns-right { display: flex; gap: 10px; }
.btn-danger {
  font-family: 'Poppins', sans-serif; padding: 10px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 500; cursor: pointer; border: 1px solid #e6c6bf;
  background: #fff; color: #a14438; letter-spacing: 0.01em;
}
.btn-danger:hover { background: #fbf0ee; }

/* Leerer Zustand */
.empty-state {
  text-align: center; padding: 48px 20px; background: #fff;
  border: 1px dashed #dcdcdc; border-radius: 12px; color: #999;
}
.empty-state p { margin-bottom: 16px; font-size: 14px; }

.summary-chip.stand { margin-left: auto; }

/* ---------- Mobiloptimierung ---------- */
@media (max-width: 640px) {
  body { padding: 20px 12px; }

  .topbar { flex-direction: column; align-items: stretch; gap: 14px; margin-bottom: 22px; padding-bottom: 18px; }
  .header-left { gap: 14px; }
  .logo { height: 42px; }
  h1 { font-size: 16px; }
  .topbar-actions { width: 100%; }
  .user-chip { flex-basis: 100%; order: -1; }
  .topbar-actions .btn-primary, .topbar-actions .btn-ghost { flex: 1; padding: 11px 14px; font-size: 13px; }

  .summary-bar { gap: 8px; }
  .summary-chip { flex: 1; min-width: 0; padding: 12px 10px; align-items: center; text-align: center; }
  .summary-chip .num { font-size: 20px; }
  .summary-chip .lbl { font-size: 9.5px; }
  .summary-chip.stand { flex-basis: 100%; margin-left: 0; flex-direction: row; justify-content: center; gap: 8px; }

  .card-header { padding: 15px 16px; }
  .card-body { padding: 0 16px 18px; }
  .card-title { font-size: 15px; }
  .card-status-line { font-size: 11.5px; }
  .card-head-right { gap: 6px; }
  .badge { font-size: 11px; padding: 5px 10px; }

  .meta-row { gap: 8px 16px; font-size: 11.5px; margin: 14px 0; }
  .boxcount-num { font-size: 32px; }

  /* Aktions-Buttons: große Touch-Ziele, umbrechen */
  .action-row { gap: 8px; }
  .action-row button { flex: 1 1 100%; padding: 13px; font-size: 13.5px; }
  .btn-add { order: -1; }

  /* Modals fast bildschirmfüllend, angenehm bedienbar */
  .modal { padding: 24px 20px; width: 100%; border-radius: 14px; }
  .field input { padding: 12px 12px; font-size: 15px; }
  .modal-btns button, .btn-danger { padding: 12px 16px; }
  .modal-btns-split { flex-direction: column-reverse; align-items: stretch; gap: 10px; }
  .modal-btns-right { justify-content: flex-end; }

  .ordered-banner { flex-direction: column; align-items: flex-start; }
  .history-row { flex-wrap: wrap; gap: 4px; }
}

@media (max-width: 380px) {
  .field-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Startseite / Tool-Übersicht (Launcher)
   ============================================================ */
body.home { background: #fafafa; padding: 0; }
.home-wrap { max-width: 760px; margin: 0 auto; padding: 28px 24px 48px; }
.home-userbar { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-bottom: 20px; }
.home-head { text-align: center; margin-bottom: 40px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.home-head .logo { height: 64px; width: auto; }
.home-head h1 { font-size: 22px; font-weight: 600; color: #1a1a1a; letter-spacing: 0.01em; }
.home-head p { font-size: 13px; color: #999; font-weight: 400; margin-top: 4px; }

.tool-grid { display: grid; gap: 14px; }
.tool-card {
  display: flex; align-items: center; gap: 18px;
  background: #fff; border: 1px solid #ececec; border-radius: 14px;
  padding: 22px 24px; text-decoration: none; color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.tool-card:hover { border-color: #c8d6cb; box-shadow: 0 6px 20px rgba(61,90,64,0.08); transform: translateY(-1px); }
.tool-icon {
  width: 52px; height: 52px; border-radius: 12px; background: #eef3ee;
  display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0;
}
.tool-body { flex: 1; min-width: 0; }
.tool-body h2 { font-size: 16px; font-weight: 600; color: #1a1a1a; display: flex; align-items: center; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.tool-body p { font-size: 12.5px; color: #888; line-height: 1.5; }
.tool-tag {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: #3D5A40; background: #eef3ee; padding: 3px 8px; border-radius: 20px;
}
.tool-arrow { color: #c5c5c5; font-size: 18px; flex-shrink: 0; transition: transform 0.15s, color 0.15s; }
.tool-card:hover .tool-arrow { color: #3D5A40; transform: translateX(3px); }
.home-foot { text-align: center; margin-top: 40px; font-size: 11px; color: #c5c5c5; letter-spacing: 0.02em; }

@media (max-width: 640px) {
  .home-wrap { padding: 40px 16px 32px; }
  .home-head { margin-bottom: 28px; }
  .home-head .logo { height: 52px; }
  .home-head h1 { font-size: 19px; }
  .tool-card { padding: 18px; gap: 14px; }
  .tool-icon { width: 46px; height: 46px; font-size: 21px; }
}
