/* ============================================================
   🧰 Benötigt (needs.js) + 📌 Bezugsobjekt im Assistenten
   Retro-Stil wie style.css: harte Kanten, Hard-Shadows, nur Tokens,
   keine Gradients.
   ============================================================ */

/* ---------- Karte ---------- */
.nd-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 6px;
}
.nd-head h3 { margin: 0; }
.nd-count {
  font-family: var(--px); font-size: .55rem; font-weight: 700; color: var(--muted);
}
.nd-count:empty { display: none; }
.nd-sum {
  font-family: var(--px); font-size: .55rem; font-weight: 700;
  padding: 2px 7px; border: 2px solid var(--line);
  box-shadow: 2px 2px 0 var(--shadow-c);
  animation: pop .25s steps(3, end);
}
.nd-sum.ok { background: var(--ok); color: #fff; }
.nd-sum.warn { background: var(--danger); color: #fff; }
.nd-addbtn { margin-left: auto; padding: 6px 10px; font-size: .62rem; }
.nd-addbtn.on { background: var(--accent-soft); border-color: var(--accent); }

.nd-empty {
  color: var(--muted); font-size: .85rem; padding: 10px 4px 4px; line-height: 1.5;
}
.nd-empty span { font-size: 1.2rem; margin-right: 4px; }
.nd-empty small { font-size: .75rem; }
.nd-none { color: var(--muted); font-size: .78rem; padding: 4px 6px 6px; }

/* Abschnitte (Termin: aus Projekt / nur dieser Termin) */
.nd-sec + .nd-sec { margin-top: 6px; }
.nd-sechead {
  display: block;
  font-family: var(--px); font-size: .55rem; font-weight: 700; text-transform: uppercase;
  color: var(--muted); padding: 6px 4px 3px;
  border-bottom: 1px dashed var(--border);
}
a.nd-sechead:hover { color: var(--accent); }

/* ---------- Zeile ---------- */
.nd-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
}
.nd-row:last-child { border-bottom: none; }
.nd-row.short, .nd-row.broken, .nd-row.expired, .nd-row.gone {
  border-left-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 7%, transparent);
}
.nd-row.nd-out { opacity: .35; }
.nd-row.nd-flash { animation: nd-flash .45s steps(2, end) 3; }
@keyframes nd-flash { 50% { background: var(--accent-soft); outline: 2px solid var(--accent); } }
.nd-emo { flex: none; width: 22px; text-align: center; font-size: 1rem; }
.nd-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nd-name {
  font-weight: 700; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
a.nd-name:hover { color: var(--accent); }
.nd-name.gone { text-decoration: line-through; color: var(--muted); }
.nd-path {
  color: var(--muted); font-size: .7rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nd-note { font-style: italic; }
.nd-qty {
  flex: none; display: inline-flex; align-items: center; gap: 3px;
  font-family: var(--px); font-size: .55rem; font-weight: 700; color: var(--muted);
}
.nd-qty i { font-style: normal; }
.nd-qty input {
  width: 54px; padding: 3px 4px; text-align: right;
  border: 2px solid var(--line); background: var(--surface); color: var(--text);
  font-family: var(--px); font-size: .62rem; font-weight: 700;
}
.nd-st {
  flex: none; white-space: nowrap;
  font-family: var(--px); font-size: .52rem; font-weight: 700;
  padding: 2px 6px; border: 1px solid var(--border); color: var(--muted);
}
.nd-st.ok { color: var(--ok); border-color: var(--ok); }
.nd-st.soon { color: #e8a33d; border-color: #e8a33d; }
.nd-st.short, .nd-st.broken, .nd-st.expired, .nd-st.gone {
  color: #fff; background: var(--danger); border-color: var(--line);
}
.nd-btn {
  flex: none; border: none; background: none; cursor: pointer;
  color: var(--muted); padding: 2px 5px; font-weight: 800; font-size: .8rem;
}
.nd-btn:hover { background: var(--accent-soft); color: var(--accent); }
.nd-btn.nd-rm:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }

/* ---------- ＋ Gegenstand ---------- */
.nd-add {
  border: 2px solid var(--line); background: var(--surface-2);
  box-shadow: 3px 3px 0 var(--shadow-c);
  padding: 8px; margin: 10px 0 4px;
  display: flex; flex-direction: column; gap: 6px;
  animation: pop .15s steps(3, end);
}
.nd-add .nd-search { margin: 0; }
.nd-target { display: flex; gap: 6px; flex-wrap: wrap; }
.nd-sugs { display: flex; flex-direction: column; gap: 3px; max-height: 280px; overflow: auto; }
.nd-sug {
  display: flex; align-items: center; gap: 8px; text-align: left;
  border: 2px solid transparent; background: var(--surface);
  padding: 5px 6px; cursor: pointer; color: var(--text);
}
.nd-sug:hover, .nd-sug.act { border-color: var(--accent); background: var(--accent-soft); }
.nd-sug.has { opacity: .6; }
.nd-sugname {
  flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nd-sugname small { color: var(--muted); font-weight: 400; font-size: .7rem; overflow: hidden; text-overflow: ellipsis; }
.nd-has { flex: none; font-family: var(--px); font-size: .5rem; font-weight: 700; color: var(--ok); }

/* ---------- Item-Modal: 🛠️ Gebraucht für ---------- */
.nd-usage {
  border: 2px solid var(--line); background: var(--surface-2);
  padding: 6px 8px; margin: 10px 0 4px;
}
.nd-uhead {
  font-family: var(--px); font-size: .58rem; font-weight: 700; text-transform: uppercase;
  color: var(--muted); margin-bottom: 4px;
}
.nd-urow { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.nd-ulink { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nd-urow small { flex: none; color: var(--muted); font-size: .7rem; }

/* ---------- Wochenplan: 🧰-Badge im Terminblock ---------- */
.event-block .ev-needs {
  display: inline-block; margin-left: 4px; padding: 0 3px;
  font-size: .6rem; font-weight: 700; line-height: 1.3;
  background: rgba(10, 8, 16, .45);
  border-radius: 2px; vertical-align: 1px;
}
.event-block .ev-needs.warn { background: var(--danger); animation: nd-blink 1.6s steps(2, end) infinite; }
@keyframes nd-blink { 50% { opacity: .55; } }

/* ============ Assistent: 📌 Bezugsobjekt ============ */
.ai-focus {
  flex: none; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 5px 8px 6px var(--ai-pad, 12px);
  background: var(--surface-2);
  border-bottom: 2px solid var(--line);
}
.ai-focus.hidden { display: none; }
.ai-pin {
  display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%;
  border: 2px solid var(--accent); background: var(--accent-soft); color: var(--text);
  box-shadow: 2px 2px 0 var(--shadow-c);
  font-family: var(--px); font-size: .55rem; font-weight: 700;
  padding: 2px 2px 2px 6px;
}
.ai-pin.route { border-color: var(--line); background: var(--surface); }
.ai-pin-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-pin-x {
  flex: none; border: none; background: none; cursor: pointer; color: var(--muted);
  font-weight: 800; padding: 0 5px; font-size: .7rem;
}
.ai-pin-x:hover { color: var(--danger); }
.ai-pin-off {
  font-family: var(--px); font-size: .5rem; font-weight: 700; color: var(--muted);
  border: 1px dashed var(--border); padding: 2px 6px; cursor: pointer; background: none;
}
.ai-pin-off:hover { color: var(--text); border-color: var(--accent); }
.ai-mini {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-family: var(--px); font-size: .5rem; font-weight: 700;
  padding: 3px 6px; cursor: pointer; box-shadow: 1px 1px 0 var(--shadow-c);
}
.ai-mini:hover { background: var(--accent-soft); border-color: var(--accent); }
.ai-mini:active { transform: translate(1px, 1px); box-shadow: none; }
.ai-chip-ok.mem { background: var(--accent); }
