/* Nachtwerk Design System – Ergänzungen zum MudTheme (MudBlazor 9.11).
   Setzt voraus, dass MainLayout den Wrapper mit .nw-dark / .nw-light rendert. */

.nw-dark  { --nw-surface-raised: #27221c; --nw-primary-tint: rgba(222, 143, 98, 0.15); }
.nw-light { --nw-surface-raised: #fffdf9; --nw-primary-tint: rgba(161, 79, 42, 0.10); }

/* Schwebende Ebenen */
.mud-dialog,
.mud-popover.mud-paper { background-color: var(--nw-surface-raised); }

/* Neutrale Snackbar auf der schwebenden Fläche */
.mud-snackbar.mud-alert-filled-normal {
    background-color: var(--nw-surface-raised);
    color: var(--mud-palette-text-primary);
    border: 1px solid var(--mud-palette-lines-default);
}

/* Radius lg (10px) */
.mud-card, .mud-dialog, .mud-popover.mud-paper,
.mud-table, .mud-data-grid.mud-table { border-radius: 10px; }

/* Flache Chrome-Ebenen mit Linie statt Schatten */
.nw-appbar { border-bottom: 1px solid var(--mud-palette-lines-default); }
.nw-drawer { border-right: 1px solid var(--mud-palette-lines-default); }
.mud-paper-outlined { border-color: var(--mud-palette-lines-default); }

/* Aktive Navigation */
.mud-nav-link { border-radius: 6px; margin: 2px 8px; width: auto; }
.mud-nav-link.active:not(.mud-nav-link-disabled) {
    background-color: var(--nw-primary-tint);
    color: var(--mud-palette-primary);
}

/* Ausgewählte Tabellenzeile (über RowClassFunc gesetzt) */
.nw-row-selected { background-color: var(--nw-primary-tint); }

/* Outlined-Felder: Label immer transparent in der Rahmen-Aussparung.
   MudBlazor 9 tut das bereits; die Regel schützt vor Überschreibungen
   (ältere Versionen, Fremd-CSS, die das Label mit Surface-Farbe hinterlegen). */
.mud-input-label.mud-input-label-outlined { background-color: transparent !important; }

/* Fokusring – nie entfernen */
.mud-button-root:focus-visible,
.mud-nav-link:focus-visible,
.mud-chip:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
}

/* IDs, Beträge, Code */
.nw-mono {
    font-family: "JetBrains Mono", ui-monospace, Consolas, monospace;
    font-size: .8125rem;
    font-variant-numeric: tabular-nums;
}

/* Rechtsbündige Zahlenspalten: MudDataGrid legt den Spaltenkopf in einen Flex-Container (.column-header),
   darum wirkt HeaderStyle="text-align:right" dort nicht. Umgekehrte Reihenfolge: Text ganz rechts über den Werten,
   die Sortier-Schaltfläche (bei sortierbaren Spalten) links davon. */
.mud-data-grid th[style*="text-align:right"] .column-header,
.mud-data-grid th[style*="text-align: right"] .column-header {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

/* Beträge in Eingabefeldern rechtsbündig (z. B. MudNumericField Class="nw-zahl"), wie in Tabellen */
.nw-zahl input {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Bildbetrachter mit Zoom und Verschieben (Modul Dokumente): Fläche mit Hand-Cursor, Fokusring für die Tastatur */
.nw-bildflaeche {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    border: 1px solid var(--mud-palette-lines-default);
    background-color: var(--mud-palette-background-gray);
    cursor: grab;
    touch-action: none;
    user-select: none;
}
.nw-bildflaeche.nw-bildflaeche-zieht { cursor: grabbing; }
.nw-bildflaeche:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
}
.nw-bildflaeche img {
    position: absolute;
    left: 0;
    top: 0;
    max-width: none;
    transform-origin: 0 0;
    visibility: hidden;     /* bis Grösse bekannt und eingepasst */
    will-change: transform;
    pointer-events: none;   /* Ziehen gehört der Fläche, nicht dem Bild (kein Browser-Drag) */
}

/* Chips mit langem Text (z. B. Bezüge „Auftrag: AU-2026-001 Montage …“): Text bricht innerhalb der verfügbaren
   Breite um, statt über den Chip hinauszuragen (schmale Bildschirme). Klasse am MudChip: Class="nw-chip-umbruch". */
.mud-chip.nw-chip-umbruch {
    height: auto;
    min-height: 24px;
    max-width: 100%;
}
.mud-chip.nw-chip-umbruch .mud-chip-content {
    white-space: normal;
    overflow-wrap: anywhere;
    min-width: 0;
    padding-block: 2px;
    line-height: 1.3;
}
.mud-chip.nw-chip-umbruch .mud-chip-close-button {
    flex-shrink: 0;
    align-self: center;
}

/* Explorer: anklickbare Zeile eines Eintrags (Suche, Verlauf, Dossier). Aktiv wie die Navigation. */
.nw-explorer-zeile {
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
}
.nw-explorer-zeile:hover {
    background-color: var(--mud-palette-action-default-hover);
}
.nw-explorer-zeile-aktiv {
    background-color: var(--nw-primary-tint);
}
.nw-explorer-zeile:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
}
/* Betrag/Stunden: breit als eigene Spalte, schmal in der zweiten Zeile */
.nw-explorer-kompakt {
    display: none;
}
@media (max-width: 599.98px) {
    .nw-explorer-spalte {
        display: none !important;
    }
    .nw-explorer-kompakt {
        display: inline;
    }
}
