/* Admin-Bereich */
.appbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; padding-top: env(safe-area-inset-top, 0px); }
.appbar-in { display: flex; align-items: center; gap: 16px; padding-top: 10px; padding-bottom: 10px; }
.appbar .brand { flex: none; }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: none; background: none; padding: 9px 12px; border-radius: 8px; cursor: pointer;
  font-weight: 600; color: var(--muted); white-space: nowrap; min-height: 40px;
}
.tabs button:hover { background: var(--paper); color: var(--ink); }
.tabs button[aria-current=page] { background: var(--pen-soft); color: var(--pen); }
main.wrap { padding-top: 20px; }
.auth { max-width: 400px; margin: 8vh auto 0; }
.center { text-align: center; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.sectionhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.grid2 { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .grid2 { grid-template-columns: 1fr 1fr; align-items: start; } }
.listhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.listtools { display: flex; gap: 8px; flex-wrap: wrap; flex: 1 1 260px; justify-content: flex-end; }
select.sm { min-height: 40px; padding: 8px 10px; width: auto; max-width: 200px; }
.chip span { opacity: .7; font-weight: 400; }

/* Status-Schritte */
.steps { display: flex; align-items: center; gap: 6px; grid-column: 1 / -1; font-size: .78rem; color: var(--muted); flex-wrap: wrap; }
.step { display: inline-flex; align-items: center; gap: 5px; }
.step i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line); background: #fff; display: inline-block; }
.step.on i { border-color: var(--ok); background: var(--ok); }
.step.on { color: var(--ink); }
.step.warn i { border-color: var(--warn); background: var(--warn); }
.steps .bar { width: 18px; height: 2px; background: var(--line); }
.steps .bar.on { background: var(--ok); }
.row.fresh { animation: fresh 2.4s ease-out; }
@keyframes fresh { 0% { box-shadow: 0 0 0 3px var(--ok); background: var(--ok-soft); } 100% { box-shadow: 0 0 0 0 transparent; background: #fff; } }
@media (prefers-reduced-motion: reduce) { .row.fresh { animation: none; box-shadow: 0 0 0 2px var(--ok); } }
.who .by { white-space: nowrap; }

/* Erfolgsmeldung nach dem Senden */
.sent { display: flex; gap: 14px; align-items: flex-start; background: var(--ok-soft); color: var(--ink); border-radius: 10px; padding: 14px 16px; }
.sent svg { width: 34px; height: 34px; flex: none; }
.sent b { display: block; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: .95rem; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); z-index: 50; box-shadow: 0 8px 24px rgba(22,35,58,.25);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--bad); }

/* Firmen */
.brandgrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.bcard { background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; cursor: pointer; text-align: left; padding: 0; font: inherit; color: inherit; display: flex; flex-direction: column; }
.bcard:hover { border-color: var(--pen); }
.bcard .top { padding: 18px; min-height: 96px; display: flex; align-items: center; background: radial-gradient(120% 140% at 100% 0%, var(--c) 0%, var(--d) 75%); }
.bcard .info { padding: 12px 16px 14px; }
.bcard .info b { display: block; }
.bcard .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag { font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: var(--paper); color: var(--muted); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.off { background: var(--warn-soft); color: var(--warn); }
.brandchip { display: inline-flex; align-items: center; min-height: 52px; padding: 10px 16px; background: #fff; border-radius: 10px; font-weight: 600; color: var(--ink); max-width: 100%; }
.brandchip.dark { background: rgba(0,0,0,.28); color: #fff; }
.brandchip img { display: block; max-height: 42px; max-width: 190px; width: auto; }

dialog.wide { max-width: 680px; max-height: calc(100vh - 32px); overflow: auto; }
.dlghead { display: flex; justify-content: space-between; align-items: center; }
.dlgfoot { display: flex; gap: 10px; justify-content: flex-end; position: sticky; bottom: -20px; background: #fff; padding: 12px 0 4px; }
.twocol { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .twocol { grid-template-columns: 1fr 1fr; } }
.preview { border-radius: 10px; padding: 22px; background: radial-gradient(120% 140% at 100% 0%, var(--c, #2446C8) 0%, var(--d, #16233A) 75%); }
.colorrow { display: flex; gap: 8px; }
.colorrow input[type=color] { width: 52px; min-height: 48px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.images { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .images { grid-template-columns: repeat(3, 1fr); } }
.imgbox { border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.imgbox .pic { height: 80px; display: flex; align-items: center; justify-content: center; background: repeating-conic-gradient(#F1F3F6 0 25%, #fff 0 50%) 0 0 / 16px 16px; border-radius: 6px; overflow: hidden; }
.imgbox .pic.dark { background: var(--d, #16233A); }
.imgbox .pic img { max-width: 100%; max-height: 72px; }
.imgbox .pic span { color: var(--muted); font-size: .85rem; }
.imgbox .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.imgbox input[type=file] { display: none; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px 14px; margin: 0; }
fieldset > * + * { margin-top: 10px; }
legend { font-weight: 600; font-size: .9rem; padding: 0 6px; }
.checkgrid { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .checkgrid { grid-template-columns: 1fr 1fr; } }

/* Benutzer */
.urow { display: grid; gap: 4px 14px; grid-template-columns: 1fr auto; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.urow .t { font-weight: 600; }
.urow .meta { grid-column: 1 / -1; font-size: .85rem; color: var(--muted); }
.urow .acts { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.badge.owner { background: #16233A; color: #fff; }
.badge.user { background: var(--pen-soft); color: var(--pen); }
.badge.invited { background: #FFF4D6; color: #7A5A00; }
.badge.locked { background: var(--warn-soft); color: var(--warn); }
.urow .badge { align-self: start; }
input[type=number] { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 12px; font-size: 16px; min-height: 48px; }
input[type=number]:focus { border-color: var(--pen); outline: none; box-shadow: 0 0 0 3px var(--pen-soft); }

/* Felder setzen */
.fpos { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.rrow { display: grid; grid-template-columns: 1fr 1.3fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
@media (max-width: 480px) { .rrow { grid-template-columns: 1fr auto; } .rrow .re { grid-column: 1; } .rrow .rx { grid-row: 1 / span 2; grid-column: 2; } }
.trrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.trrow label { margin: 0; }
#trBox { margin-top: 8px; }
.fbtns { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.okt { color: var(--ok); font-weight: 600; }
.warnt { color: var(--warn); }
dialog.editor { max-width: 920px; width: calc(100% - 16px); height: calc(100% - 16px); max-height: none; padding: 14px; }
.fd { display: flex; flex-direction: column; gap: 10px; height: 100%; }
.fdtools { display: flex; gap: 8px; flex-wrap: wrap; }
.fdtools .chip small { font-weight: 400; opacity: .7; margin-left: 4px; }
.fdtools .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.dot.sig, .fbox.sig { --fc: #1B3AB4; }
.dot.stamp, .fbox.stamp { --fc: #C2410C; }
.fdtools .dot { background: var(--fc); }
.fdnav { display: flex; gap: 10px; align-items: center; justify-content: center; }
.fdnav .btn { min-width: 44px; font-size: 1.2rem; }
.fdscroll { flex: 1; overflow: auto; background: var(--paper); border-radius: 8px; padding: 12px; min-height: 0; }
.fdpage { position: relative; margin: 0 auto; background: #fff; box-shadow: 0 1px 2px rgba(22,35,58,.1), 0 6px 18px rgba(22,35,58,.08); cursor: crosshair; }
.fdpage canvas { display: block; width: 100%; height: 100%; }
.fbox { position: absolute; border: 2px dashed var(--fc); background: color-mix(in srgb, var(--fc) 10%, transparent); border-radius: 4px; cursor: move; touch-action: none; display: flex; align-items: center; justify-content: center; overflow: visible; }
.fbox.sig { border-bottom: 3px solid var(--fc); }
.fbox.sig::after { content: 'Unterkante auf die Linie'; position: absolute; right: 2px; bottom: 2px; font-size: 10px; color: var(--fc); opacity: .8; pointer-events: none; white-space: nowrap; }
.fbox.on { border-style: solid; box-shadow: 0 0 0 3px color-mix(in srgb, var(--fc) 25%, transparent); }
.fbox img { max-width: 100%; max-height: 100%; opacity: .75; pointer-events: none; }
.fbox .fl { position: absolute; left: -2px; top: -20px; background: var(--fc); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 4px 4px 0 0; white-space: nowrap; pointer-events: none; }
.fbox .fh { position: absolute; right: -9px; bottom: -9px; width: 18px; height: 18px; background: #fff; border: 2px solid var(--fc); border-radius: 50%; cursor: nwse-resize; touch-action: none; }
@media (pointer: coarse) { .fbox .fh { width: 26px; height: 26px; right: -13px; bottom: -13px; } }
dialog.editor .dlgfoot { position: static; padding: 0; }

/* Versand-Kontrolle */
.badge.k-verschickt { background: var(--pen-soft); color: var(--pen); }
.badge.k-faellig { background: #FFF4D6; color: #7A5A00; }
.badge.k-fehler, .badge.k-abgelaufen, .badge.k-abgelehnt { background: var(--warn-soft); color: var(--warn); }
.badge.k-unterschrieben { background: var(--ok-soft); color: var(--ok); }
.badge.k-erledigt { background: #E6E9EE; color: #3B4657; }
.tag.due { background: #FFF4D6; color: #7A5A00; font-weight: 600; }
.udocs { grid-column: 1 / -1; margin-top: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.udocs summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 36px; font-size: .9rem; }
.udocs .ucount { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.empty-u { font-size: .85rem; color: var(--muted); }
.dlist { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.drow { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.drow .dt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.drow .dt b { overflow-wrap: anywhere; }
.drow .badge { align-self: start; white-space: nowrap; }
.drow .acts { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }

/* Eingebettet im Datentransfer („Signieren“, 22.10.2026): Kopfzeile ohne Sign-Logo */
.embed .appbar .brand { display: none; }

/* Mehrere Unterzeichner (2026-11-05) */
.mmode { display: grid; gap: 8px; }
.row .signers { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .85rem; color: var(--muted); }
.row .signers .sg-unterschrieben { color: #1F7A4D; }
.row .signers .sg-abgelehnt, .row .signers .sg-fehler { color: var(--bad, #B42318); }

/* Filtern/Sortieren + Live-Ansicht (2026-11-05) */
.viewbar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; margin: 4px 0 14px; }
.viewbar label { display: flex; flex-direction: column; gap: 3px; font-size: .78rem; color: var(--muted); margin: 0; }
.viewbar select, .viewbar input { min-height: 40px; padding: 6px 8px; font-size: .9rem; width: auto; }
.viewbar select[data-v="doc"] { max-width: 260px; }
.viewbar input[data-v="mail"] { min-width: 210px; }
.viewbar .vcount { font-size: .82rem; color: var(--muted); align-self: center; }
#list .row, .drow { cursor: pointer; }
#list .row:hover, .drow:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand, #2446C8) 22%, transparent); }
.drow .signers { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .85rem; color: var(--muted); }
.drow .signers .sg-unterschrieben { color: #1F7A4D; }
.drow .signers .sg-abgelehnt, .drow .signers .sg-fehler { color: var(--bad, #B42318); }
#caseDlg .chead { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
#caseDlg .cmeta { font-size: .88rem; color: var(--muted); }
#caseDlg .twrap { overflow-x: auto; }
#caseDlg table.ppl { width: 100%; border-collapse: collapse; font-size: .88rem; }
#caseDlg .ppl th, #caseDlg .ppl td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
#caseDlg .ppl td.n { white-space: normal; }
#caseDlg .ppl .sg-unterschrieben { color: #1F7A4D; font-weight: 600; }
#caseDlg .ppl .sg-abgelehnt, #caseDlg .ppl .sg-fehler { color: var(--bad, #B42318); font-weight: 600; }
#caseDlg .ev { list-style: none; padding: 0; margin: 0; font-size: .86rem; max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
#caseDlg .ev li { padding: 6px 10px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; }
#caseDlg .ev li:last-child { border-bottom: 0; }
#caseDlg .ev time { color: var(--muted); white-space: nowrap; min-width: 112px; }
#caseDlg .live { font-size: .8rem; color: var(--muted); }
#caseDlg .live::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #1F7A4D; margin-right: 6px; vertical-align: 1px; }
#caseDlg h3 { margin: 6px 0 4px; font-size: 1rem; }
