#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* Pàgines /Account (SSR estàtic, sense MudBlazor interactiu) */
body { margin: 0; font-family: Roboto, 'Helvetica Neue', Arial, sans-serif; }
.account-card {
    max-width: 420px;
    margin: 8vh auto;
    padding: 1.5rem;
    box-sizing: border-box;
    width: calc(100% - 32px);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}
.account-card label { display: block; margin: .8rem 0 .2rem; font-size: .9rem; }
/* Same look as MudBlazor's outlined inputs: the MudBlazor reset strips native borders. The palette vars are not set here (no MudThemeProvider), hence the fallbacks. */
.account-card input {
    width: 100%; box-sizing: border-box; padding: .6rem; font-size: 1rem; font-family: inherit;
    border: 1px solid var(--mud-palette-lines-inputs, rgba(0, 0, 0, .23)); border-radius: 4px;
    background: var(--mud-palette-surface, #fff); color: var(--mud-palette-text-primary, rgba(0, 0, 0, .87));
    transition: border-color .15s, box-shadow .15s;
}
.account-card input:hover { border-color: var(--mud-palette-text-primary, rgba(0, 0, 0, .87)); }
.account-card input:focus {
    outline: none; border-color: var(--mud-palette-primary, #594ae2);
    box-shadow: 0 0 0 1px var(--mud-palette-primary, #594ae2);
}
.account-card button { margin-top: 1.2rem; width: 100%; padding: .7rem; font-size: 1rem; cursor: pointer; }
.account-card .error { color: #c62828; margin-top: .8rem; }
.account-card .ok { color: #2e7d32; margin-top: .8rem; }

.markdown-cos p, .markdown-cos ul, .markdown-cos ol, .markdown-cos blockquote { margin: 0 0 .75rem; }
.markdown-cos ul, .markdown-cos ol { padding-left: 1.5rem; }
.markdown-cos blockquote { border-left: 4px solid var(--mud-palette-lines-default); padding-left: .75rem; opacity: .85; }
.markdown-cos h1, .markdown-cos h2, .markdown-cos h3 { margin: 1rem 0 .5rem; }
.markdown-cos code { background: var(--mud-palette-background-gray); padding: 0 .25rem; border-radius: 3px; }
.markdown-cos a { color: var(--mud-palette-primary); }

/* Barra de franja horària: el tram verd s'arrossega per desplaçar-lo i s'estira pels extrems */
.franja-rang { position: relative; height: 34px; margin-top: .5rem; user-select: none; touch-action: none; }
.franja-rang .pista { position: absolute; left: 0; right: 0; top: 4px; height: 26px; border-radius: 6px; background: var(--mud-palette-gray-light); }
.franja-rang .tram {
    position: absolute; top: 4px; height: 26px; border-radius: 6px; background: var(--mud-palette-success);
    display: flex; align-items: center; justify-content: space-between; overflow: hidden;
}
.franja-rang.mobil .tram { cursor: grab; }
.franja-rang.mobil .tram.arrossegant { cursor: grabbing; filter: brightness(.92); }
.franja-rang .nansa { width: 12px; height: 100%; flex: none; cursor: ew-resize; background: rgba(0, 0, 0, .18); }
.franja-rang .nansa::after { content: ""; display: block; width: 2px; height: 12px; margin: 7px auto; background: rgba(255, 255, 255, .85); border-radius: 1px; }
.franja-rang.desactivat .tram, .franja-rang.desactivat .nansa { cursor: default; }

/* Línia de temps d'una nit (producció) */
.linia-temps { margin: .5rem 0 1rem; }
.linia-temps .eix { position: relative; height: 1.1rem; font-size: .7rem; color: var(--mud-palette-text-secondary); }
.linia-temps .eix span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.linia-temps .eix span:first-child { transform: none; }
.linia-temps .eix span:last-child { transform: translateX(-100%); }
.linia-temps .pista-temps { position: relative; height: 3rem; border-radius: 6px; background: var(--mud-palette-gray-light); overflow: hidden; }
.linia-temps .pista-temps i { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(0, 0, 0, .12); }
.linia-temps .bloc {
    position: absolute; top: 4px; bottom: 4px; border-radius: 4px; padding: 0 .3rem; display: flex; align-items: center;
    color: #fff; font-size: .75rem; overflow: hidden; border: 1px solid rgba(255, 255, 255, .6); box-sizing: border-box;
    print-color-adjust: exact; -webkit-print-color-adjust: exact;
}
.linia-temps .bloc span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.linia-temps .t-concert { background: var(--mud-palette-primary); }
.linia-temps .t-oberturaportes { background: var(--mud-palette-warning-darken, #b26a00); }
.linia-temps .t-pausa { background: #9e9e9e; }
.linia-temps .t-tancament { background: #424242; }
.linia-temps .t-altre { background: var(--mud-palette-info, #0288d1); }

/* Impressió: només el contingut de la pàgina */
@media print {
    .mud-appbar, .mud-drawer, .mud-drawer-overlay, .no-print { display: none !important; }
    .mud-main-content { margin: 0 !important; padding: 0 !important; }
    body { background: #fff !important; }
    .dia-imprimir { break-inside: avoid; page-break-inside: avoid; }
}

/* Línia de temps editable: blocs arrossegables amb nanses als extrems */
.linia-temps .bloc .text { flex: 1; min-width: 0; }
.linia-temps.editable .bloc { cursor: grab; touch-action: none; user-select: none; }
.linia-temps.editable .bloc.arrossegant { cursor: grabbing; filter: brightness(.92); z-index: 2; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
.linia-temps .nansa { flex: none; width: 8px; align-self: stretch; margin: 0 -.3rem; cursor: ew-resize; background: rgba(0, 0, 0, .2); }
.linia-temps .nansa:first-child { margin-right: .3rem; }
.linia-temps .nansa:last-child { margin-left: .3rem; }
.linia-temps .indicador {
    display: none; position: absolute; right: 4px; top: -1.4rem; padding: 0 .4rem; border-radius: 4px; font-size: .75rem;
    background: var(--mud-palette-dark, #333); color: #fff; pointer-events: none;
}
.linia-temps .pista-temps { overflow: visible; }
@media print { .linia-temps .nansa, .linia-temps .nansa-m, .linia-temps .indicador { display: none !important; } }

/* Concerts: la citació sobresurt per sobre de la barra i el límit de desmuntatge per sota (poden coincidir amb altres elements) */
.linia-temps.marges .pista-temps { height: 4.6rem; }
.linia-temps.marges .bloc { top: 1.3rem; bottom: 1.3rem; overflow: visible; }
.linia-temps .bloc .seg {
    position: absolute; height: .8rem; box-sizing: border-box; border: 1px solid rgba(255, 255, 255, .7);
    background: repeating-linear-gradient(45deg, var(--mud-palette-primary) 0 4px, var(--mud-palette-primary-darken, #3f3cb0) 4px 8px);
    print-color-adjust: exact; -webkit-print-color-adjust: exact;
}
.linia-temps .bloc .seg-cit { top: -.9rem; border-radius: 4px 4px 0 0; }
.linia-temps .bloc .seg-des { bottom: -.9rem; border-radius: 0 0 4px 4px; }
.linia-temps .nansa-m { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; background: rgba(255, 255, 255, .55); }
.linia-temps .seg-cit .nansa-m { left: 0; }
.linia-temps .seg-des .nansa-m { right: 0; }

/* Mapa de només lectura: a l'imprimir té una amplada fixa (A4 vertical amb marges) perquè l'enquadrament sigui previsible */
@media print { .mapa-lectura { width: 17cm !important; max-width: 100%; print-color-adjust: exact; -webkit-print-color-adjust: exact; } }

/* Mapa a l'imprimir: sense controls d'edició ni de zoom; els quadres de color de la llegenda es conserven al PDF */
.nomes-print { display: none; }
.quadre-legenda { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.imprimint { width: 17cm !important; max-width: 100%; }
@media print {
    .nomes-print { display: block; }
    .leaflet-draw, .leaflet-control-layers, .leaflet-control-zoom { display: none !important; }
}

/* Table scroll containers must be positioned: MudRating's hidden inputs are position:absolute and otherwise escape the scroll area, widening the page on mobile */
.mud-simple-table .mud-table-container { position: relative; }


.markdown-cos table { border-collapse: collapse; margin: 0 0 .75rem; }
.markdown-cos th, .markdown-cos td { border: 1px solid var(--mud-palette-lines-default); padding: .25rem .6rem; }
.markdown-cos hr { border: 0; border-top: 1px solid var(--mud-palette-lines-default); margin: 1rem 0; }

.markdown-cos img { max-width: 100%; height: auto; }

/* Línia de temps multidia d'un proveïdor: concerts de l'edició i marcadors de muntatge/desmuntatge */
.linia-dies { margin: .25rem 0 .5rem; }
.linia-dies .eix-d { position: relative; height: 1rem; font-size: .7rem; color: var(--mud-palette-text-secondary); }
.linia-dies .eix-d span { position: absolute; white-space: nowrap; }
.linia-dies .pista-d { position: relative; height: 2rem; border-radius: 6px; background: var(--mud-palette-gray-light); }
.linia-dies .pista-d i { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(0, 0, 0, .12); }
.linia-dies .bloc-ed {
    position: absolute; top: 6px; bottom: 6px; border-radius: 3px; background: var(--mud-palette-primary); opacity: .55; min-width: 2px;
    print-color-adjust: exact; -webkit-print-color-adjust: exact;
}
.linia-dies .tram { position: absolute; top: 2px; height: 3px; background: var(--mud-palette-text-secondary); opacity: .6; border-radius: 2px; }
.linia-dies .marc { position: absolute; top: 2px; bottom: 2px; width: 10px; margin-left: -5px; border-radius: 3px; border: 1px solid #fff; box-sizing: border-box; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.linia-dies .marc::before { content: ""; position: absolute; inset: 0 -8px; }
.linia-dies .marc-m { background: var(--mud-palette-success, #2e7d32); }
.linia-dies .marc-d { background: var(--mud-palette-error, #c62828); }
.linia-dies.editable .marc { cursor: ew-resize; touch-action: none; user-select: none; }
.linia-dies .marc.arrossegant { z-index: 2; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
.linia-dies .resum-d { display: flex; flex-wrap: wrap; gap: .1rem 1rem; margin-top: 2px; font-size: .75rem; }
.linia-dies .r-m::before, .linia-dies .r-d::before { content: ""; display: inline-block; width: .6rem; height: .6rem; margin-right: .3rem; border-radius: 2px; }
.linia-dies .r-m:empty::before, .linia-dies .r-d:empty::before { display: none; }
.linia-dies .r-m::before { background: var(--mud-palette-success, #2e7d32); }
.linia-dies .r-d::before { background: var(--mud-palette-error, #c62828); }

/* Taules de producció: mateixes columnes a totes; en pantalles estretes cada fila es converteix en una fitxa.
   Els selectors porten .mud-simple-table table per guanyar en especificitat a MudSimpleTable (display:table-*). */
.taula-prod table { table-layout: fixed; width: 100%; min-width: 0; }
.taula-prod td, .taula-prod th { overflow-wrap: anywhere; }
.taula-prod .fila-linia td { padding-top: 0; }
@media (max-width: 700px) {
    .taula-prod .mud-simple-table table thead, .taula-prod .mud-simple-table table colgroup { display: none; }
    .taula-prod .mud-simple-table table,
    .taula-prod .mud-simple-table table tbody,
    .taula-prod .mud-simple-table table * tr,
    .taula-prod .mud-simple-table table * tr > td { display: block; width: 100%; }
    .taula-prod .mud-simple-table table * tr.fila-prov { border-top: 2px solid var(--mud-palette-lines-default); padding-top: .5rem; }
    .taula-prod .mud-simple-table table * tr > td { text-align: left !important; border: 0 !important; padding: .15rem .75rem !important; height: auto !important; overflow-wrap: normal; }
    .taula-prod td[data-etq]::before { content: attr(data-etq) ": "; color: var(--mud-palette-text-secondary); }
}

/* Explorador de fitxers (Administració > Fitxers) */
.explorador-graella { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.explorador-carpeta, .explorador-fitxer { cursor: pointer; overflow: hidden; transition: box-shadow .15s, border-color .15s; }
.explorador-carpeta:hover, .explorador-fitxer:hover { border-color: var(--mud-palette-primary); box-shadow: var(--mud-elevation-2); }
.explorador-miniatura { height: 130px; display: flex; align-items: center; justify-content: center;
    background-color: var(--mud-palette-action-default-hover); }
.explorador-miniatura img { width: 100%; height: 100%; object-fit: cover; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) { .explorador-graella { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }

/* Avís de reconnexió amb el servidor (wwwroot/js/reconnexio.js) */
#abm-reconnexio { position: fixed; inset: 0; z-index: 2000; display: none; align-items: center; justify-content: center;
    padding: 16px; background-color: rgba(0, 0, 0, 0.35); }
.abm-reconnexio-caixa { display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 360px;
    padding: 20px 24px; border-radius: 8px; text-align: center; font-family: Roboto, sans-serif;
    background-color: var(--mud-palette-surface, #fff); color: var(--mud-palette-text-primary, #222);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25); }
.abm-reconnexio-boto { display: none; padding: 8px 16px; border: 0; border-radius: 4px; cursor: pointer; font: inherit;
    background-color: var(--mud-palette-primary, #594ae2); color: var(--mud-palette-primary-text, #fff); }
#abm-reconnexio[data-estat="manual"] .abm-reconnexio-boto { display: inline-block; }
