/* ============================================================
   dist/css/design-system.css — Nexoro Design System
   ------------------------------------------------------------
   Sammlung wiederverwendbarer UI-Bausteine. Klassen-Prefix
   `.nx-*`. Wo das Spotlight-System schon Klassen hat (.sp-*),
   sind beide Selektoren kombiniert.

   WICHTIGE REGEL beim Rollout:
   -> NUR einzelne Komponenten swappen (Buttons, Inputs,
      Titles, Checkboxen, Pills, Badges).
   -> NICHT den Aufbau / das Layout der Seiten neu bauen.
   -> Bestehende Layout-Strukturen (.login-page, .login-form-panel,
      .modul-wrapper, Module-Tables usw.) bleiben unangetastet.

   COLORS: zwei Theme-Achsen, multi-tenant.
   -> --theme-color (primary, aus settings.themecolor)
   -> --secondary-color (aus settings.secondary_color, Default Gold)
   Beide sind in layout_header.php als CSS-Vars exposed plus
   abgeleitete Varianten (--theme-soft, --secondary-soft etc.).
   NIEMALS hardcoded Hex-Codes — immer var(--theme-color) etc.
   ============================================================ */

:root {
    /* Spacing-Skala (8px Grid mit Halbschritten) */
    --nx-space-1:  4px;
    --nx-space-2:  8px;
    --nx-space-3:  12px;
    --nx-space-4:  16px;
    --nx-space-5:  20px;
    --nx-space-6:  24px;
    --nx-space-8:  32px;
    --nx-space-10: 40px;
    --nx-space-12: 48px;

    /* Radii */
    --nx-radius-xs:   5px;
    --nx-radius-sm:   7px;
    --nx-radius-md:   10px;
    --nx-radius-lg:   14px;
    --nx-radius-xl:   18px;
    --nx-radius-full: 999px;
    /* Button-Radius: eigener Token statt --nx-radius-sm, damit er sich vom
       Dashboard-Quick-Action-Button ("Neue E-Mail", dashboard/styles.css
       --d2-r-md) ableiten laesst, ohne Karten/Modal-Ecken (--nx-radius-md)
       mitzuziehen. Siehe wiki/concepts/design-buttons-global.md. */
    --nx-radius-btn:  11px;

    /* Schatten */
    --nx-shadow-sm:   0 1px 2px rgba(15, 23, 42, 0.04);
    --nx-shadow-md:   0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.03);
    --nx-shadow-lg:   0 4px 14px rgba(15, 23, 42, 0.06);
    --nx-shadow-xl:   0 14px 44px rgba(15, 23, 42, 0.10), 0 4px 12px rgba(15, 23, 42, 0.04);

    /* Transitions */
    --nx-tx-fast: 100ms;
    --nx-tx-med:  180ms;
    --nx-tx-slow: 280ms;
    --nx-ease:    cubic-bezier(0.22, 1, 0.36, 1);
    --nx-bounce:  cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Typography */
    --nx-font:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --nx-font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace;

    /* Touch-Target Minimum (Apple Standard) */
    --nx-touch-min: 44px;

    /* ── Fallbacks fuer Theme/Secondary wenn die Page das nicht
       per layout_header.php exposed (z.B. /login/, externe Seiten). */
    --theme-color:     #3AAAC1;
    --theme-dark:      #2A8295;
    --theme-soft:      rgba(58, 170, 193, 0.12);
    --theme-glow:      rgba(58, 170, 193, 0.22);
    --secondary-color: #CC9900;
    --secondary-dark:  #997300;
    --secondary-soft:  rgba(204, 153, 0, 0.13);
    --secondary-glow:  rgba(204, 153, 0, 0.22);
}

/* ============================================================
   TYPOGRAFIE-UTILITIES
   ============================================================ */
.nx-h1 {
    font-family: var(--nx-font);
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.15;
    color: #0f172a;
}
.nx-h2 {
    font-family: var(--nx-font);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.2;
    color: #0f172a;
}
.nx-h3 {
    font-family: var(--nx-font);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
    color: #0f172a;
}
.nx-body {
    font-family: var(--nx-font);
    font-size: 14px;
    line-height: 1.55;
    color: #334155;
}
.nx-muted { color: #64748b; }
.nx-mono {
    font-family: var(--nx-font-mono);
    font-size: 12.5px;
    color: #475569;
}

/* ============================================================
   TAG / BADGE (Eyebrow oben — z.B. "AUFTRAG", "AUFGABE")
   ============================================================ */
.nx-tag,
.sp-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--theme-soft);
    color: var(--theme-dark);
    font-family: var(--nx-font);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 9px;
    border-radius: var(--nx-radius-full);
    line-height: 1.3;
}

/* Semantische Tag-Varianten */
.nx-tag.secondary { background: var(--secondary-soft); color: var(--secondary-dark); }
.nx-tag.amber     { background: rgba(245,158,11,0.13); color: #92400e; }
.nx-tag.green     { background: rgba(16,185,129,0.13); color: #047857; }
.nx-tag.red       { background: rgba(239,68,68,0.13);  color: #b91c1c; }
.nx-tag.gray      { background: #f1f5f9; color: #475569; }

/* Ansprechpartner-Rollen (2026-08-11): Chips + Tag-Eingabe, gerendert von
   dist/js/contact-roles.js. Baut ausschliesslich auf .nx-tag auf, damit die
   Rollen ueberall wie die uebrigen Tags aussehen. */
.nx-role-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.nx-role-editor {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.nx-role-chip {
    /* Der Loeschen-Knopf sitzt im Chip, deshalb rechts etwas weniger Luft. */
    padding-right: 5px;
}
.nx-role-remove {
    background: none;
    border: 0;
    padding: 0 2px;
    margin: 0;
    cursor: pointer;
    color: inherit;
    opacity: 0.55;
    font-size: 13px;
    line-height: 1;
}
.nx-role-remove:hover { opacity: 1; }
.nx-role-input {
    font-family: var(--nx-font);
    font-size: 13px;
    padding: 7px 10px;
    border: 1px solid #e2e8f0;
    border-radius: var(--nx-radius-sm, 8px);
    background: #fff;
    color: #0f172a;
    width: 100%;
}
.nx-role-input:focus {
    outline: none;
    border-color: var(--theme-color);
    box-shadow: 0 0 0 3px var(--theme-soft);
}

/* ============================================================
   TITLE + SUBTITLE (Modal/Page Header)
   ============================================================ */
.nx-title,
.sp-title {
    font-family: var(--nx-font);
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
    line-height: 1.2;
    margin: 0 0 6px;
    word-break: break-word;
}

.nx-subtitle,
.sp-subtitle {
    font-family: var(--nx-font);
    font-size: 13px;
    color: #64748b;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    line-height: 1.4;
}
.nx-meta-item,
.sp-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
.nx-meta-item i,
.sp-meta-item i { font-size: 10px; opacity: 0.7; }

/* ============================================================
   SECTION-HEADER (UPPERCASE Sektion-Title mit Counter)
   ============================================================ */
.nx-section-title,
.sp-section-title {
    font-family: var(--nx-font);
    font-size: 10.5px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.nx-count,
.sp-count {
    background: #f1f5f9;
    color: #475569;
    padding: 1px 7px;
    border-radius: var(--nx-radius-full);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}
.nx-section { margin-bottom: 22px; }
.nx-section:last-child { margin-bottom: 0; }

/* ============================================================
   STATS GRID (4-Spalten Kennzahlen-Tiles)
   ============================================================ */
.nx-stats,
.sp-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.nx-stat,
.sp-stat {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--nx-radius-md);
    padding: 11px 12px;
    text-align: left;
}
.nx-stat-val,
.sp-stat-val {
    font-family: var(--nx-font);
    font-size: 19px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.nx-stat-lbl,
.sp-stat-lbl {
    font-family: var(--nx-font);
    font-size: 11px;
    color: #64748b;
    margin-top: 3px;
    font-weight: 500;
    line-height: 1.3;
}

@media (max-width: 480px) {
    .nx-stats, .sp-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   INFO CARD (lichtgrauer Block mit Icon-Zeilen)
   ============================================================ */
.nx-info,
.sp-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--nx-radius-lg);
    padding: 13px 15px;
    font-family: var(--nx-font);
}
.nx-info-row,
.sp-info-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #0f172a;
}
.nx-info-row i,
.sp-info-row i {
    width: 16px;
    color: #94a3b8;
    font-size: 12px;
    flex-shrink: 0;
    text-align: center;
}
.nx-info-row strong,
.sp-info-row strong {
    color: #0f172a;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.nx-info-row a,
.sp-info-row a {
    color: var(--theme-color);
    text-decoration: none;
    font-weight: 500;
}
.nx-info-row a:hover,
.sp-info-row a:hover { text-decoration: underline; }
.nx-info-empty,
.sp-info-empty {
    color: #94a3b8;
    font-style: italic;
}

/* ============================================================
   LIST-ITEM (Icon + Title + Sub + Pill)
   ============================================================ */
.nx-list,
.sp-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.nx-item,
.sp-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: var(--nx-radius-sm);
    background: #fff;
    cursor: pointer;
    transition: border-color var(--nx-tx-fast), transform 80ms;
    text-decoration: none;
    color: inherit;
    font-family: var(--nx-font);
}
.nx-item:hover,
.sp-item:hover {
    border-color: var(--theme-color);
    box-shadow: var(--nx-shadow-sm);
    text-decoration: none;
    color: inherit;
}
.nx-item:active,
.sp-item:active { transform: translateY(0.5px); }

.nx-item-icon,
.sp-item-icon {
    width: 30px;
    height: 30px;
    border-radius: var(--nx-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--theme-soft);
    color: var(--theme-dark);
    font-size: 12px;
    flex-shrink: 0;
}
.nx-item-icon.secondary,
.sp-item-icon.secondary { background: var(--secondary-soft); color: var(--secondary-dark); }
.nx-item-icon.amber,  .sp-item-icon.amber  { background: rgba(245,158,11,0.12); color: #d97706; }
.nx-item-icon.violet, .sp-item-icon.violet { background: rgba(168,85,247,0.12); color: #9333ea; }
.nx-item-icon.green,  .sp-item-icon.green  { background: rgba(16,185,129,0.13); color: #047857; }
.nx-item-icon.red,    .sp-item-icon.red    { background: rgba(239,68,68,0.12);  color: #b91c1c; }
.nx-item-icon.gray,   .sp-item-icon.gray   { background: #f1f5f9; color: #64748b; }

.nx-item-main,
.sp-item-main {
    flex: 1;
    min-width: 0;
}
.nx-item-title,
.sp-item-title {
    font-size: 13.5px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.005em;
}
.nx-item-sub,
.sp-item-sub {
    font-size: 11.5px;
    color: #64748b;
}

/* ============================================================
   PILL (Status-Indikator)
   ============================================================ */
.nx-pill,
.sp-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--nx-radius-full);
    font-family: var(--nx-font);
    font-size: 10.5px;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.5;
}
.nx-pill.theme,     .sp-pill.theme     { background: var(--theme-soft); color: var(--theme-dark); }
.nx-pill.secondary, .sp-pill.secondary { background: var(--secondary-soft); color: var(--secondary-dark); }
.nx-pill.danger,    .sp-pill.danger    { background: rgba(239,68,68,0.12);  color: #b91c1c; }
.nx-pill.warn,      .sp-pill.warn      { background: rgba(245,158,11,0.13); color: #92400e; }
.nx-pill.ok,        .sp-pill.ok        { background: rgba(16,185,129,0.13); color: #047857; }
.nx-pill.info,      .sp-pill.info      { background: rgba(59,130,246,0.12); color: #1d4ed8; }

/* ============================================================
   EMPTY-STATE (gestrichelter Hinweis-Block)
   ============================================================ */
.nx-empty,
.sp-empty {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: var(--nx-radius-md);
    padding: 18px;
    text-align: center;
    color: #94a3b8;
    font-family: var(--nx-font);
    font-size: 12.5px;
}
.nx-empty.lg { padding: 32px 24px; font-size: 13.5px; }
.nx-empty i {
    display: block;
    font-size: 20px;
    margin-bottom: 8px;
    opacity: 0.4;
}

/* ============================================================
   ICON-BUTTON (32x32 quadratisch, fuer Toolbars)
   ============================================================ */
.nx-icon-btn,
.sp-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--nx-radius-sm);
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-family: var(--nx-font);
    transition: background var(--nx-tx-fast), color var(--nx-tx-fast);
    padding: 0;
}
.nx-icon-btn:hover,
.sp-icon-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}
.nx-icon-btn:disabled,
.sp-icon-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.nx-icon-btn:disabled:hover,
.sp-icon-btn:disabled:hover { background: transparent; }

/* Touch-Target enlarge auf Mobile */
@media (max-width: 768px) {
    .nx-icon-btn { width: 40px; height: 40px; }
}

/* ============================================================
   BUTTONS (Standard + Primary + Dark + Ghost + Danger + Secondary)
   ============================================================ */
.nx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 14px;
    min-height: 38px;
    border-radius: var(--nx-radius-btn);
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #334155;
    font-family: var(--nx-font);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--nx-tx-fast), border-color var(--nx-tx-fast), box-shadow var(--nx-tx-fast), transform 80ms;
}
.nx-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
    text-decoration: none;
}
.nx-btn:active { transform: translateY(0.5px); }
.nx-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Verlauf + Glow 1:1 nach dashboard/styles.css .d2-qbtn-primary ("Neue E-Mail"):
   --d2-grad -> --theme-gradient, --d2-brand-glow -> rgba(--theme-rgb, .30). */
.nx-btn-primary {
    background: var(--theme-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 8px rgba(var(--theme-rgb), .30);
}
.nx-btn-primary:hover {
    background: var(--theme-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 5px 14px rgba(var(--theme-rgb), .30);
    transform: translateY(-1px);
}
.nx-btn-primary:active { transform: translateY(0); }

/* Gleiches Prinzip, aus der Secondary-Farbe (--secondary-gradient, layout_header.php). */
.nx-btn-secondary {
    background: var(--secondary-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 8px rgba(var(--secondary-rgb), .30);
}
.nx-btn-secondary:hover {
    background: var(--secondary-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 5px 14px rgba(var(--secondary-rgb), .30);
    transform: translateY(-1px);
}
.nx-btn-secondary:active { transform: translateY(0); }

.nx-btn-dark {
    background: #0f172a;
    border-color: #0f172a;
    color: #fff;
}
.nx-btn-dark:hover {
    background: #000;
    border-color: #000;
    color: #fff;
}

.nx-btn-ghost {
    border-color: transparent;
    background: transparent;
    color: #64748b;
}
.nx-btn-ghost:hover {
    background: #f1f5f9;
    border-color: transparent;
    color: #0f172a;
}

.nx-btn-danger {
    color: #b91c1c;
}
.nx-btn-danger:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.3);
    color: #991b1b;
}

/* Button-Groessen */
.nx-btn-sm { padding: 6px 11px; min-height: 32px; font-size: 12.5px; }
.nx-btn-lg { padding: 12px 18px; min-height: 46px; font-size: 14.5px; }

/* Action-Footer-Button (fuer Spotlight + Modale) */
.nx-foot-btn,
.sp-foot-btn {
    flex: 1;
    padding: 10px 12px;
    min-height: 40px;
    border-radius: var(--nx-radius-btn);
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #334155;
    font-family: var(--nx-font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    text-decoration: none;
    transition: background var(--nx-tx-fast), border-color var(--nx-tx-fast), box-shadow var(--nx-tx-fast), transform 80ms;
}
.nx-foot-btn:hover,
.sp-foot-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
    text-decoration: none;
}
.nx-foot-btn.primary,
.sp-foot-btn.primary {
    background: var(--theme-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 8px rgba(var(--theme-rgb), .30);
}
.nx-foot-btn.primary:hover,
.sp-foot-btn.primary:hover {
    background: var(--theme-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 5px 14px rgba(var(--theme-rgb), .30);
    transform: translateY(-1px);
}
.nx-foot-btn.secondary,
.sp-foot-btn.secondary {
    background: var(--secondary-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 8px rgba(var(--secondary-rgb), .30);
}
.nx-foot-btn.secondary:hover,
.sp-foot-btn.secondary:hover {
    background: var(--secondary-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 5px 14px rgba(var(--secondary-rgb), .30);
    transform: translateY(-1px);
}

/* ============================================================
   GENERIC CARD
   ============================================================ */
.nx-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--nx-radius-lg);
    padding: var(--nx-space-5);
    box-shadow: var(--nx-shadow-md);
    font-family: var(--nx-font);
}
.nx-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 12px;
}
.nx-card-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
}
.nx-card-action { display: flex; align-items: center; gap: 6px; }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.nx-field { margin-bottom: 14px; }
.nx-label {
    display: block;
    font-family: var(--nx-font);
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    margin-bottom: 6px;
}

.nx-input,
.nx-select,
.nx-textarea {
    width: 100%;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--nx-radius-sm);
    font-family: var(--nx-font);
    font-size: 14px;
    color: #0f172a;
    transition: border-color var(--nx-tx-med), box-shadow var(--nx-tx-med);
    min-height: 40px;
}
.nx-input::placeholder,
.nx-textarea::placeholder { color: #94a3b8; }

.nx-input:focus,
.nx-select:focus,
.nx-textarea:focus {
    outline: none;
    border-color: var(--theme-color);
    box-shadow: 0 0 0 3px var(--theme-glow);
}
.nx-textarea {
    resize: vertical;
    min-height: 80px;
    font-family: var(--nx-font);
}

.nx-input-hint {
    font-size: 11.5px;
    color: #94a3b8;
    margin-top: 5px;
}
.nx-input-error { border-color: #ef4444; }
.nx-input-error:focus { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18); }

/* .nx-secret (maskiertes Feld ohne type="password") lebt bewusst NICHT hier,
   sondern in dist/css/nx-secret.css. Grund: die Regel muss global im Shell
   geladen sein, design-system.css wird aber pro Modul eingebunden.
   Siehe wiki/concepts/2026-07-29-browser-autofill.md */

/* Select-Arrow */
.nx-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M2 4l4 4 4-4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* Touch-Friendly auf Mobile (verhindert iOS-Zoom) */
@media (max-width: 768px) {
    .nx-input, .nx-select, .nx-textarea {
        font-size: 16px;
        min-height: 44px;
    }
}

/* ─── Checkbox (eigene Optik) ─────────────────────────── */
.nx-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    font-family: var(--nx-font);
    font-size: 13.5px;
    color: #334155;
    user-select: none;
    position: relative;
}
.nx-checkbox input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}
.nx-checkbox-box {
    width: 18px;
    height: 18px;
    border: 1.5px solid #cbd5e1;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background var(--nx-tx-med), border-color var(--nx-tx-med);
    background: #fff;
}
.nx-checkbox-box i {
    font-size: 10px;
    color: #fff;
    opacity: 0;
    transition: opacity var(--nx-tx-fast);
}
.nx-checkbox input:checked + .nx-checkbox-box {
    background: var(--theme-color);
    border-color: var(--theme-color);
}
.nx-checkbox input:checked + .nx-checkbox-box i { opacity: 1; }

/* ─── Switch (Toggle) ─────────────────────────────────── */
.nx-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    gap: 9px;
    font-family: var(--nx-font);
    font-size: 13.5px;
    color: #334155;
}
.nx-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}
.nx-switch-track {
    width: 36px;
    height: 20px;
    border-radius: var(--nx-radius-full);
    background: #cbd5e1;
    position: relative;
    transition: background var(--nx-tx-med);
    flex-shrink: 0;
}
.nx-switch-track::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    top: 2px;
    left: 2px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
    transition: left var(--nx-tx-med) var(--nx-bounce);
}
.nx-switch input:checked + .nx-switch-track {
    background: var(--theme-color);
}
.nx-switch input:checked + .nx-switch-track::after {
    left: 18px;
}

/* ============================================================
   TABS
   ============================================================ */
.nx-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 4px;
    overflow-x: auto;
    scrollbar-width: none;
}
.nx-tabs::-webkit-scrollbar { display: none; }
.nx-tab {
    background: none;
    border: none;
    padding: 11px 14px;
    font-family: var(--nx-font);
    font-size: 13.5px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: color var(--nx-tx-fast), border-color var(--nx-tx-fast);
}
.nx-tab:hover { color: #0f172a; }
.nx-tab.active {
    color: var(--theme-dark);
    border-bottom-color: var(--theme-color);
    font-weight: 600;
}

/* ============================================================
   MODAL / SHEET
   Desktop = zentriertes Modal mit Backdrop.
   Mobile  = Bottom-Sheet das von unten reinslidet.
   ============================================================ */
/* Ebenen: der Dialog muss ueber die KOMPLETTE Shell, nicht nur ueber den
   Seiteninhalt. Die Navbar liegt auf 1030 (`dist/css/menu.css`), der mobile
   Drawer auf 1050, das mobile Profilmenue auf 10100 (`includes/menu.php`) —
   mit den urspruenglichen 1000/1001 lag der Dialog unter allen dreien, und ein
   hoher Dialog verschwand mit seinem Kopf hinter der Kopfzeile. Darueber
   bleiben bewusst die modulspezifischen Overlays (12000-14000 in /auftrag) und
   das Tutorial (99990+). */
.nx-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.40);
    z-index: 10200;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--nx-tx-med) var(--nx-ease);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.nx-modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.nx-modal {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, calc(-50% + 8px));
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 64px);
    background: #fff;
    border-radius: var(--nx-radius-xl);
    z-index: 10201;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--nx-shadow-xl);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--nx-tx-med) var(--nx-ease),
                transform var(--nx-tx-med) var(--nx-ease);
    font-family: var(--nx-font);
}
.nx-modal.open {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%);
}

.nx-modal-head {
    padding: 16px 20px 14px;
    border-bottom: 1px solid #f1f5f9;
    flex: 0 0 auto;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.nx-modal-head-content { flex: 1; min-width: 0; }
.nx-modal-body {
    padding: 18px 20px;
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
}
.nx-modal-foot {
    padding: 12px 20px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
    align-items: center;
    background: #fafbfc;
}

/* Modal-Size-Varianten */
.nx-modal.sm { width: min(420px, calc(100vw - 32px)); }
.nx-modal.lg { width: min(720px, calc(100vw - 32px)); }
.nx-modal.xl { width: min(960px, calc(100vw - 32px)); }

/* ─── Mobile: Bottom-Sheet ────────────────────────────── */
@media (max-width: 768px) {
    .nx-modal {
        top: auto;
        /* Sit above the fixed mobile bottom nav (.mbn-wrap). --mbn-offset is the
           nav's footprint (height + safe-area); falls back to the bare safe-area
           inset when the nav is absent so the sheet never hides its own footer. */
        bottom: var(--mbn-offset, env(safe-area-inset-bottom, 0px));
        left: 0; right: 0;
        transform: translateY(100%);
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        border-radius: var(--nx-radius-xl) var(--nx-radius-xl) 0 0;
    }
    .nx-modal.open { transform: translateY(0); }
    .nx-modal.sm, .nx-modal.lg, .nx-modal.xl { width: 100%; }
    .nx-modal-head { padding-top: max(16px, env(safe-area-inset-top)); }
    .nx-modal-foot { flex-wrap: wrap; }
    .nx-modal-foot .nx-foot-btn, .nx-modal-foot .nx-btn { flex: 1; }
}

/* ============================================================
   ALERT (z.B. Login-Fehler, Speichern-Erfolg)
   ============================================================ */
.nx-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: var(--nx-radius-sm);
    font-family: var(--nx-font);
    font-size: 13px;
    line-height: 1.45;
    border: 1px solid transparent;
}
.nx-alert i { font-size: 14px; flex-shrink: 0; }

.nx-alert-error {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.20);
    color: #b91c1c;
}
.nx-alert-warn {
    background: rgba(245, 158, 11, 0.10);
    border-color: rgba(245, 158, 11, 0.22);
    color: #92400e;
}
.nx-alert-success {
    background: rgba(16, 185, 129, 0.10);
    border-color: rgba(16, 185, 129, 0.22);
    color: #047857;
}
.nx-alert-info {
    background: rgba(59, 130, 246, 0.10);
    border-color: rgba(59, 130, 246, 0.22);
    color: #1d4ed8;
}

/* ============================================================
   DIVIDER
   ============================================================ */
.nx-divider {
    height: 1px;
    background: #e2e8f0;
    border: none;
    margin: var(--nx-space-5) 0;
}
.nx-divider.dashed { background: transparent; border-top: 1px dashed #cbd5e1; height: 0; }

/* ============================================================
   AVATAR
   ============================================================ */
.nx-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--theme-soft);
    color: var(--theme-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--nx-font);
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    flex-shrink: 0;
}
.nx-avatar img { width: 100%; height: 100%; object-fit: cover; }
.nx-avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.nx-avatar.lg { width: 48px; height: 48px; font-size: 16px; }

/* ============================================================
   KBD (Tastatur-Visualisierung)
   ============================================================ */
.nx-kbd {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border: 1px solid #e2e8f0;
    border-bottom-width: 2px;
    border-radius: 5px;
    background: #fff;
    font-family: var(--nx-font-mono);
    font-size: 11px;
    font-weight: 600;
    color: #334155;
    line-height: 1.4;
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .nx-modal-backdrop,
    .nx-modal,
    .nx-pill,
    .nx-item,
    .nx-btn,
    .nx-icon-btn,
    .sp-modal,
    .sp-item,
    .sp-icon-btn { transition: none !important; }
}

/* ============================================================
   CUSTOM ENTRIES — Tabelle der Einträge einer Mehrfach-Sektion
   Renderer: dist/js/custom-entries.js (geteilt von /auftrag und /kunden)
   Konzept:  wiki/concepts/2026-08-11-repeatable-sections.md
   ============================================================ */
.nx-entries-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--nx-space-3, 12px);
    margin-bottom: var(--nx-space-3, 12px);
    flex-wrap: wrap;
}

/* Breite Sektionen (bis zu 5 Spalten) dürfen INNEN scrollen. Ohne den
   eigenen Scrollcontainer schiebt die Tabelle die ganze Seite auf. */
.nx-entries-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.nx-entries-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--nx-font);
    font-size: 13.5px;
}
.nx-entries-table th {
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: #64748b;
    padding: 8px 12px;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}
.nx-entries-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: middle;
}
.nx-entries-table tbody tr:hover td { background: #f8fafc; }
.nx-entries-table tbody td:not(.nx-entries-actions) { cursor: pointer; }
.nx-entries-actions-col { width: 1%; }
.nx-entries-actions {
    white-space: nowrap;
    text-align: right;
}
.nx-entries-actions .nx-icon-btn + .nx-icon-btn { margin-left: 4px; }
.nx-entries-del:hover { color: var(--nx-danger, #dc2626); }

/* Mobil wird aus der Tabelle eine Kartenliste: fünf Spalten sind auf einem
   Telefon nicht lesbar. Rein per CSS, damit ein Drehen des Geräts nicht den
   gerade offenen Zustand neu aufbaut. */
@media (max-width: 768px) {
    .nx-entries-table thead { display: none; }
    .nx-entries-table,
    .nx-entries-table tbody,
    .nx-entries-table tr,
    .nx-entries-table td { display: block; width: 100%; }
    .nx-entries-table tr {
        border: 1px solid #e2e8f0;
        border-radius: var(--nx-radius-lg, 12px);
        margin-bottom: var(--nx-space-2, 8px);
        padding: 4px 0;
        position: relative;
    }
    .nx-entries-table td {
        border-bottom: 0;
        padding: 6px 12px;
    }
    .nx-entries-table td:first-child {
        font-weight: 600;
        padding-right: 92px;   /* Platz für die Aktionen oben rechts */
    }
    .nx-entries-table td:empty { display: none; }
    .nx-entries-actions {
        position: absolute;
        top: 4px;
        right: 8px;
    }
}

/* ─── Dokumentenscan (dist/js/doc-scan.js) ───────────────────── */

.nx-entries-head-actions {
    display: flex;
    align-items: center;
    gap: var(--nx-space-2, 8px);
    flex-wrap: wrap;
}

.nx-scan-pick { text-align: center; padding: var(--nx-space-4, 16px) 0; }

.nx-scan-hint {
    font-size: 13px;
    color: var(--nx-text-muted, #64748b);
    line-height: 1.5;
    max-width: 46ch;
    margin: 0 auto var(--nx-space-4, 16px);
}

.nx-scan-buttons {
    display: flex;
    gap: var(--nx-space-2, 8px);
    justify-content: center;
    flex-wrap: wrap;
}

.nx-scan-status {
    font-size: 13px;
    color: var(--nx-text-muted, #64748b);
    padding: var(--nx-space-2, 8px) 0;
    text-align: center;
}

/* Die Vorschau ist Beleg, kein Bildbetrachter: sie soll zeigen, WELCHES Blatt
   gelesen wurde, und dabei die Vorschlagsliste nicht aus dem Bild schieben. */
.nx-scan-preview {
    display: block;
    max-width: 100%;
    max-height: 160px;
    margin: 0 auto var(--nx-space-3, 12px);
    border-radius: var(--nx-radius-md, 10px);
    border: 1px solid var(--nx-border, #e2e8f0);
}

.nx-scan-row {
    display: flex;
    align-items: flex-end;
    gap: var(--nx-space-3, 12px);
    padding: var(--nx-space-2, 8px) 0;
    border-bottom: 1px solid var(--nx-border-soft, #f1f5f9);
}

.nx-scan-row:last-child { border-bottom: 0; }
.nx-scan-row > .nx-checkbox { margin-bottom: 10px; flex: 0 0 auto; }
.nx-scan-field { flex: 1 1 auto; min-width: 0; }
.nx-scan-row .nx-pill { flex: 0 0 auto; margin-bottom: 8px; }

/* ============================================================
   STEPS (Belegstatus-Leiste)
   ============================================================
   Fortschritt eines Belegs durch seine Statusfolge: Entwurf -> Angebot ->
   gesendet -> angenommen. Aus der /dokumentenverwaltung (.status-progress-*)
   hierher gehoben, damit die /kalkulation dieselbe Leiste zeigt, statt eine
   dritte Kopie derselben Optik zu bauen. Die alten Klassen dort bleiben
   unberuehrt.

   Markup:
     <div class="nx-steps">
       <div class="nx-step is-done"><span class="nx-step-dot"></span>Entwurf</div>
       <div class="nx-step-link is-done"></div>
       <div class="nx-step is-current">...</div>
     </div>
   Zustaende: is-done | is-current | is-pending | is-rejected
*/
.nx-steps {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
}
.nx-step {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 13px;
    border-radius: var(--nx-radius-sm, 7px);
    border: 1px solid transparent;
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    transition: background var(--nx-tx-fast), color var(--nx-tx-fast), border-color var(--nx-tx-fast);
}
.nx-step-dot {
    width: 14px;
    height: 14px;
    line-height: 14px;
    text-align: center;
    font-size: 10px;
    font-weight: 700;
}
.nx-step-link {
    width: 26px;
    height: 2px;
    background: #e2e8f0;
    flex: 0 0 auto;
}
.nx-step-link.is-done { background: #86efac; }

.nx-step.is-pending { background: #f1f5f9; color: #64748b; border-color: #e2e8f0; }
.nx-step.is-done { background: #f0fdf4; color: #166534; border-color: #86efac; }
.nx-step.is-current {
    background: var(--theme-gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(var(--theme-rgb), .30);
}
.nx-step.is-rejected { background: #fef2f2; color: #dc2626; border-color: #fca5a5; }

/* Ein anklickbarer Schritt sagt das auch. Nicht jeder ist es: zurueck auf
   Entwurf gibt es nicht, die Nummer ist dann schon vergeben. */
.nx-step.is-clickable { cursor: pointer; }
.nx-step.is-clickable:hover { filter: brightness(0.97); }

.nx-step-date {
    margin-left: 6px;
    padding-left: 6px;
    border-left: 1px solid currentColor;
    font-size: 11px;
    font-weight: 400;
    opacity: 0.75;
}

@media (max-width: 768px) {
    .nx-step { padding: 5px 9px; font-size: 11.5px; }
    .nx-step-link { width: 12px; }
}
