/* Datenbank-Demo „Kunden & Aufträge“: ergänzt /_kit/kit.css */

.ic { width: 18px; height: 18px; flex-shrink: 0; }
.btn .ic { width: 16px; height: 16px; }
.badge-xs { height: 20px; padding: 0 8px; font-size: 11.5px; }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 4px; border-radius: 99px; background: var(--paper-2); font-size: 11.5px; font-weight: 500; color: var(--ink-2); font-variant-numeric: tabular-nums; vertical-align: 1px; }
.link-btn { display: inline-flex; align-items: center; gap: 5px; padding: 4px 2px; border: 0; background: none; color: var(--ink-2); font-size: 14px; cursor: pointer; text-decoration: underline; text-decoration-color: rgba(18, 18, 17, 0.25); text-underline-offset: 4px; white-space: nowrap; }
.link-btn:hover { color: var(--ink); text-decoration-color: var(--ink); }
.link-btn .ic { width: 15px; height: 15px; }
.select { appearance: none; -webkit-appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234b4a46' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; cursor: pointer; }
.select-sm { height: 38px; font-size: 14px; padding-left: 14px; padding-right: 34px; background-position: right 10px center; border-radius: 99px; }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--err); }
.error { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 0; }
.error .ic { width: 15px; height: 15px; margin-top: 2px; }
.notice .ic { margin-top: 1px; color: var(--ink-2); }
.notice p { margin: 0; }
mark { background: rgba(255, 90, 31, 0.18); color: inherit; border-radius: 3px; padding: 0 1px; }

body[data-role="journeyman"] .office-only { display: none !important; }
body[data-role="office"] .journeyman-only { display: none !important; }

/* ---------- Demo-Steuerung ---------- */
.db-section { padding-top: 8px; }
.demo-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 12px 12px 12px 14px; margin-bottom: 18px; border: 1px dashed rgba(18, 18, 17, 0.24); border-radius: var(--radius); }
.dc-group { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.dc-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--ink); color: var(--paper); font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; margin-right: 2px; }
.dc-label { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.dc-hint { flex-basis: 100%; margin: 0; font-size: 13px; color: var(--ink-3); }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 99px; background: var(--paper-2); }
.seg-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 16px; border: 0; border-radius: 99px; background: transparent; color: var(--ink-2); font-size: 14px; font-weight: 500; cursor: pointer; transition: background-color .2s, color .2s, box-shadow .2s; }
.seg-btn:hover { color: var(--ink); }
.seg-btn[aria-pressed="true"] { background: var(--white); color: var(--ink); box-shadow: 0 1px 2px rgba(18, 18, 17, 0.1), 0 4px 10px -6px rgba(18, 18, 17, 0.25); }
.seg-sm .seg-btn { height: 30px; padding: 0 12px; font-size: 13px; }

/* ---------- App-Rahmen ---------- */
.app { scroll-margin-top: 80px; background: var(--white); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.app-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); background: var(--sheet); }
.app-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.app-logo { width: 36px; height: 36px; border-radius: 10px; background: var(--ink); color: var(--paper); display: grid; place-items: center; flex-shrink: 0; }
.app-brand-text { min-width: 0; }
.app-name { display: block; font-weight: 600; letter-spacing: -0.02em; font-size: 15.5px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-sub { display: block; font-size: 12.5px; color: var(--ink-3); line-height: 1.3; }
.app-user { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.app-user-text { display: flex; flex-direction: column; text-align: right; line-height: 1.25; }
.app-user-name { font-size: 14px; font-weight: 500; }
.app-user-sub { font-size: 12.5px; color: var(--ink-3); }
.avatar { width: 36px; height: 36px; border-radius: 99px; display: grid; place-items: center; background: var(--paper-2); color: var(--ink); font-size: 13px; font-weight: 600; letter-spacing: 0.02em; flex-shrink: 0; }
.avatar-ink { background: var(--ink); color: var(--paper); }
.avatar-sm { width: 34px; height: 34px; }
.avatar .ic { width: 17px; height: 17px; }
@media (max-width: 560px) { .app-user-text { display: none; } }

.app-main { padding: 22px 16px 26px; }
@media (min-width: 768px) { .app-main { padding: 30px 32px 34px; } }
.app-main > * + * { margin-top: 18px; }
.view-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 20px; }
.view-head .eyebrow { margin-bottom: 8px; }
.view-title { font-size: clamp(1.5rem, 2.6vw, 2rem); }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 520px) {
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1 1 0; min-width: 0; padding: 0 10px; gap: 6px; font-size: 13px; }
  .head-actions .btn-primary { order: -1; flex-basis: 100%; font-size: 14px; }
}
.role-note { align-items: center; background: var(--warn-soft); border-color: rgba(154, 91, 0, 0.18); color: var(--ink); }
.role-note .ic { color: var(--warn); }

/* Kennzahlen */
.kpis { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; } }
.kpi { position: relative; padding: 14px 14px 13px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--white); overflow: hidden; }
@media (min-width: 768px) { .kpi { padding: 18px 18px 16px; } }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent; transition: background-color .6s; }
.kpi.is-bump::before { animation: bump 1.2s ease-out; }
@keyframes bump { 0% { background: var(--signal); } 100% { background: transparent; } }
.kpi p { margin: 0; }
.kpi-label { font-size: 13px; color: var(--ink-2); }
.kpi-value { margin-top: 6px !important; font-size: clamp(1.45rem, 2.4vw, 1.9rem); font-weight: 500; letter-spacing: -0.035em; line-height: 1.1; white-space: nowrap; }
.kpi-sub { margin-top: 4px !important; font-size: 12.5px; color: var(--ink-3); }

/* Werkzeugleiste */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding-top: 6px; }
.search { position: relative; flex: 1 1 260px; min-width: 0; }
.search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search .input { height: 40px; padding-left: 40px; border-radius: 99px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 36px; padding: 0 12px; font-size: 13.5px; }
.chip-n { min-width: 20px; padding: 0 5px; height: 19px; border-radius: 99px; background: var(--paper-2); color: var(--ink-2); font-size: 11.5px; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.chip.is-active .chip-n { background: rgba(243, 242, 238, 0.18); color: var(--paper); }
.toolbar-end { display: flex; gap: 8px; margin-left: auto; }
.sort-mobile { display: none; }
@media (max-width: 719px) {
  .toolbar-end { margin-left: 0; width: 100%; }
  .toolbar-end .select { flex: 1 1 0; min-width: 0; }
  .sort-mobile { display: block; }
}
.import-note { align-items: center; flex-wrap: wrap; background: var(--signal-soft); border-color: rgba(255, 90, 31, 0.25); color: var(--ink); }
.import-note p { flex: 1 1 300px; }
.import-note .ic { color: var(--signal-ink); }

/* Status */
.st { gap: 7px; }
.st-dot { display: inline-block; width: 7px; height: 7px; border-radius: 99px; flex-shrink: 0; }
.st-0 { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1px rgba(18, 18, 17, 0.18); }
.st-0 .st-dot { background: var(--ink-3); }
.st-1 { background: var(--warn-soft); color: var(--warn); }
.st-1 .st-dot { background: #e09412; }
.st-2 { background: rgba(18, 18, 17, 0.07); color: var(--ink); }
.st-2 .st-dot { background: var(--signal); }
.st-3 { background: var(--ok-soft); color: var(--ok); }
.st-3 .st-dot { background: var(--ok); }

/* Tabelle */
.results { min-height: 200px; }
.db-table th { padding: 0; }
.th-btn { display: inline-flex; align-items: center; gap: 4px; width: 100%; padding: 10px 14px; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; white-space: nowrap; }
th.r .th-btn { justify-content: flex-end; }
.th-btn .ic { width: 14px; height: 14px; opacity: .35; transition: opacity .2s; }
.th-btn:hover { color: var(--ink); }
.th-btn:hover .ic, .th-btn.is-active .ic { opacity: 1; }
.th-btn.is-active { color: var(--ink); }
.db-table tbody tr { cursor: pointer; }
.db-table td { vertical-align: top; }
.db-table .c-ort, .db-table .c-datum, .db-table .c-betrag { padding-top: 14px; }
.db-table .c-status { padding-top: 12px; }
.cell-btn { padding: 0; border: 0; background: none; text-align: left; cursor: pointer; color: inherit; }
.cell-btn:hover .cell-title { text-decoration: underline; text-underline-offset: 3px; }
.cell-title { display: block; font-weight: 500; }
.cell-wrap { white-space: normal; }
.cell-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 2px; font-size: 12.5px; color: var(--ink-3); }
.cell-sub.mono { font-size: 11.5px; }
.c-kunde { min-width: 200px; }
.c-auftrag { min-width: 220px; }
.c-betrag { white-space: nowrap; font-variant-numeric: tabular-nums; }
.c-datum { white-space: nowrap; }
.imp { background: var(--signal-soft); color: var(--signal-ink); height: 18px; font-size: 11px; padding: 0 7px; }
.note-flag { display: inline-flex; align-items: center; gap: 3px; font-family: var(--font); color: var(--ink-3); }
.note-flag .ic { width: 13px; height: 13px; }
.db-table tr.is-flash td { animation: flash 2.4s ease-out; }
@keyframes flash { 0%, 30% { background: rgba(255, 90, 31, 0.12); } 100% { background: transparent; } }

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.pager-info { margin: 0; }
.pager-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.page-btn { min-width: 36px; height: 36px; padding: 0 8px; border: 1px solid transparent; border-radius: 99px; background: none; font-size: 14px; cursor: pointer; font-variant-numeric: tabular-nums; }
.page-btn:hover { border-color: rgba(18, 18, 17, 0.2); }
.page-btn.is-active { background: var(--ink); color: var(--paper); }
.icon-btn[disabled] { opacity: .3; cursor: not-allowed; }
.icon-btn .ic { width: 16px; height: 16px; }

.empty { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 40px 16px; border: 1px dashed var(--line); border-radius: var(--radius); }
.empty p { margin: 0; }
.empty .btn { margin-top: 10px; }
.empty-ic { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 99px; background: var(--paper); color: var(--ink-2); margin-bottom: 4px; }
.empty-title { font-weight: 500; }

/* Mobil: Zeilen als Karten */
@media (max-width: 719px) {
  .db-wrap { border: 0; background: none; overflow: visible; border-radius: 0; }
  .db-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .db-table, .db-table tbody { display: block; }
  .db-table tbody tr { display: grid; grid-template-columns: auto auto minmax(0, 1fr); grid-template-areas: "kunde kunde status" "auftrag auftrag auftrag" "ort datum betrag"; gap: 6px 10px; padding: 14px; margin-bottom: 10px; border: 1px solid var(--line-soft); border-radius: 14px; background: var(--white); }
  .db-table tbody tr:last-child { margin-bottom: 0; }
  .db-table td { display: block; padding: 0 !important; border: 0; min-width: 0; }
  .c-kunde { grid-area: kunde; }
  .c-status { grid-area: status; justify-self: end; }
  .c-auftrag { grid-area: auftrag; }
  .c-ort { grid-area: ort; font-size: 13px; color: var(--ink-2); }
  .c-datum { grid-area: datum; font-size: 13px; color: var(--ink-2); text-align: left !important; }
  .c-datum::before { content: "·"; margin-right: 10px; color: var(--ink-3); }
  .c-betrag { grid-area: betrag; text-align: right; font-weight: 500; }
  .db-table .cell-sub { font-size: 12px; }
}

/* ---------- Seitenpanel ---------- */
html:has(dialog[open]) { overflow: hidden; }
dialog { color: var(--ink); }
dialog::backdrop { background: rgba(18, 18, 17, 0.32); }
dialog[open]::backdrop { animation: fade-in .3s ease both; }
@keyframes fade-in { from { opacity: 0; } }
dialog.drawer { margin: 0 0 0 auto; padding: 0; width: min(560px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh; border: 0; border-left: 1px solid var(--line); background: var(--white); box-shadow: var(--shadow); }
dialog.drawer[open] { display: flex; flex-direction: column; animation: drawer-in .42s var(--ease) both; }
dialog.drawer.is-closing { animation: drawer-out .18s ease-in both; }
@keyframes drawer-in { from { transform: translateX(48px); opacity: 0; } }
@keyframes drawer-out { to { transform: translateX(48px); opacity: 0; } }
.drawer-inner { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px 14px; }
.drawer-head p { margin: 0; }
.drawer-head .eyebrow { margin-bottom: 4px; }
.drawer-head h2 { overflow-wrap: anywhere; }
.drawer-head h2:focus { outline: none; }
.drawer-body { flex: 1; overflow-y: auto; padding: 0 22px 24px; overscroll-behavior: contain; }
.drawer-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 22px; border-top: 1px solid var(--line-soft); background: var(--sheet); }
.drawer-tabs { position: sticky; top: 0; z-index: 2; background: var(--white); margin: 0 -22px; padding: 0 22px; }
.tab .count { margin-left: 6px; }
.dsec { padding: 18px 0; }
.dsec + .dsec { border-top: 1px solid var(--line-soft); }
.dsec-h { margin: 0 0 12px; padding: 0; font-family: var(--mono); font-size: 11.5px; font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.legend-note { text-transform: none; letter-spacing: 0; font-family: var(--font); font-size: 12.5px; margin-left: 6px; }
.kv { margin: 0; display: grid; font-size: 14.5px; }
.kv > div { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 9px 0; border-top: 1px solid var(--line-soft); }
.kv > div:first-child { border-top: 0; padding-top: 0; }
.kv dt { color: var(--ink-3); flex-shrink: 0; }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; display: inline-flex; align-items: center; gap: 6px; }
.kv dd .ic { width: 15px; height: 15px; }
.next-btn { margin-top: 14px; }
.next-btn .ic { color: var(--ok); }
.contact { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; font-size: 14.5px; }
.contact li { display: flex; gap: 10px; align-items: flex-start; overflow-wrap: anywhere; }
.contact .ic { width: 16px; height: 16px; margin-top: 3px; color: var(--ink-3); }
.cust-id { margin: 12px 0 0; }
.warn-note { margin-bottom: 12px; background: var(--warn-soft); border-color: rgba(154, 91, 0, 0.18); color: var(--ink); }
.warn-note .ic { color: var(--warn); }
.mini-list { margin: 0 0 14px; padding: 0; list-style: none; display: grid; gap: 6px; }
.mini-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--white); text-align: left; cursor: pointer; transition: border-color .2s; }
.mini-row:hover { border-color: rgba(18, 18, 17, 0.35); }
.mini-row > span:first-child { min-width: 0; }
.hist { margin: 0; padding: 0; list-style: none; display: grid; gap: 0; }
.hist li { position: relative; display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 12px; padding-bottom: 16px; }
.hist li::before { content: ""; position: absolute; left: 6px; top: 14px; bottom: 0; width: 1px; background: var(--line); }
.hist li:last-child::before { display: none; }
.hist-dot { width: 13px; height: 13px; margin-top: 4px; border-radius: 99px; border: 2px solid var(--ink); background: var(--white); position: relative; z-index: 1; }
.hist li:first-child .hist-dot { background: var(--ink); }
.hist-t { display: block; font-size: 14.5px; }
.hist-m { display: block; margin-top: 2px; font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.note-form { display: grid; gap: 8px; margin-bottom: 18px; }
.note-form .textarea { min-height: 84px; }
.note-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.notes { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.note { padding: 12px 14px; border-radius: 12px; background: var(--sheet); border: 1px solid var(--line-soft); }
.note p { margin: 0; }
.note p + p { margin-top: 6px; }
.note p:first-child { white-space: pre-line; overflow-wrap: anywhere; }
.danger { color: var(--err); border-color: rgba(179, 38, 30, 0.3); }
.danger:hover { border-color: var(--err); background: var(--err-soft); }
.foot-lock { display: inline-flex; align-items: center; gap: 6px; }
.foot-lock .ic { width: 14px; height: 14px; }

/* Formular im Panel */
.dform { display: grid; gap: 4px; padding-top: 8px; }
.dfs { margin: 0; padding: 14px 0 6px; border: 0; min-width: 0; display: grid; gap: 14px; }
.dfs + .dfs { border-top: 1px solid var(--line-soft); padding-top: 18px; }
.dfs > legend { float: left; width: 100%; margin-bottom: 0; }
.dfs > legend + * { clear: both; }
.frow { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.frow-zip { grid-template-columns: 110px minmax(0, 1fr); }
@media (max-width: 460px) { .frow { grid-template-columns: minmax(0, 1fr); } .frow-zip { grid-template-columns: 96px minmax(0, 1fr); } }
.field .hint, .field .error { margin-top: 6px; }
.req { color: var(--signal-ink); }
.field-amount .input { max-width: 220px; font-variant-numeric: tabular-nums; }
.err-sum { background: var(--err-soft); border-color: rgba(179, 38, 30, 0.2); color: var(--ink); margin-top: 8px; }
.err-sum .ic { color: var(--err); }
.dup-hint { display: flex; gap: 10px; margin-top: -4px; padding: 12px 14px; border-radius: 12px; background: var(--signal-soft); border: 1px solid rgba(255, 90, 31, 0.25); animation: kit-in .35s var(--ease) both; }
.dup-hint .ic { color: var(--signal-ink); margin-top: 2px; }
.dup-hint p { margin: 0; }
.dup-hint > div { flex: 1; min-width: 0; display: grid; gap: 4px; }
.dup-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
.existing-cust { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--sheet); border: 1px solid var(--line-soft); }
.existing-cust > div { flex: 1 1 200px; min-width: 0; }
.existing-cust p { margin: 0; }

/* ---------- Import-Dialog ---------- */
dialog.modal { width: min(1000px, calc(100vw - 24px)); max-width: none; height: min(860px, calc(100dvh - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: var(--radius-lg); background: var(--white); box-shadow: var(--shadow); }
dialog.modal[open] { display: flex; flex-direction: column; animation: pop-in .35s var(--ease) both; }
dialog.modal.is-closing, dialog.confirm.is-closing { animation: pop-out .18s ease-in both; }
@keyframes pop-in { from { transform: translateY(12px) scale(.985); opacity: 0; } }
@keyframes pop-out { to { transform: translateY(8px) scale(.985); opacity: 0; } }
@media (max-width: 600px) { dialog.modal { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; } }
.modal-inner { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 20px 24px 16px; border-bottom: 1px solid var(--line-soft); }
.modal-head p { margin: 0 0 4px; }
.modal-head h2:focus { outline: none; }
.modal-body { flex: 1; overflow-y: auto; padding: 20px 24px 28px; overscroll-behavior: contain; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 16px; padding: 14px 24px; border-top: 1px solid var(--line-soft); background: var(--sheet); }
.modal-foot p { margin: 0; }
@media (max-width: 600px) { .modal-head, .modal-body, .modal-foot { padding-left: 16px; padding-right: 16px; } .modal-foot .row { width: 100%; } .modal-foot .row .btn { flex: 1 1 auto; } }
.import-intro { margin: 0 0 18px; max-width: 64ch; }
.import-options { display: grid; gap: 12px; }
.imp-opt { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px 18px; align-items: center; padding: 18px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--white); }
.imp-opt > .btn, .imp-opt-actions { grid-column: 1 / -1; justify-self: start; }
@media (min-width: 700px) { .imp-opt { grid-template-columns: auto minmax(0, 1fr) auto; } .imp-opt > .btn, .imp-opt-actions { grid-column: auto; justify-self: end; } }
.imp-opt-main { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.imp-opt p { margin: 4px 0 0; }
.imp-opt-title { margin: 0; font-size: 1.05rem; font-weight: 500; letter-spacing: -0.02em; }
.imp-opt-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.file-ic { position: relative; width: 48px; height: 56px; display: grid; place-items: center; border-radius: 10px; background: var(--ink); color: var(--paper); }
.file-ic .ic { width: 22px; height: 22px; }
.file-ic-soft { background: var(--paper); color: var(--ink-2); }
.file-ext { position: absolute; bottom: -6px; right: -8px; padding: 1px 6px; border-radius: 5px; background: var(--signal); color: #fff; font-family: var(--mono); font-size: 9.5px; letter-spacing: .04em; }
.file-ic-soft .file-ext { background: var(--ink); }
.busy-steps { margin: 12px 0; padding: 0; list-style: none; display: grid; gap: 14px; max-width: 360px; }
.busy-steps li { display: flex; align-items: center; gap: 12px; color: var(--ink-3); transition: color .2s; }
.busy-steps li.is-done { color: var(--ink); }
.busy-ic { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 99px; border: 1px solid var(--line); }
.busy-steps li.is-done .busy-ic { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.busy-ic .ic { width: 14px; height: 14px; }

.imp-stats { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 0 6px; padding: 0; list-style: none; }
@media (min-width: 760px) { .imp-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.imp-stats li { display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--paper); font-size: 13px; color: var(--ink-2); }
.imp-stats li.is-key { background: var(--ink); color: rgba(243, 242, 238, 0.8); }
.imp-stat-n { font-size: 24px; font-weight: 500; letter-spacing: -0.03em; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.15; }
.is-key .imp-stat-n { color: var(--paper); }
.imp-sec { padding-top: 22px; }
.imp-h { display: flex; align-items: center; gap: 4px; margin: 0 0 12px; font-size: 1rem; font-weight: 500; letter-spacing: -0.015em; }
.map-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.map-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-soft); background: var(--sheet); font-size: 13px; }
.map-chip .mono { font-size: 12px; color: var(--ink-2); }
.map-chip .ic { width: 13px; height: 13px; color: var(--ink-3); }
.map-chip.is-missing { border-style: dashed; color: var(--ink-3); }
.decs { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.dec { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; padding: 14px 16px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--white); }
.dec-ic { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--signal-soft); color: var(--signal-ink); }
.dec-main { min-width: 0; display: grid; gap: 10px; }
.dec-q { margin: 0; font-size: 14.5px; }
.dec-compare { display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.dec-raw { display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--paper); font-size: 13px; min-width: 0; overflow-wrap: anywhere; }
.dec-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.dec-opt { position: relative; cursor: pointer; }
.dec-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.dec-opt > span { display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 14px; border: 1px solid rgba(18, 18, 17, 0.15); border-radius: 99px; font-size: 13.5px; transition: background-color .2s, border-color .2s, color .2s; }
.dec-opt:hover > span { border-color: rgba(18, 18, 17, 0.4); }
.dec-opt input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.dec-opt input:checked + span .subtle { color: rgba(243, 242, 238, 0.7); }
.dec-opt input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.fixgroups { display: grid; gap: 8px; }
.fixgroup { border: 1px solid var(--line-soft); border-radius: 12px; background: var(--white); overflow: hidden; }
.fixgroup summary { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none; font-size: 14.5px; }
.fixgroup summary::-webkit-details-marker { display: none; }
.fixgroup summary:hover { background: var(--sheet); }
.fix-n { min-width: 26px; height: 22px; padding: 0 7px; display: inline-grid; place-items: center; border-radius: 99px; background: var(--ok-soft); color: var(--ok); font-size: 12px; font-weight: 500; }
.fix-chev { margin-left: auto; width: 16px; height: 16px; color: var(--ink-3); transition: transform .25s var(--ease); }
.fixgroup[open] .fix-chev { transform: rotate(90deg); }
.fixgroup ul { margin: 0; padding: 4px 14px 12px; list-style: none; display: grid; gap: 6px; }
.fixgroup li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13.5px; padding: 6px 0; border-top: 1px solid var(--line-soft); }
.fixgroup li:first-child { border-top: 0; }
.fixgroup li .mono { font-size: 12.5px; }
.fix-arrow { color: var(--ok); }
.ws { display: inline-block; min-width: 0.6em; text-align: center; color: var(--signal-ink); background: var(--signal-soft); border-radius: 2px; }
.warns { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.warns li { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); }
.warns .ic { width: 16px; height: 16px; color: var(--warn); margin-top: 2px; }
.imp-prev-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.imp-prev-head .imp-h { margin: 0; }
.imp-table { font-size: 13px; min-width: 820px; }
.imp-table td, .imp-table th { padding: 9px 10px; }
.imp-table td { white-space: nowrap; }
.imp-table:not(.imp-raw) td:nth-child(2), .imp-table:not(.imp-raw) td:nth-child(4) { white-space: normal; min-width: 130px; }
.imp-table td:last-child .badge { white-space: nowrap; }
.imp-raw td.mono { font-size: 12px; }
.is-fixed { text-decoration: underline dotted var(--ok); text-decoration-thickness: 1.5px; text-underline-offset: 4px; cursor: help; }
.is-warn { color: var(--warn); font-weight: 500; }
.out-row-merged td, .out-row-skip td { color: var(--ink-3); background: var(--sheet); }
.out-row-merged td:not(:last-child), .out-row-skip td:not(:last-child) { text-decoration: line-through; text-decoration-color: rgba(18, 18, 17, 0.3); }
.out-new { background: var(--ok-soft); color: var(--ok); }
.out-assign { background: rgba(18, 18, 17, 0.07); color: var(--ink); }
.out-linked { background: var(--paper-2); color: var(--ink-2); }
.out-merged, .out-skip { background: var(--paper-2); color: var(--ink-3); }
.legend { margin: 8px 0 0; }
.legend-fixed { text-decoration: underline dotted var(--ok); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }

/* ---------- Rückfrage ---------- */
dialog.confirm { width: min(420px, calc(100vw - 32px)); padding: 24px; border: 0; border-radius: var(--radius-lg); background: var(--white); box-shadow: var(--shadow); }
dialog.confirm[open] { animation: pop-in .3s var(--ease) both; }
dialog.confirm p { margin: 10px 0 0; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }

/* ---------- Toast ---------- */
.toast[popover] { inset: auto auto 24px 50%; margin: 0; border: 0; overflow: visible; color: var(--paper); background: var(--ink); padding: 12px 18px; }
.toast { width: max-content; max-width: calc(100vw - 32px); white-space: normal; text-align: center; line-height: 1.4; border-radius: 16px; }
.toast.has-action { display: flex; align-items: center; gap: 14px; pointer-events: auto; padding-right: 8px; text-align: left; }
.toast:not(:popover-open).has-action { display: none; }
.toast-btn { height: 30px; padding: 0 12px; border: 0; border-radius: 99px; background: rgba(243, 242, 238, 0.16); color: var(--paper); font-size: 13.5px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.toast-btn:hover { background: rgba(243, 242, 238, 0.26); }
.toast-btn:focus-visible { outline-color: var(--paper); }

/* ---------- Erklärung unter der Demo ---------- */
.explain { margin-top: 56px; }
.explain-list { display: grid; gap: 24px; margin: 22px 0 0; padding: 0; list-style: none; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .explain-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; } }
.explain-list li { padding-top: 16px; border-top: 1px solid var(--line); }
.explain-nr { font-family: var(--mono); font-size: 12px; color: var(--signal-ink); }
.explain-title { margin: 6px 0 6px; font-size: 1.05rem; font-weight: 500; letter-spacing: -0.02em; }
.explain-list p { margin: 0; color: var(--ink-2); font-size: 15px; }

@media (max-width: 480px) {
  .demo-controls { padding: 12px; }
  .app-main { padding-left: 14px; padding-right: 14px; }
}
