/* ============================================================
   DMC-Generator · HollermeierDigital
   Look & Feel wie das Cryptory-Tool, Farben der DMC-Palette:
   Akzent Camel #b08d57 · Text #1a211c · Hintergrund grünlich #eef3ee
   Radius für Buttons und Oberflächen: 12 px
   ============================================================ */

:root {
    --primary: #b08d57;          /* Camel – Buttons, Hervorhebungen */
    --primary-h: #98784a;        /* Hover */
    --primary-soft: rgba(176, 141, 87, 0.12);
    --primary-ring: rgba(176, 141, 87, 0.30);

    --fg: #1a211c;               /* Dunkelgrün – Text */
    --fg-soft: #3a463d;
    --fg-muted: #5f6b62;

    /* DMC-Verlauf: grünlicher Hintergrund, damit weiße Kacheln hervortreten */
    --bg-from: #dfeae0;
    --bg-to: #eef3ee;
    --surface: #ffffff;
    --surface-soft: #f3f7f3;

    --border: rgba(26, 33, 28, 0.12);
    --border-strong: rgba(26, 33, 28, 0.22);

    --success: #2d7a3e;
    --success-soft: rgba(45, 122, 62, 0.12);
    --warning: #b88800;
    --warning-soft: rgba(184, 136, 0, 0.12);
    --danger: #b8423b;
    --danger-h: #9a352f;
    --danger-soft: rgba(184, 66, 59, 0.12);

    --radius: 12px;
    --radius-pill: 999px;

    --shadow-sm: 0 1px 2px rgba(26, 33, 28, 0.06);
    --shadow-md: 0 8px 24px rgba(26, 33, 28, 0.09), 0 1px 3px rgba(26, 33, 28, 0.06);
    --shadow-lg: 0 18px 50px rgba(26, 33, 28, 0.16), 0 2px 8px rgba(26, 33, 28, 0.06);

    --content-width: 1440px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    color: var(--fg);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    background: linear-gradient(180deg, var(--bg-from) 0%, var(--bg-to) 100%) fixed;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--primary-h); }

h1, h2, h3, h4 { margin: 0 0 .6em 0; font-weight: 650; letter-spacing: -0.01em; color: var(--fg); }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; margin-top: 1.4em; }
p { margin: 0 0 1em 0; }

code {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 0.9em;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.muted { color: var(--fg-muted); }
.small { font-size: .87em; }

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 2px; }

.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    background: var(--primary);
    color: #fff;
    padding: 8px 14px;
    border-radius: var(--radius);
    z-index: 100;
}
.skip-link:focus { top: 12px; color: #fff; }

.icon { flex: none; }

/* ============================================================
   Formulare
   ============================================================ */

label {
    display: block;
    margin: 14px 0 6px 0;
    color: var(--fg-soft);
    font-size: 0.92em;
    font-weight: 550;
}

input[type="text"], input[type="password"], input[type="email"], input[type="tel"], input[type="url"], select, textarea {
    width: 100%;
    padding: 11px 14px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    color: var(--fg);
    font-size: 15px;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
textarea[readonly] { background: var(--surface-soft); color: var(--fg-soft); }

.code-input { font-size: 1.6rem !important; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; }

fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 16px 16px; margin: 0 0 18px 0; }
legend { padding: 0 6px; font-weight: 600; color: var(--fg); }

.required { color: var(--fg-muted); font-weight: 400; font-size: .9em; }
.field-error { color: var(--danger-h); font-size: .88em; margin: 6px 0 0 0; }
[aria-invalid="true"] { border-color: var(--danger) !important; }
.radio-row { display: flex; gap: 8px; align-items: baseline; padding: 4px 0; }
.inline-label { display: inline; margin: 0; font-weight: 500; }

/* ============================================================
   Buttons
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--primary);
    color: #fff;
    border: 1px solid transparent;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(39, 109, 250, 0.25);
    transition: background .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--primary-h); color: #fff; box-shadow: 0 4px 14px rgba(39, 109, 250, 0.28); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

.btn.full { width: 100%; margin-top: 20px; }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn-large { padding: 14px 26px; font-size: 15px; }

.btn.ghost { background: var(--surface); border-color: var(--border-strong); color: var(--fg); box-shadow: none; }
.btn.ghost:hover { background: var(--surface-soft); border-color: var(--primary); color: var(--primary); }

.btn.danger { background: var(--danger); box-shadow: none; }
.btn.danger:hover { background: var(--danger-h); }

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--fg-soft);
    cursor: pointer;
}
.icon-button:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }

form.inline { display: inline; margin: 0; }
.secondary-action { margin-top: 14px; }
.button-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ============================================================
   Karten, Hinweise, Badges
   ============================================================ */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

.alert {
    padding: 11px 14px;
    border-radius: var(--radius);
    margin: 0 0 16px 0;
    background: var(--primary-soft);
    border: 1px solid rgba(39, 109, 250, 0.25);
    color: var(--fg);
}
.alert.error { background: var(--danger-soft); color: var(--danger-h); border-color: rgba(199, 54, 54, 0.3); }
.alert.success { background: var(--success-soft); color: var(--success); border-color: rgba(23, 128, 74, 0.3); }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.72em;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.badge-info { background: var(--primary-soft); color: var(--primary-h); }
.badge-done { background: var(--success-soft); color: var(--success); }
.badge-pending { background: var(--warning-soft); color: var(--warning); }
.badge-failed { background: var(--danger-soft); color: var(--danger-h); }

/* ============================================================
   Kopfleiste und Navigation
   ============================================================ */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
}
.topbar-inner {
    max-width: var(--content-width);
    margin: 0 auto;
    height: 68px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 28px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { display: block; height: 32px; width: auto; }
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--fg), var(--primary));
    color: #fff;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: .02em;
}
.brand-mark-lg { width: 54px; height: 54px; border-radius: 15px; font-size: 19px; margin: 0 auto; }
.brand-sub {
    color: var(--fg-muted);
    font-size: 13px;
    font-weight: 600;
    padding-left: 12px;
    border-left: 1px solid var(--border-strong);
    white-space: nowrap;
}
.mainnav { flex: 1; display: flex; gap: 4px; overflow-x: auto; }
.mainnav a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: var(--radius);
    color: var(--fg-soft);
    text-decoration: none;
    font-weight: 550;
    white-space: nowrap;
    transition: background .15s, color .15s;
}
.mainnav a:hover { background: var(--surface-soft); color: var(--fg); }
.mainnav a.active { background: var(--primary-soft); color: var(--primary); }

.user { display: flex; align-items: center; gap: 10px; }
.avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--fg), var(--primary));
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.user-text { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-weight: 600; font-size: 14px; }
.user-role { color: var(--fg-muted); font-size: 12px; }

/* ============================================================
   Seitenaufbau
   ============================================================ */

.content {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 28px 24px 48px;
}
.empty-state {
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 36px;
    text-align: center;
    color: var(--fg-muted);
    background: rgba(255, 255, 255, 0.6);
}
.empty-state p { margin: 0; }

.single-wrap { max-width: 460px; margin: 0 auto; padding: 64px 20px 40px; }
.single-wrap:has(fieldset) { max-width: 580px; }
.single-head { text-align: center; margin-bottom: 24px; }
.single-head img { height: 48px; width: auto; }
.single-head .brand-sub { border: 0; padding: 0; margin: 6px 0 0; display: block; }

/* Suchleiste über die volle Breite */
.search-band {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.search-band-inner {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 28px 24px 22px;
}
.search-intro h1 { margin: 0 0 14px 0; font-size: 1.5rem; }
.search-form { margin-bottom: 8px; }
.search-kinds { border: 0; padding: 0; margin: 0 0 10px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.search-kind { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); font-weight: 550; cursor: pointer; }
.search-kind:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.search-kind input { margin: 0; }
.search-fields { display: flex; gap: 12px; align-items: stretch; }
.search-phone { flex: 1; display: flex; gap: 8px; }
.search-phone select { width: auto; max-width: 46%; }
.search-phone input { flex: 1; min-width: 0; padding: 15px 16px; font-size: 17px; }
/* Nur die Eingabe zur gewählten Suchart zeigen (ohne JavaScript, per :has). */
.search-form:has(input[name="type"][value="email"]:checked) [data-kind]:not([data-kind="email"]),
.search-form:has(input[name="type"][value="phone"]:checked) [data-kind]:not([data-kind="phone"]),
.search-form:has(input[name="type"][value="name"]:checked) [data-kind]:not([data-kind="name"]) { display: none; }
.search-input { position: relative; flex: 1; display: flex; }
.search-input .icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--fg-muted); }
.search-input input { padding: 15px 16px 15px 46px; font-size: 17px; }
.search-band .alert { margin: 12px 0 0 0; }

/* ============================================================
   Tabellen und Raster
   ============================================================ */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .78em; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-muted); font-weight: 650; }
td.actions { display: flex; flex-wrap: wrap; gap: 6px; }
tr.has-fields td { border-bottom: none; }
tr.opp-fields td { padding-top: 0; }
tr.opp-fields dl.details { margin: 0; padding: 10px 12px; background: var(--surface-soft); border-radius: var(--radius); }
.reset-limit { color: var(--danger-h); font-weight: 600; }

.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; align-items: end; }
.grid-form-action { padding-top: 14px; }

.checklist { list-style: none; padding: 0; margin: 0 0 20px 0; }
.checklist li { display: flex; gap: 10px; padding: 5px 0; }
.checklist .check-mark { font-weight: 700; width: 1em; }
.checklist li.ok .check-mark { color: var(--success); }
.checklist li.warn .check-mark { color: var(--warning); }
.checklist li.fail .check-mark { color: var(--danger); }

/* ============================================================
   Auswahl-Dialog und Wartehinweis
   ============================================================ */

dialog::backdrop { background: rgba(52, 62, 83, 0.38); backdrop-filter: blur(2px); }

.choice-dialog {
    max-width: 660px;
    width: calc(100% - 32px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px;
    background: var(--surface);
    color: var(--fg);
    box-shadow: var(--shadow-lg);
}
.choice-list { list-style: none; padding: 0; margin: 0 0 16px 0; display: grid; gap: 8px; }
.choice {
    display: block;
    padding: 13px 16px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--fg);
    text-decoration: none;
    transition: border-color .15s, background .15s;
}
.choice:hover, .choice:focus-visible { border-color: var(--primary); background: var(--primary-soft); color: var(--fg); }
.choice-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .88em; color: var(--fg-muted); margin-top: 2px; }

.busy-dialog {
    width: min(420px, calc(100% - 32px));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px 28px 18px;
    background: var(--surface);
    color: var(--fg);
    box-shadow: var(--shadow-lg);
    text-align: center;
}
.busy-text { font-weight: 650; font-size: 1.05rem; margin-bottom: 16px; }
.progress {
    position: relative;
    height: 6px;
    border-radius: var(--radius-pill);
    background: var(--primary-soft);
    overflow: hidden;
    margin-bottom: 14px;
}
.progress-bar {
    position: absolute;
    top: 0;
    left: -40%;
    width: 40%;
    height: 100%;
    border-radius: var(--radius-pill);
    background: var(--primary);
    animation: progress-slide 1.2s ease-in-out infinite;
}
@keyframes progress-slide {
    0% { left: -40%; }
    100% { left: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .progress-bar { animation: none; left: 0; width: 100%; opacity: .6; }
}

/* ============================================================
   Detailansicht
   ============================================================ */

.lead-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.lead-head h2 { margin: 0; font-size: 1.45rem; }
.lead-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.lead-close-link .icon { width: 16px; height: 16px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.detail-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-md);
    min-width: 0;
}
.detail-section.wide { grid-column: 1 / -1; }
.detail-section > h3:first-child {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--fg);
}
.detail-section > h3:first-child::before {
    content: "";
    width: 4px;
    height: 18px;
    border-radius: 4px;
    background: var(--primary);
}
.detail-section h4 { margin: 0; font-size: 1rem; }
/* Wichtige Informationen für Fulfillment (After-Sales-Formular): bewusst auffällig rot */
.detail-section.fulfillment { border: 2px solid var(--danger); background: #FFF5F5; box-shadow: 0 0 0 4px var(--danger-soft), var(--shadow-md); }
.detail-section.fulfillment > h3:first-child { color: var(--danger-h); border-bottom-color: rgba(199, 54, 54, 0.3); }
.detail-section.fulfillment > h3:first-child::before { display: none; }
.detail-section.fulfillment > h3 .icon { color: var(--danger); flex: none; }
.fulfillment-count { font-size: .85rem; font-weight: 500; color: var(--danger-h); }
.fulfillment-list { list-style: none; margin: 0; padding: 0; }
.fulfillment-entry { padding: 0 0 0 16px; border-left: 3px solid var(--danger); }
.fulfillment-entry + .fulfillment-entry { margin-top: 14px; padding-top: 14px; border-top: 1px dashed rgba(199, 54, 54, 0.3); }
.fulfillment-entry + .fulfillment-entry { border-left-color: rgba(199, 54, 54, 0.45); }
.fulfillment-meta { margin: 0 0 4px 0; font-size: .88rem; font-weight: 600; color: var(--danger-h); }
.fulfillment-text { margin: 0; color: var(--fg); font-weight: 500; overflow-wrap: anywhere; }
dl.details { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 6px 16px; margin: 0 0 12px 0; }
dl.details dt { color: var(--fg-muted); }
dl.details dd { margin: 0; overflow-wrap: anywhere; }
dl.details .value + .value::before { content: ", "; }
.contact + .contact { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
address { font-style: normal; margin-bottom: 12px; }

/* E-Mail senden */
.mail-select select { max-width: 520px; }
.mail-edit-label { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin: 14px 0 6px 0; color: var(--fg-soft); font-size: 0.92em; font-weight: 550; }
.mail-frame.is-editable { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.mail-select select + p { margin-top: 16px; }
.mail-preview { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 16px; }
.mail-preview h4 { margin: 0 0 8px 0; }
.mail-frame { width: 100%; height: 440px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: #fff; }
.send-status { padding: 14px 16px; border: 1px solid rgba(39, 109, 250, 0.3); border-radius: var(--radius); background: var(--primary-soft); }
.send-status p { margin: 0 0 10px 0; }

/* Onboarding erfassen */
#activity form .btn { margin-top: 14px; }
/* Übergabe-Modus: Kundendaten in den Karten bearbeiten, Speichern in der Leiste unten */
.lead-detail.is-handover { padding-bottom: 96px; }
.handover-banner { scroll-margin-top: 84px; margin: 0 0 18px 0; padding: 14px 18px; border: 1px solid var(--primary); border-radius: var(--radius); background: var(--primary-soft); }
.handover-banner .alert { margin: 0 0 10px 0; }
.handover-banner p { margin: 0; }
.edit-kam { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.edit-field { margin-bottom: 12px; }
.phantom { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.phantom .edit-label { margin-top: 0; }
.phantom-value { margin: 0 0 8px 0; overflow-wrap: anywhere; }
.phantom-form { display: flex; gap: 8px; align-items: center; }
.phantom-form input { flex: 1; min-width: 0; padding: 8px 12px; }
.edit-field label { margin-top: 0; }
.was { margin: 4px 0 0 0; font-size: .85em; color: var(--fg-muted); }
input.is-changed, select.is-changed { border-color: var(--primary); background: var(--primary-soft); }
.is-removed input[type="text"], .is-removed input[type="email"], .is-removed input[type="tel"] { text-decoration: line-through; opacity: .55; }
.edit-item + .edit-item { margin-top: 8px; }
.handover-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--border-strong); box-shadow: 0 -6px 18px rgba(52, 62, 83, 0.10); }
.handover-bar-inner { max-width: var(--content-width); margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 12px; }
.handover-status { margin: 0 auto 0 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .92em; color: var(--fg-soft); }
.handover-errors { color: var(--danger-h); font-weight: 600; }
.edit-block { background: var(--surface); }
.edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.edit-cell.wide { grid-column: span 2; }
.edit-entries + .edit-entries { margin-top: 10px; }
.edit-label { margin: 12px 0 6px 0; color: var(--fg-soft); font-size: 0.92em; font-weight: 550; }
.edit-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.edit-item .edit-row { margin-top: 0; }
.edit-row input { flex: 1 1 auto; min-width: 0; }
.edit-type { flex: none; }
label.check { display: inline-flex; align-items: center; gap: 6px; margin: 10px 0 0 0; font-weight: 500; white-space: nowrap; }
.edit-row label.check { margin: 0; flex: none; }
[data-add-entry] { margin-top: 8px; }
details.add-block { margin-top: 4px; }
details.add-block[open] { border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 16px 16px; background: var(--surface); }
details.add-block > summary { cursor: pointer; color: var(--primary); font-weight: 550; padding: 6px 0; }
.unsaved-report { margin: 12px 0 16px 0; }
@media (max-width: 760px) {
    .edit-row { flex-wrap: wrap; }
    .edit-row input { flex-basis: 100%; }
    .lead-detail.is-handover { padding-bottom: 150px; }
    .handover-banner { scroll-margin-top: 124px; }
    .handover-bar-inner { flex-wrap: wrap; padding: 10px 16px; }
    .handover-status { flex-basis: 100%; }
}

/* Meine Onboardings */
.onboarding-group h2 .muted { font-weight: 400; }
.onboarding-list { display: grid; gap: 12px; }
.onboarding { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--surface-soft); }
.onboarding.is-canceled, .onboarding.is-ended { opacity: .65; }
.onboarding-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.onboarding-time { font-variant-numeric: tabular-nums; }
.onboarding-join { margin-left: auto; }
.onboarding-join .icon { width: 16px; height: 16px; }
.onboarding-invitee { margin-top: 10px; }
.onboarding-name { margin: 0; }
.onboarding-contact { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 4px 0 0 0; }
.onboarding-answers { margin-top: 6px; }
.onboarding-answers > summary { cursor: pointer; color: var(--primary); font-size: .9em; font-weight: 550; }
.onboarding-answers dl.details { margin-top: 8px; }
.onboarding-customer { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.onboarding-customer .phantom { border-top: 0; padding-top: 0; }
.calendly-form { margin-top: 6px; }
.calendly-form label { margin: 0 0 2px 0; }
.calendly-row { display: flex; gap: 6px; }
.calendly-row input { padding: 6px 10px; font-size: 14px; min-width: 0; }
.link-button { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; cursor: pointer; text-align: left; overflow-wrap: anywhere; }
.link-button:hover { text-decoration: underline; }

.history { margin-top: 26px; border-top: 1px solid var(--border); padding-top: 18px; }
.history h4 { margin-bottom: 10px; }
.history-entry { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--surface-soft); }
.history-entry + .history-entry { margin-top: 12px; }
.history-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .88em; color: var(--fg-muted); }
.history-entry textarea { min-height: 0; }

/* Audit-Log */
.filter-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 14px; align-items: end; }
.filter-actions { display: flex; gap: 8px; padding-top: 14px; }
.pagination { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-top: 16px; }
td.meta { font-size: .85em; color: var(--fg-soft); overflow-wrap: anywhere; }
td.nowrap { white-space: nowrap; }

/* ============================================================
   Tablet / schmale Fenster
   ============================================================ */

@media (max-width: 1200px) {
    .topbar-inner { gap: 18px; }
    .user-text, .brand .brand-sub { display: none; }
}

@media (max-width: 960px) {
    .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .topbar-inner { height: auto; flex-wrap: wrap; gap: 8px 16px; padding: 10px 16px; }
    .mainnav { order: 3; flex-basis: 100%; }
    .user { margin-left: auto; }
}

@media (max-width: 760px) {
    .content, .search-band-inner { padding-left: 16px; padding-right: 16px; }
    .search-fields { flex-direction: column; }
    .card, .detail-section { padding: 18px; }
}
[data-split] { justify-content: space-between; margin-bottom: 8px; }
[data-split] h2 { margin: 0; }
input[type="date"] {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    color: var(--fg);
    font-family: inherit;
    font-size: 15px;
}

/* Hilfe (hilfe.php) */
.help { max-width: 880px; margin: 0 auto; }
.help-lead { font-size: 1.05rem; color: var(--fg-muted); margin: 0 0 20px 0; }
.help-toc-title { font-size: 1rem; margin: 0 0 10px 0; }
.help-toc ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; }
.help-toc a { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; text-decoration: none; color: var(--fg); font-weight: 550; }
.help-toc a:hover { background: var(--surface-soft); }
.help-num {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary); font-size: .8rem; font-weight: 700;
}
/* Sprungziele unter der mitlaufenden Kopfleiste nicht verdecken */
.help-section, #main { scroll-margin-top: 84px; }
.help-section > h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 14px 0; font-size: 1.25rem; }
.help-section > h2 .help-num { width: 28px; height: 28px; font-size: .9rem; }
.help-section h3 { font-size: 1.02rem; margin: 18px 0 6px 0; }
.help-section p, .help-section li { line-height: 1.6; }
.help-section ul, .help-section ol { padding-left: 22px; margin: 0 0 12px 0; }
.help-section li + li { margin-top: 4px; }
.help-steps li::marker { color: var(--primary); font-weight: 700; }
b.ui {
    display: inline-block; padding: 0 7px; border: 1px solid var(--border-strong); border-radius: 6px;
    background: var(--surface-soft); font-weight: 600; font-size: .92em; line-height: 1.5; white-space: nowrap;
}
.help-note { margin: 12px 0; padding: 10px 14px; border-radius: var(--radius); background: var(--primary-soft); border-left: 4px solid var(--primary); }
.help-note.important { background: var(--danger-soft); border-left-color: var(--danger); }
.help-note.important strong:first-child { color: var(--danger-h); }
.help-changed { padding: 0 6px; border: 1px solid var(--primary); border-radius: 6px; background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.help-table td { vertical-align: top; }
.help-table td:first-child { width: 42%; font-weight: 550; }
.help-example {
    display: flex; flex-direction: column; gap: 2px; margin: 0 0 14px 0; padding: 12px 14px;
    border: 2px solid var(--danger); border-radius: var(--radius); background: #FFF5F5; font-size: .92rem;
}
.help-example-title { display: flex; align-items: center; gap: 8px; color: var(--danger-h); font-weight: 700; }
.help-example-title .icon { width: 18px; height: 18px; color: var(--danger); }
.help-example-meta { color: var(--danger-h); font-weight: 600; font-size: .85rem; }
.help-top { margin: 14px 0 0 0; text-align: right; font-size: .85rem; }
@media (max-width: 900px) {
    .help-section, #main { scroll-margin-top: 130px; }
}
@media (max-width: 760px) {
    .help-toc ol { grid-template-columns: 1fr; }
    .help-table td:first-child { width: auto; }
    b.ui { white-space: normal; }
}

/* ============================================================
   DMC-Generator – spezifische Bausteine
   ============================================================ */
.page-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; flex: 1 1 auto; }
.page-head .actions, .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions-end { justify-content: flex-end; margin-top: 16px; }

.crumbs { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: .9em; color: var(--fg-muted); }
.crumbs a { color: var(--fg-muted); text-decoration: none; }
.crumbs a:hover { color: var(--primary); }
.crumbs .sep { opacity: .5; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.chip {
    display: inline-block; padding: 2px 9px; border-radius: var(--radius-pill);
    background: var(--surface-soft); border: 1px solid var(--border);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .8em; color: var(--fg-soft);
}

textarea.mono, .letter-edit { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; }
.letter-edit { min-height: 440px; line-height: 1.55; }
.letter-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.letter-toolbar .spacer { flex: 1 1 auto; }
.letter-toolbar form { margin: 0; }

.etikett {
    background: var(--surface-soft); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 12px 14px; margin-top: 4px; line-height: 1.5;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .95em;
}

.stack-submit { margin-top: 12px; }
.retoure-row { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.edit-label { display: block; margin: 12px 0 6px; color: var(--fg-soft); font-size: .92em; font-weight: 550; }

.btn.danger, .btn.ghost.danger { color: var(--danger-h); }
.btn.ghost.danger:hover { background: var(--danger-soft); border-color: var(--danger); }

details > summary { cursor: pointer; padding: 4px 0; }
details[open] > summary { margin-bottom: 10px; }

.alert.info a { font-weight: 600; }
