/* ═══════════════════════════════════════════════════════════════
   ALMAS Doku — Vertragsmodul (2026-08-09)
   Additive Schicht, nutzt ausschließlich die Tokens aus
   almas-doku-theme.css. Keine eigenen Farben.

   Haltung: Verträge werden nicht einmal am Tag angeschaut wie eine
   Startseite, sondern durchgearbeitet. Deshalb dichte Zeilen statt
   großer Karten, und die Unterschriftskette als sichtbare Leiste —
   die Reihenfolge SEPA → Kunde → Gegenzeichnung IST der Vertrag.
   ═══════════════════════════════════════════════════════════════ */

/* ─── Liste ─── */
.v-liste { display: flex; flex-direction: column; gap: 8px; }
.v-zeile {
  display: grid; grid-template-columns: 92px minmax(0,1fr) 150px 118px 132px;
  gap: 14px; align-items: center;
  background: var(--almas-surface); border: 1px solid var(--almas-border);
  border-radius: var(--radius-md); padding: 12px 16px;
  box-shadow: var(--almas-shadow); cursor: pointer;
  transition: box-shadow .16s ease, border-color .16s ease, transform .16s ease;
}
.v-zeile:hover { box-shadow: var(--almas-shadow-lg); border-color: var(--almas-border-strong); transform: translateY(-1px); }
.v-zeile:focus-visible { outline: 2px solid var(--almas-red-hover); outline-offset: 2px; }
.v-nr { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px; }
.v-nr small { display: block; font-weight: 500; color: var(--almas-text-muted); font-size: 11px; }
.v-titel { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-sub { color: var(--almas-text-secondary); font-size: 12px; margin-top: 2px;
         overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-geld { text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
.v-geld small { display: block; color: var(--almas-text-muted); font-size: 11px; }

/* Status-Badges */
.v-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap; letter-spacing: .01em;
}
.v-badge-entwurf        { background: #F1F1F4; color: #5C5F66; }
.v-badge-signatur_laeuft{ background: #FFF4E5; color: #94620A; }
.v-badge-vollstaendig   { background: #E8F6EC; color: #1B6E37; }
.v-badge-abgelehnt,
.v-badge-storniert      { background: rgba(255,35,37,.10); color: var(--almas-red-hover); }

/* Der Vertragspartner ist die wichtigste Unterscheidung im Bestand:
   bei AGL ist ALMAS nur Lieferant. Das muss man auf einen Blick sehen. */
.v-partner { font-size: 11.5px; font-weight: 600; color: var(--almas-text-secondary); }
.v-partner.fremd { color: var(--almas-red-hover); }
.v-partner small { display: block; font-weight: 500; color: var(--almas-text-muted); font-size: 10.5px; }

/* ─── Unterschriftskette ─── */
.v-kette { display: flex; align-items: stretch; gap: 0; margin: 4px 0 0; }
.v-kette-schritt {
  flex: 1; min-width: 0; position: relative; padding: 12px 14px;
  border: 1px solid var(--almas-border); background: var(--almas-surface);
}
.v-kette-schritt:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.v-kette-schritt:last-child  { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.v-kette-schritt + .v-kette-schritt { border-left: none; }
.v-kette-schritt.dran { border-color: var(--almas-red); box-shadow: inset 0 0 0 1px var(--almas-red); z-index: 1; }
.v-kette-schritt.fertig { background: #FAFCFA; }
.v-kette-schritt.extern { background: var(--almas-bg-alt); }
.v-kette-kopf { display: flex; align-items: center; gap: 8px; }
.v-kette-nr {
  width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; background: var(--almas-bg-alt); color: var(--almas-text-secondary);
}
.v-kette-schritt.fertig .v-kette-nr { background: #E8F6EC; color: #1B6E37; }
.v-kette-schritt.dran   .v-kette-nr { background: var(--almas-red-hover); color: #fff; }
.v-kette-rolle { font-weight: 700; font-size: 13px; }
.v-kette-meta { font-size: 11.5px; color: var(--almas-text-secondary); margin-top: 6px; line-height: 1.5; }
.v-kette-meta .hash { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 10px;
                      color: var(--almas-text-muted); word-break: break-all; }
.v-kette-knoepfe { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.v-kette-knoepfe .btn { margin: 0; }

/* ─── Editor ─── */
.v-editor-kopf {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 20px;
  flex-wrap: wrap; margin-bottom: 4px;
}
.v-editor-kopf h1 { margin: 0; font-size: 22px; }
.v-editor-kopf .v-sub { font-size: 13px; margin-top: 4px; white-space: normal; }
.v-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px 18px; }
.v-grid .voll { grid-column: 1 / -1; }
.v-hinweis-feld { font-size: 11.5px; color: var(--almas-text-muted); margin-top: 3px; }

/* Abweichung Kundenland ↔ Vertragsart. Nicht rot-blockierend: es gibt Ausnahmen,
   aber 19 statt 20 % über 60 Monate darf nicht still passieren. */
.v-warnung {
  display: flex; gap: 11px; align-items: flex-start;
  background: #FFF7E8; border: 1px solid #F2DCAE; border-left: 3px solid #D99A0B;
  border-radius: var(--radius-sm); padding: 11px 14px; margin: 0 0 16px; font-size: 13px;
}
.v-warnung strong { display: block; margin-bottom: 2px; }

.v-summe {
  background: var(--almas-bg-alt); border: 1px solid var(--almas-border);
  border-radius: var(--radius-md); padding: 13px 16px;
}
.v-summe-zeile { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13px; }
.v-summe-zeile.gesamt {
  border-top: 1px solid var(--almas-border-strong); margin-top: 7px; padding-top: 8px; font-weight: 700;
}
.v-summe-zeile span:last-child { font-variant-numeric: tabular-nums; }

/* Positionstabelle */
.v-pos { width: 100%; border-collapse: collapse; }
.v-pos th { text-align: left; font-size: 11.5px; color: var(--almas-text-muted); font-weight: 600; padding: 0 8px 5px 0; }
.v-pos td { padding: 0 8px 8px 0; vertical-align: top; }
.v-pos input { width: 100%; }
.v-pos .weg { width: 34px; }

/* Mehrfachauswahl als Kästchen — entspricht dem Papierformular */
.v-kaestchen { display: flex; flex-wrap: wrap; gap: 7px 9px; }
.v-kaestchen label {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500;
  border: 1px solid var(--almas-border); border-radius: 999px; padding: 6px 13px;
  cursor: pointer; user-select: none; background: var(--almas-surface);
  transition: border-color .14s ease, background .14s ease;
}
.v-kaestchen label:hover { border-color: var(--almas-border-strong); }
.v-kaestchen input { accent-color: var(--almas-red-hover); margin: 0; }
.v-kaestchen input:checked + span { font-weight: 700; color: var(--almas-red-hover); }
.v-kaestchen label:has(input:checked) { border-color: var(--almas-red); background: rgba(255,35,37,.05); }

/* ─── Signaturblatt (Tablet + Apple Pencil ist der Hauptfall) ─── */
.v-sigsheet-overlay {
  position: fixed; inset: 0; z-index: 900; background: rgba(16,17,22,.55);
  display: flex; align-items: center; justify-content: center; padding: 22px;
  backdrop-filter: blur(3px);
}
.v-sigsheet {
  background: var(--almas-surface); border-radius: var(--radius); width: min(920px, 100%);
  max-height: 100%; overflow: auto; box-shadow: var(--almas-shadow-lg); padding: 22px 24px 20px;
}
.v-sigsheet h2 { margin: 0 0 3px; font-size: 19px; }
.v-sigsheet .v-sub { white-space: normal; margin-bottom: 16px; }

/* Der „Schalter" Stift/Finger. Joshua 2026-08-08: fast alle Vertriebler
   haben einen Apple Pencil — aber nicht alle, und nicht immer dabei. */
.v-schalter {
  display: inline-flex; background: var(--almas-bg-alt); border-radius: 999px; padding: 3px;
  border: 1px solid var(--almas-border);
}
.v-schalter button {
  border: none; background: none; font: inherit; font-size: 13px; font-weight: 600;
  padding: 7px 18px; border-radius: 999px; cursor: pointer; color: var(--almas-text-secondary);
  display: inline-flex; align-items: center; gap: 7px; transition: background .16s ease, color .16s ease;
}
.v-schalter button[aria-pressed="true"] {
  background: var(--almas-surface); color: var(--almas-text); box-shadow: var(--almas-shadow);
}
.v-schalter button:focus-visible { outline: 2px solid var(--almas-red-hover); outline-offset: 1px; }

.v-sigleiste { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.v-sigmodus { font-size: 12px; color: var(--almas-text-muted); }

.v-canvas-rahmen {
  position: relative; border: 1px solid var(--almas-border-strong); border-radius: var(--radius-md);
  background: var(--almas-surface); overflow: hidden;
}
.v-canvas-rahmen canvas { display: block; width: 100%; height: 260px; touch-action: none; cursor: crosshair; }
/* Unterschriftslinie wie auf Papier — gibt dem Strich einen Bezug */
.v-canvas-rahmen::after {
  content: ""; position: absolute; left: 8%; right: 8%; bottom: 62px;
  border-bottom: 1px dashed var(--almas-border-strong); pointer-events: none;
}
.v-canvas-hint {
  position: absolute; left: 0; right: 0; bottom: 26px; text-align: center;
  font-size: 12px; color: var(--almas-text-muted); pointer-events: none;
}
.v-canvas-rahmen.hat-tinte::after,
.v-canvas-rahmen.hat-tinte .v-canvas-hint { opacity: 0; transition: opacity .2s ease; }

.v-sigfuss { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.v-sig-beweis { font-size: 11.5px; color: var(--almas-text-muted); }

@media (max-width: 720px) {
  .v-zeile { grid-template-columns: 1fr auto; gap: 8px 12px; }
  .v-nr, .v-partner { grid-column: 1; }
  .v-geld { text-align: left; }
  .v-kette { flex-direction: column; }
  .v-kette-schritt { border-radius: var(--radius-md) !important; }
  .v-kette-schritt + .v-kette-schritt { border-left: 1px solid var(--almas-border); margin-top: -1px; }
  .v-sigsheet { padding: 16px; border-radius: var(--radius-md); }
  .v-canvas-rahmen canvas { height: 200px; }
}
@media (prefers-reduced-motion: reduce) {
  .v-zeile, .v-schalter button, .v-kaestchen label { transition: none; }
  .v-zeile:hover { transform: none; }
}
