/* NAVO – Klick-Erfassung, Stempel- und Anmerkungsebene, Heften & Trennen, zugehörige Dokumente, Archiv-Regeln */

/* ---------- Klick-Erfassung ---------- */
.ki-bar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  padding: 4px 6px;
  margin-bottom: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.ki-bar button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 3px 9px;
  font: inherit;
  cursor: pointer;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ki-bar button.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.ki-bar .ki-onoff:not(.on) {
  color: var(--muted);
}
.ki-felder {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}
.ki-layer {
  position: absolute;
  z-index: 2;
}
.ki-layer .ki-w {
  position: absolute;
  border-radius: 2px;
  cursor: pointer;
}
.ki-layer .ki-w:hover,
.ki-text .ki-w:hover {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  outline: 1px solid var(--accent);
}
.ki-layer .ki-datum {
  background: color-mix(in srgb, #2563eb 13%, transparent);
}
.ki-layer .ki-betrag {
  background: color-mix(in srgb, #16a34a 15%, transparent);
}
.ki-layer .ki-nummer,
.ki-layer .ki-iban {
  background: color-mix(in srgb, #7c3aed 11%, transparent);
}
.ki-w.ki-ok {
  outline: 2px solid var(--ok);
}
.de-zeichnen .ki-layer {
  pointer-events: none;
}
.ki-text {
  margin-top: 10px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-align: left;
}
.ki-text-h {
  color: var(--muted);
  margin-bottom: 6px;
}
.ki-zeile {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: 3px;
}
.ki-chip {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 4px;
  padding: 2px 6px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  min-height: 28px;
}
.ki-chip.ki-datum {
  border-color: #2563eb;
}
.ki-chip.ki-betrag {
  border-color: #16a34a;
}
.ki-chip.ki-nummer,
.ki-chip.ki-iban {
  border-color: #7c3aed;
}
label.ki-ziel > input,
label.ki-ziel > span + input {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
label.ki-neu > input {
  animation: kiNeu 0.9s ease;
}
@keyframes kiNeu {
  0% {
    background: color-mix(in srgb, var(--ok) 35%, var(--panel));
  }
  100% {
    background: inherit;
  }
}
.ki-sicher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 4px 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 12px;
  font-weight: 600;
}
.ki-sicher-btn {
  border-color: var(--ok);
  color: var(--ok);
}
.stk-row-nr {
  grid-template-columns: 1.6fr 1fr;
}

/* ---------- Stempel und Anmerkungen ---------- */
.de-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin: 0 0 6px;
}
.de-bar .spacer {
  flex: 1;
}
.de-bar .btn.on {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.de-tools {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
}
.de-dd {
  position: relative;
}
.de-menu {
  position: absolute;
  z-index: 20;
  top: 100%;
  left: 0;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  min-width: 180px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.de-menu[hidden] {
  display: none;
}
.de-menu button {
  border: 0;
  background: none;
  text-align: left;
  padding: 6px;
  cursor: pointer;
  border-radius: var(--radius-xs);
}
.de-menu button:hover {
  background: var(--panel-2);
}
.de-layer {
  position: absolute;
  z-index: 3;
  pointer-events: none;
}
.de-layer.aus {
  display: none;
}
.de-zeichnen .de-layer {
  pointer-events: auto;
  cursor: crosshair;
  touch-action: none;
}
.de-layer .de-st,
.de-layer .de-a {
  pointer-events: auto;
}
.de-st {
  --sc: #475569;
  position: absolute;
  border: 0.16em solid var(--sc);
  color: var(--sc);
  background: color-mix(in srgb, #fff 78%, transparent);
  border-radius: 0.3em;
  padding: 0.15em 0.6em;
  line-height: 1.2;
  transform: rotate(-2deg);
  cursor: grab;
  touch-action: none;
  user-select: none;
  max-width: 45%;
}
.de-st.fest {
  cursor: default;
  opacity: 0.85;
  pointer-events: none;
}
.de-st b {
  display: block;
  font-size: 1em;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.de-st small {
  display: block;
  font-size: 0.8em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.de-a {
  position: absolute;
  --ac: #dc2626;
}
.de-marker {
  background: color-mix(in srgb, #fde047 45%, transparent);
  mix-blend-mode: multiply;
}
.de-rechteck {
  border: 2px solid var(--ac);
}
.de-schwaerzen {
  background: #000;
}
.de-notiz {
  background: #fef08a;
  color: #1f2937;
  font-size: 0.95em;
  padding: 3px 6px;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 25%);
  max-width: 40%;
  white-space: pre-wrap;
  cursor: pointer;
}
.de-pfeil {
  position: absolute;
  pointer-events: none;
}
.de-neu {
  border: 2px dashed var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.de-neu.de-pfeil {
  background: var(--accent);
  border: 0;
}

/* ---------- Zugehörige Dokumente ---------- */
.de-zug {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
}
.de-zh {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.de-zr {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
.de-zn {
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.de-zv {
  margin-top: 6px;
}

/* ---------- Heften & Trennen ---------- */
.hf-docs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}
.hf-doc {
  border-left: 4px solid hsl(var(--hf) 70% 45%);
}
.hf-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  max-height: 62vh;
  overflow: auto;
  padding: 4px;
}
.hf-p {
  width: 132px;
  padding: 5px;
  border: 1px solid var(--line);
  border-top: 4px solid hsl(var(--hf) 70% 45%);
  border-radius: var(--radius-sm);
  background: var(--panel);
  cursor: grab;
}
.hf-p.weg {
  opacity: 0.35;
}
.hf-th {
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform 0.15s;
}
.hf-th canvas,
.hf-th img {
  max-width: 120px;
  max-height: 150px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 20%);
}
.hf-meta {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin: 3px 0;
  white-space: nowrap;
  overflow: hidden;
}
.hf-act {
  display: flex;
  justify-content: space-between;
}
.hf-act button {
  min-width: 28px;
  min-height: 28px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: var(--radius-xs);
  cursor: pointer;
  color: var(--text);
}
.hf-cut {
  width: 22px;
  height: 120px;
  border: 1px dashed transparent;
  background: none;
  color: var(--faint);
  cursor: pointer;
  border-radius: var(--radius-xs);
  font-size: 15px;
}
.hf-cut:hover {
  border-color: var(--line);
  color: var(--text);
}
.hf-cut.on {
  border-color: var(--bad);
  color: var(--bad);
  background: color-mix(in srgb, var(--bad) 10%, transparent);
}
.hf-sum {
  margin-top: 8px;
}

/* ---------- Archiv-Regeln, Meine Freigaben ---------- */
.ar-st {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ar-eig {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.ar-eig input[type='color'] {
  width: 40px;
  height: 32px;
  padding: 0;
}
.ar-feld {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.ar-fr input,
.ar-fr select {
  width: 100%;
  min-width: 90px;
}
.ar-meine {
  margin-bottom: 14px;
}
.ar-mh {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.ar-mr {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}
.ar-mr.ueber b {
  color: var(--bad);
}
.ar-sk {
  display: block;
  color: var(--ok);
}
.gs-star {
  flex: 0 0 auto;
  min-height: 36px;
}

@media (max-width: 720px) {
  .ki-bar span:not(.ki-felder) {
    display: none;
  }
  .ki-bar .ki-onoff span {
    display: none;
  }
  .de-tools .btn span,
  .de-bar a span {
    display: none;
  }
  .hf-p {
    width: calc(50% - 20px);
  }
  .hf-cut {
    height: 40px;
  }
  .stk-row-nr {
    grid-template-columns: 1fr;
  }
}
