/* ==========================================================================
   CraftX ERP — Reusable widget utilities (card, stat, chip, btn, table,
   list, mini-chart, Bob, onboarding, quick-action)
   Global utility CSS. No per-component scoped styles.
   Source: design-pkg/craftx-design-system/project/erp/index.html
   Token-only: all values reference vars defined in app.css / tokens.css.
   ========================================================================== */

/* ── Card ──────────────────────────────────────────────────────────────── */

.card {
    background: var(--cx-card-bg);
    border: 1px solid var(--cx-card-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xs);
}

/* IMPORTANT: these primitives use a cx- prefix to avoid colliding with the
   widely-used Bootstrap class names (.card-header, .card-title, .card-body,
   .card-link) on legacy job-cards, dialog cards, contact panels, etc.
   The bare .card rule above is intentionally left global — its values are
   compatible with Bootstrap's .card. */

.cx-card-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--cx-hairline-soft);
    gap: 12px;
}

.cx-card-title {
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: var(--fw-semibold);
    color: var(--cx-text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cx-card-title .ico {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: var(--cx-primary-soft);
    color: var(--cx-primary);
    display: grid;
    place-items: center;
    font-size: 14px;
}

.cx-card-body {
    padding: var(--cx-card-pad);
}

.cx-card-link {
    font-size: 13px;
    color: var(--cx-primary);
    font-weight: var(--fw-medium);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}

.cx-card-link:hover {
    color: var(--cx-primary-hover);
}

/* ── Financial privacy ─────────────────────────────────────────────────── */

.financial-privacy-toggle {
    white-space: nowrap;
}

.financial-value-obscured {
    display: inline-block;
    filter: blur(5px);
    user-select: none;
    pointer-events: none;
    transform: translateZ(0);
}

/* ── Stat card ─────────────────────────────────────────────────────────── */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-grid.three {
    grid-template-columns: repeat(3, 1fr);
}

/* Five KPIs in a single row (e.g. the Übersicht header once "Nachfassen fällig" joined the set);
   collapses sensibly on narrower viewports so the fifth card never strands alone on a second row. */
.stat-grid.five {
    grid-template-columns: repeat(5, 1fr);
}
@media (max-width: 1366px) {
    .stat-grid.five { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 820px) {
    .stat-grid.five { grid-template-columns: repeat(2, 1fr); }
}

/* Dashboard top KPI row: 1–4 cards depending on which values are non-zero.
   kpi-* is used only by the dashboard header, so the shared .stat-grid rules
   above stay untouched. A single value becomes a compact horizontal summary. */
.stat-grid.kpi-4 { grid-template-columns: repeat(4, 1fr); }
.stat-grid.kpi-3 { grid-template-columns: repeat(3, 1fr); }
.stat-grid.kpi-2 { grid-template-columns: repeat(2, 1fr); }
.stat-grid.kpi-1 { grid-template-columns: 1fr; }
.stat-grid.kpi-1 > .stat-card {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 20px;
    padding: 14px 18px;
}
.stat-grid.kpi-1 .stat-value { font-size: 1.5rem; }
.stat-grid.kpi-1 .stat-value-row { flex: 0 1 auto; }
.stat-grid.kpi-1 .stat-foot { margin-left: auto; }
.stat-grid.kpi-1 > .stat-card::after {
    content: "→";
    color: var(--cx-text-muted);
}

@media (max-width: 1100px) {
    .stat-grid.kpi-3,
    .stat-grid.kpi-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .stat-grid.kpi-2,
    .stat-grid.kpi-3,
    .stat-grid.kpi-4 { grid-template-columns: 1fr; }
}

.stat-card {
    background: var(--cx-card-bg);
    border: 1px solid var(--cx-card-border);
    border-radius: var(--radius-xl);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Cards that navigate on click. The hover lift above applies to EVERY stat card,
   so it carries no clickability signal — the pointer and the focus ring are what
   tell the user (and the keyboard user) that this one is a button. */
.stat-card--clickable {
    cursor: pointer;
}

.stat-card--clickable:focus-visible {
    outline: 2px solid var(--cx-primary);
    outline-offset: 2px;
}

.stat-card .stat-label {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: var(--fw-bold);
    color: var(--cx-text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-card .stat-label .ico {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    font-size: 12px;
    color: white;
}

.stat-card .stat-value {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: var(--fw-bold);
    letter-spacing: -0.02em;
    color: var(--cx-text-primary);
    line-height: 1.1;
}

.stat-card .stat-foot {
    font-size: 12px;
    color: var(--cx-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-card .stat-foot .delta {
    font-weight: var(--fw-semibold);
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 6px;
    border-radius: var(--radius-pill);
    font-size: 11px;
}

.stat-card .stat-foot .delta.up {
    background: var(--success-50);
    color: var(--cx-success);
}

.stat-card .stat-foot .delta.down {
    background: var(--danger-50);
    color: var(--cx-danger);
}

.stat-card.primary .ico { background: var(--cx-primary); }
.stat-card.success .ico { background: var(--cx-success); }
.stat-card.warning .ico { background: var(--cx-warning); }
.stat-card.ai      .ico { background: var(--ai); }
.stat-card.info    .ico { background: var(--cx-info); }

/* Tone accent — 3px left bar gives semantic differentiation without flooding
   the whole card. Card body stays neutral so a row of 4–6 tinted cards
   doesn't read as a rainbow. */
.stat-card.primary,
.stat-card.success,
.stat-card.warning,
.stat-card.ai,
.stat-card.info,
.stat-card.danger { padding-left: 17px; }
.stat-card.primary { box-shadow: inset 3px 0 0 var(--cx-primary); }
.stat-card.success { box-shadow: inset 3px 0 0 var(--cx-success); }
.stat-card.warning { box-shadow: inset 3px 0 0 var(--cx-warning); }
.stat-card.ai      { box-shadow: inset 3px 0 0 var(--ai); }
.stat-card.info    { box-shadow: inset 3px 0 0 var(--cx-info); }
.stat-card.danger  { box-shadow: inset 3px 0 0 var(--cx-danger); }
.stat-card.danger .ico { background: var(--cx-danger); }

/* Compact variant — for detail-page header strips where the dashboard-sized
   stat card would dominate. Roughly two-thirds the vertical footprint. */
.stat-card.compact {
    padding: 12px 14px;
    gap: 4px;
}

.stat-card.compact .stat-label {
    font-size: 10.5px;
    gap: 6px;
}

.stat-card.compact .stat-label .ico {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    font-size: 11px;
}

.stat-card.compact .stat-value {
    font-size: 20px;
}

.stat-card.compact .stat-foot {
    font-size: 11px;
}

.stat-card.compact.primary,
.stat-card.compact.success,
.stat-card.compact.warning,
.stat-card.compact.ai,
.stat-card.compact.info,
.stat-card.compact.danger { padding-left: 11px; }

/* ── Chip / badge ──────────────────────────────────────────────────────── */

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: var(--fw-bold);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    background: rgba(28, 25, 21, 0.06);
    color: var(--cx-text-primary);
    white-space: nowrap;
    border: 1px solid transparent;
}

.chip .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Tone chips — bg uses tone @ ~16% alpha effect (color-mix), text stays at the
   saturated tone so it remains the dominant signal. Bold + uppercase keeps
   them readable at 11px against any surface. */
.chip.success { background: color-mix(in srgb, var(--cx-success) 14%, white); color: var(--cx-success); }
.chip.info    { background: color-mix(in srgb, var(--cx-info)    14%, white); color: var(--cx-info); }
.chip.warning { background: color-mix(in srgb, var(--cx-warning) 16%, white); color: var(--cx-warning); }
.chip.danger  { background: color-mix(in srgb, var(--cx-danger)  14%, white); color: var(--cx-danger); }
.chip.ai      { background: color-mix(in srgb, var(--ai)         14%, white); color: var(--ai); }
.chip.copper  { background: color-mix(in srgb, var(--copper)     14%, white); color: var(--copper-dark); }
.chip.neutral { background: rgba(28, 25, 21, 0.06); color: var(--cx-text-secondary); }
.chip.lg      { font-size: 14px; padding: 5px 12px; }

/* ── Button (widget btn, distinct from legacy .btn in app.css) ─────────
   Use with explicit utility class, e.g. <button class="btn primary"> from
   the redesign system.

   IMPORTANT: only apply the redesign reset when one of our modifier classes
   (.primary, .outline, .ghost) is present. Bare `.btn` is Bootstrap's class
   used by .btn-primary, .btn-success, .btn-danger, etc.; resetting it here
   would wipe out their backgrounds across the entire legacy surface. */

.btn.primary,
.btn.outline,
.btn.ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: var(--fw-semibold);
    border: 1px solid transparent;
    background: transparent;
    color: var(--cx-text-primary);
    transition: all 0.15s var(--ease);
    font-family: inherit;
    cursor: pointer;
    line-height: 1;
}

.btn.primary i,
.btn.outline i,
.btn.ghost i {
    font-size: 14px;
}

.btn.primary:disabled,
.btn.outline:disabled,
.btn.ghost:disabled,
.btn.primary[disabled],
.btn.outline[disabled],
.btn.ghost[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    pointer-events: none;
}

.btn.primary {
    background: var(--cx-primary);
    color: white;
    box-shadow: var(--shadow-copper);
}

.btn.primary:hover {
    background: var(--cx-primary-hover);
    box-shadow: var(--shadow-copper-lg);
}

.btn.outline {
    border-color: var(--cx-hairline);
    background: white;
}

.btn.outline:hover {
    border-color: var(--cx-text-muted);
    background: white;
}

.btn.ghost {
    background: transparent;
}

.btn.ghost:hover {
    background: rgba(28, 25, 21, 0.04);
}

.btn.primary.sm,
.btn.outline.sm,
.btn.ghost.sm,
.btn.danger.sm,
.btn.success.sm,
.btn.warning.sm,
.btn.link.sm {
    height: 28px;
    padding: 0 10px;
    font-size: 12px;
}

.btn.primary.lg,
.btn.outline.lg,
.btn.ghost.lg,
.btn.danger.lg,
.btn.success.lg,
.btn.warning.lg {
    height: 42px;
    padding: 0 20px;
    font-size: 14px;
}

/* Semantic tone variants — share the structural reset above. */
.btn.danger,
.btn.success,
.btn.warning,
.btn.link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: var(--fw-semibold);
    border: 1px solid transparent;
    transition: all 0.15s var(--ease);
    font-family: inherit;
    cursor: pointer;
    line-height: 1;
}

.btn.danger i,
.btn.success i,
.btn.warning i,
.btn.link i {
    font-size: 14px;
}

.btn.danger {
    background: var(--cx-danger);
    color: white;
    box-shadow: 0 6px 14px rgba(154, 59, 51, .22), 0 2px 4px rgba(154, 59, 51, .12);
}

.btn.danger:hover {
    background: #7d2f29;
}

.btn.success {
    background: var(--cx-success);
    color: white;
    box-shadow: 0 6px 14px rgba(63, 125, 91, .22), 0 2px 4px rgba(63, 125, 91, .12);
}

.btn.success:hover {
    background: #2f6147;
}

.btn.warning {
    background: var(--cx-warning);
    color: white;
    box-shadow: 0 6px 14px rgba(169, 117, 20, .22), 0 2px 4px rgba(169, 117, 20, .12);
}

.btn.warning:hover {
    background: #855a10;
}

.btn.link {
    background: transparent;
    color: var(--cx-primary);
    padding: 0 6px;
    height: auto;
    box-shadow: none;
}

.btn.link:hover {
    color: var(--cx-primary-hover);
    text-decoration: underline;
}

/* Outline modifiers for tone variants */
.btn.outline.danger {
    border-color: var(--cx-danger);
    color: var(--cx-danger);
    background: white;
}

.btn.outline.danger:hover {
    background: var(--danger-50, #F7E7E5);
}

.btn.outline.success {
    border-color: var(--cx-success);
    color: var(--cx-success);
    background: white;
}

.btn.outline.success:hover {
    background: var(--success-50, #EAF3EE);
}

.btn.outline.warning {
    border-color: var(--cx-warning);
    color: var(--cx-warning);
    background: white;
}

.btn.outline.warning:hover {
    background: var(--warning-50, #FAF1DE);
}

/* ── Form primitives ───────────────────────────────────────────────────── */

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 720px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-input,
input.form-input,
textarea.form-input,
select.form-input {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--cx-hairline);
    background: white;
    color: var(--cx-text-primary);
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
    box-sizing: border-box;
}

textarea.form-input {
    height: auto;
    min-height: 92px;
    padding: 10px 12px;
    line-height: 1.5;
    resize: vertical;
}

.form-input:focus,
input.form-input:focus,
textarea.form-input:focus,
select.form-input:focus {
    outline: none;
    border-color: var(--cx-primary);
    box-shadow: 0 0 0 3px rgba(184, 96, 31, 0.15);
}

.form-input:disabled,
.form-input[readonly] {
    background: var(--paper-2, #F5F1E8);
    color: var(--cx-text-secondary);
    cursor: not-allowed;
}

.form-input.is-invalid,
.form-input[aria-invalid="true"] {
    border-color: var(--cx-danger);
}

.form-input.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(154, 59, 51, 0.15);
}

.form-hint {
    font-size: 12px;
    color: var(--cx-text-muted);
    margin-top: 2px;
}

.form-error {
    font-size: 12px;
    color: var(--cx-danger);
    margin-top: 2px;
}

/* ── Data table ────────────────────────────────────────────────────────── */

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.data-table thead th {
    text-align: left;
    font-weight: var(--fw-semibold);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--cx-text-muted);
    padding: 10px 14px;
    background: var(--light-gray);
    border-bottom: 1px solid var(--cx-hairline);
    white-space: nowrap;
}

.data-table thead th:first-child {
    border-top-left-radius: var(--radius-md);
}

.data-table thead th:last-child {
    border-top-right-radius: var(--radius-md);
}

.data-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--cx-hairline-soft);
    color: var(--cx-text-primary);
    height: var(--cx-row-h);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.12s var(--ease);
}

.data-table tbody tr:hover {
    background: rgba(184, 96, 31, 0.04);
}

.data-table tbody tr.clickable-row {
    cursor: pointer;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table .muted {
    color: var(--cx-text-muted);
}

.data-table .num {
    font-variant-numeric: tabular-nums;
    text-align: right;
    font-family: var(--font-mono);
    font-size: 12.5px;
    white-space: nowrap;
}

/* ── Avatar (small) ───────────────────────────────────────────────────── */

.avatar-sm {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    font-size: 10.5px;
    font-weight: var(--fw-bold);
    color: white;
    flex-shrink: 0;
}

.av-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Dashboard grid + list rows ───────────────────────────────────────── */

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
}

.dashboard-grid.three {
    grid-template-columns: 1fr 1fr 1fr;
}

.list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--cx-hairline-soft);
    transition: background 0.12s var(--ease);
    cursor: pointer;
}

.list-row:hover {
    background: rgba(28, 25, 21, 0.035);
}

.list-row:last-child {
    border-bottom: none;
}

.list-row .primary {
    font-size: 13.5px;
    font-weight: var(--fw-medium);
    color: var(--cx-text-primary);
}

.list-row .secondary {
    font-size: 12px;
    color: var(--cx-text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.list-row .right {
    margin-left: auto;
    text-align: right;
}

/* ── Mini CSS bar chart ───────────────────────────────────────────────── */

.mini-chart {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 120px;
    padding: 4px 0 20px;
    position: relative;
}

.mini-chart::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 20px;
    height: 1px;
    background: var(--cx-hairline);
}

.bar {
    flex: 1;
    background: linear-gradient(180deg, var(--copper) 0%, #D98A4C 100%);
    border-radius: 4px 4px 0 0;
    position: relative;
    min-height: 8px;
    transition: all 0.3s var(--ease);
    animation: growBar 0.9s var(--ease);
    transform-origin: bottom;
}

.bar.muted {
    background: linear-gradient(180deg, #D4CEC1 0%, #EAE4D6 100%);
}

.bar .label {
    position: absolute;
    bottom: -20px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 10.5px;
    color: var(--cx-text-muted);
    font-weight: var(--fw-medium);
}

.bar:hover {
    filter: brightness(1.05);
}

/* ── KPI intake sparkline ("Verlauf") ──────────────────────────────────────
   A dezent weekly-count trend line tucked into the free space right of a stat
   card's headline value — it must never add card height, so it lives inside
   the value row instead of stacking below. Count-based, so no financial gate.
   Deliberately quiet: no border, no background — only the hairline the SVG
   itself draws. The SVG accepts pointer input so its per-week hover tooltip works. */

.stat-value-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
}

.kpi-spark {
    flex: 0 1 96px;
    width: 96px;
    max-width: 40%;
    height: 26px;
    min-width: 0;
}

.kpi-spark .cx-sparkline {
    display: block;
    width: 100%;
    height: 100%;
}

/* ── Sparkline component (shared) ───────────────────────────────────────────
   Base layout for <CxSparkline>, used by every call site (dashboard stat cards
   and the /quotes + /invoices KPI buttons). Loaded globally via App.razor, so
   the hover tooltip styling below reaches all of them. The host div is the
   positioning context for the absolutely-placed tooltip. */

.cx-sparkline {
    position: relative;
    display: block;
}

/* Stat cards hosting a sparkline must let the tooltip escape the card bounds
   (.stat-card clips by default). The hover transform creates a stacking context,
   so the hovered card also needs a z-index or the tooltip would paint underneath
   a later sibling card it overlaps. */
.stat-card.has-spark {
    overflow: visible;
}

.stat-card.has-spark:hover {
    z-index: 5;
}

.cx-sparkline__svg {
    display: block;
    width: 100%;
    height: 100%;
}

.cx-sparkline__tip {
    position: absolute;
    bottom: calc(100% + 6px);
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 5px 8px;
    border-radius: 6px;
    background: #1f2937;
    color: #fff;
    font-size: 11px;
    line-height: 1.35;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    pointer-events: none;
    z-index: 30;
}

.cx-sparkline__tip-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
}

.cx-sparkline__tip-count {
    font-weight: var(--fw-bold);
}

/* ── Bob inline AI card ───────────────────────────────────────────────── */

.bob-card {
    background: linear-gradient(135deg, #eeebf5 0%, #f5f1ff 60%, #ffffff 100%);
    border: 1px solid rgba(91, 75, 138, 0.15);
    border-radius: var(--radius-xl);
    padding: 18px 20px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    position: relative;
    overflow: hidden;
}

.bob-card .bob-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #5B4B8A 0%, #8370c0 100%);
    color: white;
    display: grid;
    place-items: center;
    font-weight: var(--fw-xbold);
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(91, 75, 138, 0.25);
}

.bob-card .bob-body {
    flex: 1;
    min-width: 0;
}

.bob-card .bob-label {
    font-size: 10.5px;
    font-weight: var(--fw-bold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ai);
    margin-bottom: 4px;
}

.bob-card .bob-msg {
    font-size: 14px;
    color: var(--cx-text-primary);
    line-height: 1.5;
    margin: 0 0 10px;
}

.bob-card .bob-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.bob-chip {
    font-size: 12px;
    padding: 5px 11px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(91, 75, 138, 0.2);
    color: var(--ai);
    font-weight: var(--fw-medium);
    transition: all 0.15s var(--ease);
    cursor: pointer;
    font-family: inherit;
}

.bob-chip:hover {
    background: white;
    border-color: var(--ai);
}

/* ── Onboarding checklist card ────────────────────────────────────────── */

.onboarding-card {
    background: linear-gradient(135deg, var(--copper-50) 0%, #FFFFFF 60%);
    border: 1px solid rgba(184, 96, 31, 0.18);
    border-radius: var(--radius-xl);
    padding: 20px 24px;
    margin-bottom: 24px;
    display: flex;
    gap: 20px;
    align-items: center;
}

.onboarding-card .progress-ring {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    position: relative;
}

.onboarding-card .progress-ring svg {
    transform: rotate(-90deg);
}

.onboarding-card .progress-ring .pct {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: var(--fw-bold);
    color: var(--cx-primary);
    font-family: var(--font-mono);
}

.onboarding-card .obc-body {
    flex: 1;
}

.onboarding-card .obc-title {
    font-size: 15px;
    font-weight: var(--fw-bold);
    margin: 0 0 3px;
    color: var(--cx-text-primary);
}

.onboarding-card .obc-sub {
    font-size: 13px;
    color: var(--cx-text-muted);
    margin: 0;
}

/* Erste-Schritte variant: the body carries a step list, so ring and dismiss sit at the top. */
.onboarding-card--steps {
    align-items: flex-start;
}

.onboarding-card .obc-steps {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 22px;
}

.onboarding-card .obc-step {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: 13px;
    font-weight: var(--fw-medium, 500);
    color: var(--cx-text-primary);
    cursor: pointer;
}

.onboarding-card .obc-step:hover {
    color: var(--cx-primary);
}

.onboarding-card .obc-step > i:first-child {
    font-size: 15px;
    color: var(--cx-text-muted);
}

.onboarding-card .obc-step .go {
    font-size: 11px;
    color: var(--cx-text-muted);
}

.onboarding-card .obc-step.done {
    color: var(--cx-text-muted);
    text-decoration: line-through;
}

.onboarding-card .obc-step.done > i:first-child {
    color: var(--cx-success);
}

/* ── Quick action card ────────────────────────────────────────────────── */

.quick-action {
    background: white;
    border: 1px solid var(--cx-card-border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.15s var(--ease);
    text-decoration: none;
    color: inherit;
}

.quick-action:hover {
    border-color: rgba(184, 96, 31, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(28, 25, 21, 0.06);
}

.quick-action .qa-ico {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    font-size: 15px;
    color: white;
    flex-shrink: 0;
}

.quick-action .qa-body {
    flex: 1;
    min-width: 0;
}

.quick-action .qa-title {
    font-size: 13px;
    font-weight: var(--fw-semibold);
    color: var(--cx-text-primary);
    margin: 0;
}

.quick-action .qa-sub {
    font-size: 12px;
    color: var(--cx-text-muted);
    margin: 0;
}

.quick-action i.chev {
    color: var(--cx-text-muted);
    font-size: 14px;
}

/* ============================================================
   Bootstrap palette correction
   Bootstrap 5 ships compiled-in colors for .btn-*, .bg-*, .text-*, .alert-*, .badge bg-*, etc.
   Re-point them to the warm CraftX tokens so legacy markup that still uses
   Bootstrap utility classes inherits the copper carpenter palette.
   ============================================================ */

/* Buttons ---------------------------------------------------- */
.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--cx-primary);
    --bs-btn-border-color: var(--cx-primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--cx-primary-hover);
    --bs-btn-hover-border-color: var(--cx-primary-hover);
    --bs-btn-focus-shadow-rgb: 184, 96, 31;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--cx-primary-hover);
    --bs-btn-active-border-color: var(--cx-primary-hover);
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: var(--cx-primary);
    --bs-btn-disabled-border-color: var(--cx-primary);
}

.btn-success {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--cx-success);
    --bs-btn-border-color: var(--cx-success);
    --bs-btn-hover-bg: #2F6647;
    --bs-btn-hover-border-color: #2F6647;
    --bs-btn-active-bg: #2F6647;
    --bs-btn-active-border-color: #2F6647;
    --bs-btn-disabled-bg: var(--cx-success);
    --bs-btn-disabled-border-color: var(--cx-success);
    --bs-btn-focus-shadow-rgb: 63, 125, 91;
}

.btn-danger {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--cx-danger);
    --bs-btn-border-color: var(--cx-danger);
    --bs-btn-hover-bg: #7C2D27;
    --bs-btn-hover-border-color: #7C2D27;
    --bs-btn-active-bg: #7C2D27;
    --bs-btn-active-border-color: #7C2D27;
    --bs-btn-disabled-bg: var(--cx-danger);
    --bs-btn-disabled-border-color: var(--cx-danger);
    --bs-btn-focus-shadow-rgb: 154, 59, 51;
}

.btn-warning {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--cx-warning);
    --bs-btn-border-color: var(--cx-warning);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #875D10;
    --bs-btn-hover-border-color: #875D10;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #875D10;
    --bs-btn-active-border-color: #875D10;
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: var(--cx-warning);
    --bs-btn-disabled-border-color: var(--cx-warning);
    --bs-btn-focus-shadow-rgb: 169, 117, 20;
}

.btn-info {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--cx-info);
    --bs-btn-border-color: var(--cx-info);
    --bs-btn-hover-bg: #193A66;
    --bs-btn-hover-border-color: #193A66;
    --bs-btn-active-bg: #193A66;
    --bs-btn-active-border-color: #193A66;
    --bs-btn-focus-shadow-rgb: 31, 74, 130;
}

.btn-outline-primary {
    --bs-btn-color: var(--cx-primary);
    --bs-btn-border-color: var(--cx-primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--cx-primary);
    --bs-btn-hover-border-color: var(--cx-primary);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--cx-primary-hover);
    --bs-btn-active-border-color: var(--cx-primary-hover);
    --bs-btn-disabled-color: var(--cx-primary);
    --bs-btn-disabled-border-color: var(--cx-primary);
    --bs-btn-focus-shadow-rgb: 184, 96, 31;
}

.btn-outline-success {
    --bs-btn-color: var(--cx-success);
    --bs-btn-border-color: var(--cx-success);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--cx-success);
    --bs-btn-hover-border-color: var(--cx-success);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--cx-success);
    --bs-btn-active-border-color: var(--cx-success);
    --bs-btn-disabled-color: var(--cx-success);
    --bs-btn-disabled-border-color: var(--cx-success);
}

.btn-outline-danger {
    --bs-btn-color: var(--cx-danger);
    --bs-btn-border-color: var(--cx-danger);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--cx-danger);
    --bs-btn-hover-border-color: var(--cx-danger);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--cx-danger);
    --bs-btn-active-border-color: var(--cx-danger);
    --bs-btn-disabled-color: var(--cx-danger);
    --bs-btn-disabled-border-color: var(--cx-danger);
}

.btn-outline-warning {
    --bs-btn-color: var(--cx-warning);
    --bs-btn-border-color: var(--cx-warning);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--cx-warning);
    --bs-btn-hover-border-color: var(--cx-warning);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--cx-warning);
    --bs-btn-active-border-color: var(--cx-warning);
}

.btn-outline-info {
    --bs-btn-color: var(--cx-info);
    --bs-btn-border-color: var(--cx-info);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--cx-info);
    --bs-btn-hover-border-color: var(--cx-info);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--cx-info);
    --bs-btn-active-border-color: var(--cx-info);
}

/* Backgrounds ------------------------------------------------ */
.bg-primary { background-color: var(--cx-primary) !important; }
.bg-success { background-color: var(--cx-success) !important; }
.bg-danger  { background-color: var(--cx-danger) !important; }
.bg-warning { background-color: var(--cx-warning) !important; }
.bg-info    { background-color: var(--cx-info) !important; }

/* Bootstrap subtle backgrounds (used in pills, soft chips) */
.bg-primary-subtle { background-color: rgba(184, 96, 31, 0.10) !important; color: var(--cx-primary); }
.bg-success-subtle { background-color: rgba(63, 125, 91, 0.12) !important; color: var(--cx-success); }
.bg-danger-subtle  { background-color: rgba(154, 59, 51, 0.12) !important; color: var(--cx-danger); }
.bg-warning-subtle { background-color: rgba(169, 117, 20, 0.14) !important; color: var(--cx-warning); }
.bg-info-subtle    { background-color: rgba(31, 74, 130, 0.10) !important; color: var(--cx-info); }

/* Text colors ------------------------------------------------ */
.text-primary { color: var(--cx-primary) !important; }
.text-success { color: var(--cx-success) !important; }
.text-danger  { color: var(--cx-danger) !important; }
.text-warning { color: var(--cx-warning) !important; }
.text-info    { color: var(--cx-info) !important; }

/* Badges ----------------------------------------------------- */
.badge.bg-primary { background-color: var(--cx-primary) !important; color: #fff; }
.badge.bg-success { background-color: var(--cx-success) !important; color: #fff; }
.badge.bg-danger  { background-color: var(--cx-danger) !important; color: #fff; }
.badge.bg-warning { background-color: var(--cx-warning) !important; color: #fff; }
.badge.bg-info    { background-color: var(--cx-info) !important; color: #fff; }
.badge.bg-secondary { background-color: var(--ink-2, #4A443C) !important; color: #fff; }

/* Borders ---------------------------------------------------- */
.border-primary { border-color: var(--cx-primary) !important; }
.border-success { border-color: var(--cx-success) !important; }
.border-danger  { border-color: var(--cx-danger) !important; }
.border-warning { border-color: var(--cx-warning) !important; }
.border-info    { border-color: var(--cx-info) !important; }

/* Alerts ----------------------------------------------------- */
.alert-primary {
    --bs-alert-color: #6F3A11;
    --bs-alert-bg: rgba(184, 96, 31, 0.10);
    --bs-alert-border-color: rgba(184, 96, 31, 0.25);
    --bs-alert-link-color: var(--cx-primary);
}
.alert-success {
    --bs-alert-color: #2A5A41;
    --bs-alert-bg: rgba(63, 125, 91, 0.12);
    --bs-alert-border-color: rgba(63, 125, 91, 0.28);
    --bs-alert-link-color: var(--cx-success);
}
.alert-danger {
    --bs-alert-color: #6E2A24;
    --bs-alert-bg: rgba(154, 59, 51, 0.10);
    --bs-alert-border-color: rgba(154, 59, 51, 0.28);
    --bs-alert-link-color: var(--cx-danger);
}
.alert-warning {
    --bs-alert-color: #6E4D0D;
    --bs-alert-bg: rgba(169, 117, 20, 0.12);
    --bs-alert-border-color: rgba(169, 117, 20, 0.28);
    --bs-alert-link-color: var(--cx-warning);
}
.alert-info {
    --bs-alert-color: #1A3559;
    --bs-alert-bg: rgba(31, 74, 130, 0.10);
    --bs-alert-border-color: rgba(31, 74, 130, 0.22);
    --bs-alert-link-color: var(--cx-info);
}

/* Form check / toggle switches ------------------------------- */
.form-check-input:checked {
    background-color: var(--cx-primary);
    border-color: var(--cx-primary);
}
.form-check-input:focus {
    border-color: var(--cx-primary);
    box-shadow: 0 0 0 0.2rem rgba(184, 96, 31, 0.18);
}

/* Links ------------------------------------------------------ */
a, .btn-link, a.text-primary { color: var(--cx-primary); }
a:hover, .btn-link:hover { color: var(--cx-primary-hover); }

/* Progress bars --------------------------------------------- */
.progress-bar { background-color: var(--cx-primary); }
.progress-bar.bg-success { background-color: var(--cx-success) !important; }
.progress-bar.bg-danger  { background-color: var(--cx-danger) !important; }
.progress-bar.bg-warning { background-color: var(--cx-warning) !important; }
.progress-bar.bg-info    { background-color: var(--cx-info) !important; }

/* ── Job V2 Dokumente tab ──────────────────────────────────────────────
   Layout shell + a few small visual primitives shared by the Angebote /
   Rechnungen / Dateien cards. Anything reusable elsewhere (chip, list-row,
   data-table, btn) intentionally lives upstream. */
.job-v2-docs {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 32px 40px;
}
.job-v2-docs__count {
    font-size: 11.5px;
    font-weight: var(--fw-semibold);
    color: var(--cx-text-muted);
    background: rgba(28, 25, 21, 0.05);
    padding: 1px 8px;
    border-radius: var(--radius-pill);
    margin-left: 6px;
}
.job-v2-docs__empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px 20px;
    color: var(--cx-text-muted);
    font-size: 13px;
}
.job-v2-docs__loading-ico {
    animation: job-v2-docs-spin 900ms linear infinite;
    display: inline-block;
}
@keyframes job-v2-docs-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.job-v2-docs__icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--cx-primary-soft);
    color: var(--cx-primary);
    flex-shrink: 0;
}
.job-v2-docs__icon.is-quote {
    background: color-mix(in srgb, var(--cx-info) 14%, white);
    color: var(--cx-info);
}
.job-v2-docs__sep {
    margin: 0 6px;
    color: var(--cx-text-muted);
}
.job-v2-docs__title {
    color: var(--cx-text-secondary);
    font-weight: var(--fw-medium);
}
.job-v2-docs__amount {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    font-weight: var(--fw-semibold);
    color: var(--cx-text-primary);
}
.job-v2-docs__actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
}

/* ── Document send — Stornorechnung sub-picker (Wave 5b) ──────────────── */
.cx-versenden__storno-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cx-versenden__storno-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid var(--hairline, rgba(28, 25, 21, 0.08));
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    width: 100%;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.cx-versenden__storno-row:hover {
    background: var(--sand, #F4F0E8);
    border-color: var(--hairline-strong, rgba(28, 25, 21, 0.14));
}
.cx-versenden__storno-row.is-selected {
    background: rgba(184, 96, 31, 0.08);
    border-color: rgba(184, 96, 31, 0.30);
    box-shadow: inset 3px 0 0 var(--copper, #B8601F);
}
.cx-versenden__storno-row:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.cx-versenden__storno-row-check {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid var(--hairline-strong, rgba(28, 25, 21, 0.14));
    background: #fff;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 11px;
    line-height: 1;
}
.cx-versenden__storno-row.is-selected .cx-versenden__storno-row-check {
    background: var(--copper, #B8601F);
    border-color: var(--copper, #B8601F);
}
.cx-versenden__storno-row-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.cx-versenden__storno-row-num {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink, #1C1915);
    letter-spacing: 0.01em;
}
.cx-versenden__storno-row-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    color: var(--cx-text-secondary, #4A443C);
}
.cx-versenden__storno-row-status {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: var(--sand, #F4F0E8);
    color: var(--cx-text-secondary, #4A443C);
    border-radius: 999px;
    text-transform: uppercase;
    line-height: 1.4;
    white-space: nowrap;
}
.cx-versenden__storno-row-date {
    color: var(--stone, #8E8679);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cx-versenden__storno-row-amount {
    flex-shrink: 0;
    font-family: var(--font-mono, monospace);
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink, #1C1915);
}
.cx-versenden__storno-empty {
    /* Empty-state piggy-backs on .cx-versenden__notice but tightens spacing
       so the section heading + notice read as a single block. */
    margin-top: 4px;
}

/* ── Document send — Wave 6 smart behaviors ─────────────────────────────── */

/* Last-sent breadcrumb above the kind chooser. Subtle, no chip — meant to
   read as continuous prose with the section title above it. */
.cx-versenden__last-sent {
    font-size: 11.5px;
    line-height: 1.4;
    color: var(--cx-text-muted, #8E8679);
    margin: -2px 0 8px;
}

/* Recipient suggestions — small clickable chips below the email input.
   Visually unobtrusive: ghost border + muted text until hover. */
.cx-versenden__recipient-suggestions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}
.cx-versenden__recipient-suggestions-prefix {
    font-size: 11.5px;
    color: var(--cx-text-muted, #8E8679);
    margin-right: 2px;
}
.cx-versenden__recipient-suggestion {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-size: 12px;
    font-family: inherit;
    color: var(--cx-text-secondary, #4A443C);
    background: transparent;
    border: 1px solid var(--hairline, rgba(28, 25, 21, 0.14));
    border-radius: 999px;
    cursor: pointer;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.cx-versenden__recipient-suggestion:hover,
.cx-versenden__recipient-suggestion:focus-visible {
    background: rgba(184, 96, 31, 0.08);
    border-color: var(--copper, #B8601F);
    color: var(--ink, #1C1915);
    outline: none;
}

/* Testversand link — ghost, sits under the subject input. Stays muted until
   hover so it doesn't compete with the primary CTA in the footer. */
.cx-versenden__test-send {
    margin-top: 6px;
}
.cx-versenden__test-send-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
    font-size: 12px;
    font-family: inherit;
    color: var(--cx-text-muted, #8E8679);
    background: transparent;
    border: 0;
    cursor: pointer;
    text-decoration: underline dotted;
    text-underline-offset: 3px;
}
.cx-versenden__test-send-link:hover:not(:disabled),
.cx-versenden__test-send-link:focus-visible {
    color: var(--copper, #B8601F);
    outline: none;
}
.cx-versenden__test-send-link:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}
.cx-versenden__test-send-link .bi {
    font-size: 13px;
}

/* Success-state region — replaces the body chrome after a real send. Sits
   above the (hidden) main+footer so the dialog stays open until the user
   either clicks the follow-up CTA or "Fertig". */
.cx-versenden__success {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 56px 32px;
    background: var(--paper, #FAF7F2);
    text-align: center;
}
.cx-versenden__success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(46, 125, 50, 0.10);
    color: #2E7D32;
}
.cx-versenden__success-icon .bi {
    font-size: 32px;
}
.cx-versenden__success-text {
    max-width: 480px;
}
.cx-versenden__success-title {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 600;
    color: var(--ink, #1C1915);
}
.cx-versenden__success-meta {
    margin: 0;
    font-size: 13px;
    color: var(--cx-text-secondary, #4A443C);
}
.cx-versenden__success-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}
/* When the success overlay is active, hide the underlying main body so the
   dialog reads as a single calm result screen. */
.cx-versenden__body.is-success-overlay {
    display: none;
}

/* Inline confirm modal that asks the user to mark a job as Beauftragt before
   sending an Auftragsbestätigung. Centered above the dialog body, dims the
   rest of the dialog via cx-versenden__inline-backdrop. */
.cx-versenden__inline-backdrop {
    position: absolute;
    inset: 0;
    /* Must clear Syncfusion RTE toolbar (sticky, internal stacking ~10–50)
       and any other sticky/positioned widget inside the dialog body. */
    z-index: 100;
    background: rgba(28, 25, 21, 0.32);
    backdrop-filter: blur(2px);
    border-radius: inherit;
}
.cx-versenden__confirm {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 101;
    width: min(440px, calc(100% - 48px));
    padding: 24px 24px 20px;
    background: var(--paper, #FAF7F2);
    border: 1px solid var(--hairline, rgba(28, 25, 21, 0.16));
    border-radius: 12px;
    box-shadow: 0 18px 48px rgba(28, 25, 21, 0.18);
    text-align: center;
}
.cx-versenden__confirm-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: 10px;
    border-radius: 50%;
    background: rgba(184, 96, 31, 0.10);
    color: var(--copper, #B8601F);
    font-size: 24px;
}
.cx-versenden__confirm-title {
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 600;
    color: var(--ink, #1C1915);
}
.cx-versenden__confirm-body {
    margin: 0 0 18px;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--cx-text-secondary, #4A443C);
}
.cx-versenden__confirm-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* ── Document send — Wave 7 polish ──────────────────────────────────────── */

/* Cmd+Enter discoverability hint near the send button. */
.cx-versenden__send-hint {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 8px;
    font-size: 11.5px;
    color: var(--cx-text-muted, #8E8679);
    user-select: none;
}
.cx-versenden__send-hint kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    padding: 1px 4px;
    font-family: var(--font-mono, monospace);
    font-size: 11px;
    color: var(--cx-text-secondary, #4A443C);
    background: var(--paper, #FAF7F2);
    border: 1px solid var(--hairline, rgba(28, 25, 21, 0.16));
    border-radius: 4px;
}

/* Retry button next to the inline error. Slightly tighter than the default
   ghost button so it reads as a secondary action paired with the error. */
.cx-versenden__retry-btn {
    padding: 6px 10px !important;
    font-size: 12.5px;
}

/* Mobile stacking: under 720px, tighten dialog padding so the chooser stays
   compact and the primary button stays reachable. The 1100px stacking rule
   lives in cx-job-detail.css; this handler just refines for narrow phones. */
@media (max-width: 720px) {
    .cx-versenden__success {
        padding: 32px 18px;
    }
    .cx-versenden__success-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        max-width: 320px;
    }
    .cx-versenden__send-hint {
        display: none; /* Cmd+Enter hint is desktop-only. */
    }
    .cx-versenden__recipient-suggestion {
        max-width: 100%;
    }
}

/* ── Bulk Operations Toolbar ── */
.bulk-operations-toolbar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(28, 25, 21, 0.95);
    color: white;
    border-radius: var(--radius-xl);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(8px);
    animation: cxSlideUp 0.3s ease-out;
}

.bulk-operations-toolbar .selection-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 14px;
}

.bulk-operations-toolbar .selection-info i {
    font-size: 18px;
    color: var(--cx-success);
}

.bulk-operations-toolbar .bulk-actions {
    display: flex;
    gap: 10px;
}

.bulk-operations-toolbar .btn.ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
}

.bulk-operations-toolbar .btn.ghost:hover {
    background: rgba(255, 255, 255, 0.1);
}

@keyframes cxSlideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (max-width: 640px) {
    .bulk-operations-toolbar {
        left: 16px;
        right: 16px;
        transform: none;
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    .bulk-operations-toolbar .selection-info {
        justify-content: center;
    }
    .bulk-operations-toolbar .bulk-actions {
        justify-content: center;
    }
}

/* ── Cleanup Wizard ── */
.cleanup-wizard {
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 16px;
}

.cleanup-wizard__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.cleanup-wizard__back {
    color: var(--cx-text-muted);
    text-decoration: none;
    font-size: 14px;
}

.cleanup-wizard__back:hover {
    color: var(--cx-text);
}

.cleanup-wizard__title {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cleanup-wizard__subtitle {
    margin: 0;
    color: var(--cx-text-muted);
    font-size: 14px;
}

.cleanup-wizard__progress {
    font-size: 13px;
    color: var(--cx-text-muted);
    white-space: nowrap;
}

.cleanup-wizard__loading,
.cleanup-wizard__done {
    text-align: center;
    padding: 48px 24px;
}

.cleanup-wizard__done-icon {
    font-size: 48px;
    color: var(--cx-success);
    margin-bottom: 16px;
}

.cleanup-wizard__done h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.cleanup-wizard__done p {
    color: var(--cx-text-muted);
    margin-bottom: 24px;
}

.cleanup-wizard__done .btn {
    margin: 0 6px 8px;
}

.cleanup-wizard__card {
    background: var(--cx-card-bg, #fff);
    border-radius: var(--radius-lg);
    border: 1px solid var(--cx-border);
    padding: 24px;
}

.cleanup-wizard__card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.cleanup-wizard__card-number {
    font-weight: 600;
    font-size: 18px;
    color: var(--cx-text);
}

.cleanup-wizard__card-body h3 {
    font-size: 18px;
    margin-bottom: 12px;
}

.cleanup-wizard__card-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    color: var(--cx-text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

.cleanup-wizard__guidance {
    display: flex;
    gap: 12px;
    padding: 14px;
    border: 1px solid rgba(44, 120, 108, 0.24);
    border-radius: 8px;
    background: rgba(44, 120, 108, 0.08);
}

.cleanup-wizard__guidance-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cx-success);
    color: #fff;
    flex-shrink: 0;
}

.cleanup-wizard__guidance-title {
    font-weight: 600;
    margin-bottom: 3px;
}

.cleanup-wizard__guidance p {
    margin: 0;
    color: var(--cx-text-muted);
    font-size: 13px;
    line-height: 1.45;
}

.cleanup-wizard__meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cleanup-wizard__meta-item i {
    opacity: 0.5;
    font-size: 14px;
}

.cleanup-wizard__progress-bar-wrapper {
    margin-bottom: 20px;
}

.cleanup-wizard__progress-bar {
    height: 6px;
    background: var(--cx-border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.cleanup-wizard__progress-fill {
    height: 100%;
    background: var(--cx-primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.cleanup-wizard__progress-text {
    font-size: 13px;
    color: var(--cx-text-muted);
}

.cleanup-wizard__done-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cleanup-wizard__card-header .chip.chip:not(.danger) {
    background: var(--cx-chip-bg, #e8e8e8);
    color: var(--cx-chip-color, #555);
    order: 1;
}

.cleanup-wizard__card-header .chip.danger {
    order: 0;
}

.cleanup-wizard__card-number {
    order: 2;
    margin-left: auto;
}

.cleanup-wizard__card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--cx-border);
}

.cleanup-wizard__action-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
}

.cleanup-wizard__action-btn i {
    font-size: 20px;
    flex-shrink: 0;
}

.cleanup-wizard__action-btn .btn-label {
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.3;
}

.cleanup-wizard__action-btn .btn-label span {
    font-weight: 600;
    font-size: 14px;
}

.cleanup-wizard__action-btn .btn-label small {
    font-size: 11px;
    opacity: 0.8;
    font-weight: 400;
}

.cleanup-wizard__skip {
    margin-left: auto;
}

.cleanup-wizard__skip:only-child {
    margin-left: 0;
    width: 100%;
    justify-content: center;
}

/* ── Global chooser card grid (shared by Catalog + FollowUp choosers) ──── */

.chooser-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    overflow: visible;
    padding-bottom: 0.5rem;
}

.followup-chooser-grid {
    grid-template-columns: repeat(2, 1fr);
}

.revert-chooser-grid {
    grid-template-columns: repeat(3, 1fr);
}

/* Two outcomes only — a reopened quote would land in no working list, so
   "Doch nicht angenommen" is not offered (see QuoteAcceptanceRevertDialog). */
.revert-chooser-grid--two {
    grid-template-columns: repeat(2, 1fr);
}

/* The cards lift on hover and bounce in on open; both overflow their box.
   Below the dialog width the three columns squeeze the subtitles too hard. */
@media (max-width: 600px) {
    .revert-chooser-grid,
    .revert-chooser-grid--two {
        grid-template-columns: 1fr;
    }
}

.chooser-header {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 1.05rem;
}

.chooser-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.75rem 1rem;
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    opacity: 0;
    transform: translateY(30px) scale(0.95);
}

.chooser-card.animate-in {
    animation: chooserBounceIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes chooserBounceIn {
    0%   { opacity: 0; transform: translateY(40px) scale(0.9); }
    60%  { opacity: 1; transform: translateY(-6px) scale(1.02); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.chooser-card:hover {
    border-color: var(--cx-primary);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}

.chooser-card:focus {
    outline: none;
    border-color: var(--cx-primary);
    box-shadow: 0 0 0 4px rgba(184, 96, 31, 0.15);
}

.chooser-card:active {
    transform: translateY(0) scale(0.98);
    transition-duration: 0.08s;
}

.chooser-card-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    border-radius: 14px;
    background: rgba(184, 96, 31, 0.08);
    color: var(--cx-primary);
    font-size: 1.75rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.chooser-card:hover .chooser-card-icon {
    background: var(--cx-primary);
    color: #fff;
}

.chooser-card-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--cx-text-primary);
    margin-bottom: 0.25rem;
}

.chooser-card-subtitle {
    font-size: 0.8rem;
    color: var(--cx-text-secondary);
    line-height: 1.35;
}

.chooser-card-badge {
    margin-top: 0.75rem;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(44, 120, 108, 0.12);
    color: var(--cx-success);
    font-size: 0.7rem;
    font-weight: 700;
}

.followup-chooser-intro {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid var(--cx-border);
    border-radius: 8px;
    background: var(--cx-surface, #f8f8f8);
}

.revert-chooser-note {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 14px;
    border: 1px solid var(--cx-border);
    border-radius: 8px;
    background: var(--cx-surface, #f8f8f8);
}

.revert-chooser-note--warning {
    border-color: rgba(184, 96, 31, 0.35);
    background: rgba(184, 96, 31, 0.07);
}

.revert-chooser-note > i {
    font-size: 1.15rem;
    color: var(--cx-primary);
    flex-shrink: 0;
}

.revert-chooser-note p {
    margin: 4px 0 0;
    color: var(--cx-text-muted);
    font-size: 13px;
    line-height: 1.45;
}

.followup-chooser-intro__step {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cx-primary);
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
}

.followup-chooser-intro p {
    margin: 2px 0 0;
    color: var(--cx-text-muted);
    font-size: 13px;
    line-height: 1.4;
}

/* ── Follow-up sidebar (sibling of the standard nav — sits in grid col 1) ── */

.followup-sidebar {
    width: 100%;
    height: 100%;
    background: var(--cx-sidebar-bg, #1C1915);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.followup-sidebar__header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--cx-sidebar-border);
}

.followup-sidebar__back {
    background: none;
    border: none;
    color: var(--cx-sidebar-text-muted);
    font-size: 13px;
    cursor: pointer;
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.followup-sidebar__back:hover {
    color: var(--cx-sidebar-text-hover);
}

.followup-sidebar__headline {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: var(--cx-sidebar-text);
}

.followup-sidebar__headline strong {
    font-size: 16px;
    line-height: 1.25;
}

.followup-sidebar__eyebrow {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--cx-sidebar-text-muted);
}

.followup-sidebar__loading,
.followup-sidebar__empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 32px 16px;
    color: var(--cx-sidebar-text-muted);
    font-size: 13px;
}

.followup-sidebar__body {
    padding: 12px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
    overflow-y: auto;
}

.followup-sidebar__section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--cx-sidebar-text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.followup-stepper {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 0 4px;
}

.followup-stepper__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 54px;
    color: var(--cx-sidebar-text-muted);
    font-size: 10px;
}

.followup-stepper__item span {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--cx-sidebar-border);
    font-weight: 700;
}

.followup-stepper__item.active {
    color: var(--cx-sidebar-text);
}

.followup-stepper__item.active span {
    background: var(--cx-success);
    border-color: var(--cx-success);
    color: #fff;
}

.followup-stepper__line {
    height: 1px;
    flex: 1;
    background: var(--cx-sidebar-border);
}

.followup-stepper__line.active {
    background: var(--cx-success);
}

/* ── Customer contact in sidebar ─────────────────────────────────────── */

.followup-contact__name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
}

.followup-contact__link {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--cx-sidebar-text);
    transition: background 0.15s ease;
    margin-bottom: 2px;
}

.followup-contact__link:hover {
    background: rgba(255, 255, 255, 0.06);
}

.followup-contact__link i {
    font-size: 16px;
    margin-top: 2px;
    opacity: 0.6;
}

.followup-contact__label {
    display: block;
    font-size: 11px;
    color: var(--cx-sidebar-text-muted);
}

.followup-contact__value {
    font-size: 14px;
    font-weight: 500;
}

.followup-contact__link--phone .followup-contact__value {
    font-size: 16px;
    font-weight: 600;
}

.followup-contact__manual {
    margin-top: 8px;
    justify-content: center;
}

.followup-sidebar__notice,
.followup-sidebar__hint {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: var(--cx-sidebar-text-muted);
    font-size: 12px;
    line-height: 1.4;
}

.followup-sidebar__notice {
    padding: 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    margin-bottom: 8px;
}

/* ── Quote card in sidebar ───────────────────────────────────────────── */

.followup-quote-card {
    background: var(--cx-card-bg, #fff);
    border: 1px solid var(--cx-border);
    border-radius: 10px;
    padding: 12px;
    color: var(--cx-text-primary);
}

.followup-quote-card__number {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 2px;
}

.followup-quote-card__title {
    font-size: 13px;
    color: var(--cx-text-secondary);
    margin-bottom: 8px;
    line-height: 1.3;
}

.followup-quote-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 500;
}

.followup-quote-card__date {
    font-size: 11px;
    color: var(--cx-text-muted);
}

/* ── AI tips in sidebar ──────────────────────────────────────────────── */

.followup-ai-tips__body {
    font-size: 12px;
    line-height: 1.5;
    color: var(--cx-sidebar-text);
}

.followup-ai-tips__item {
    padding: 3px 0;
    display: flex;
    gap: 6px;
}

.followup-ai-tips__item::before {
    content: "—";
    color: var(--cx-sidebar-text-muted);
    flex-shrink: 0;
}

.followup-ai-tips__loading {
    display: flex;
    justify-content: center;
    padding: 12px;
}

/* ── Guided follow-up script ─────────────────────────────────────────── */

.followup-guide__prompt {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--cx-sidebar-text);
    font-size: 12px;
    line-height: 1.45;
}

.followup-guide__prompt i {
    color: var(--cx-sidebar-text-muted);
    margin-top: 2px;
}

.followup-guide__checklist {
    display: grid;
    gap: 6px;
    margin-top: 8px;
    color: var(--cx-sidebar-text-muted);
    font-size: 12px;
}

.followup-guide__checklist div {
    display: flex;
    align-items: center;
    gap: 6px;
}

.followup-guide__checklist i {
    color: var(--cx-success);
}

/* ── Sidebar actions ─────────────────────────────────────────────────── */

.followup-sidebar__actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--cx-sidebar-border);
}

.followup-outcomes {
    display: grid;
    gap: 6px;
}

.followup-outcome {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid var(--cx-sidebar-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--cx-sidebar-text);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.followup-outcome:hover,
.followup-outcome.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--cx-success);
}

.followup-outcome i {
    margin-top: 2px;
    color: var(--cx-sidebar-text-muted);
}

.followup-outcome.active i {
    color: var(--cx-success);
}

.followup-outcome strong,
.followup-outcome small {
    display: block;
}

.followup-outcome strong {
    font-size: 13px;
    line-height: 1.2;
}

.followup-outcome small {
    margin-top: 2px;
    color: var(--cx-sidebar-text-muted);
    font-size: 11px;
    line-height: 1.3;
}

.followup-field {
    display: grid;
    gap: 4px;
}

.followup-field label {
    color: var(--cx-sidebar-text-muted);
    font-size: 11px;
    font-weight: 600;
}

.followup-field .form-control {
    font-size: 13px;
}

.followup-field textarea.form-control {
    resize: vertical;
    min-height: 84px;
}

/* ── Follow-up chooser dialog spacing ─────────────────────────────────── */

.followup-chooser-dialog .e-dlg-content {
    padding: 1.5rem 2rem 2rem;
    overflow: visible;
}

.followup-chooser-dialog .e-dlg-container {
    overflow: visible;
}

.followup-chooser-dialog.e-dialog {
    overflow: visible;
}

/* ── Acceptance-revert chooser dialog spacing ─────────────────────────── */
/* Same treatment as the follow-up chooser: without overflow:visible Syncfusion's
   default clips the cards' hover shadow and the bounce-in animation. */

.revert-acceptance-dialog .e-dlg-content {
    padding: 1.5rem 2rem 2rem;
    overflow: visible;
}

.revert-acceptance-dialog .e-dlg-container {
    overflow: visible;
}

.revert-acceptance-dialog.e-dialog {
    overflow: visible;
}
