/*
 * Nomenaments telemàtics (nomenaments2.php). Estil sobri a l'estil Holded, el mateix llenguatge que el redisseny de la
 * intranet: neutres càlids, filets fins, un sol accent i la llima només com a filet. Sense colors de categoria:
 * l'únic color semàntic és «No adjudicat».
 * Ordinador: barra de filtres compacta i taula. ≤ 900 px: filtres plegats. ≤ 760 px: llista compacta.
 */

:root {
    --n-50: #fafaf9;
    --n-100: #f5f5f4;
    --n-200: #eceae6;
    --n-300: #d6d3d1;
    --n-400: #9ca3af;
    --n-500: #686f7c;
    --n-600: #4b5563;
    --n-700: #374151;
    --n-900: #121926;
    --line: #e6e4de;
    --llima: #96d701;
    --vermell: #b42318;
    --r-ctl: 8px;
    --r-card: 12px;
    --ring: 0 0 0 3px rgba(150, 215, 1, .35);
    --fletxa: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23686f7c' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background: transparent;
}

body {
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    color: var(--n-900);
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
    font-variant-numeric: tabular-nums;
}

button,
input,
select {
    font: inherit;
    color: inherit;
}

:focus-visible {
    outline: 2px solid var(--n-900);
    outline-offset: 2px;
}

.nt-amagat {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.nt-mode-centre .nt-sense-centre {
    display: none !important;
}

.nt {
    max-width: 1280px;
    margin: 0 auto;
    padding: 4px 2px 24px;
}

/* ------------------------------------------------------------------ capçalera (només fora de la pàgina del web) */

.nt-incrustat .nt-cap {
    display: none;
}

.nt-cap {
    margin: 0 0 14px;
}

.nt-titol {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 650;
    letter-spacing: -.02em;
}

.nt-cap-sub {
    margin: 2px 0 0;
    font-size: .85rem;
    color: var(--n-500);
}

/* ------------------------------------------------------------------ cerca + botó de filtres (mòbil) + versió antiga */

.nt-barra {
    display: flex;
    gap: 8px;
    margin: 0 0 10px;
}

.nt-cerca {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.nt-cerca svg {
    position: absolute;
    left: 12px;
    width: 17px;
    height: 17px;
    fill: none;
    stroke: var(--n-500);
    stroke-width: 2;
    stroke-linecap: round;
    pointer-events: none;
}

.nt-cerca input {
    width: 100%;
    height: 40px;
    padding: 0 12px 0 38px;
    border: 1px solid var(--line);
    border-radius: var(--r-ctl);
    background: #fff;
    font-size: .95rem;
    outline: 0;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color .15s, box-shadow .15s;
}

.nt-cerca input:focus,
.nt-ctl:focus-within {
    border-color: var(--n-400);
    box-shadow: var(--ring);
}

.nt-cerca input::placeholder,
.nt-ctl input::placeholder {
    color: var(--n-400);
}

.nt-btn-filtres {
    display: none;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-ctl);
    background: #fff;
    font-weight: 550;
    color: var(--n-700);
    cursor: pointer;
    flex: none;
}

.nt-btn-filtres svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.nt-btn-filtres-n {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--n-900);
    color: #fff;
    font-size: .7rem;
    font-weight: 650;
}

.nt-btn-filtres-n[hidden] {
    display: none;
}

/* ------------------------------------------------------------------ filtres: grups (on · què · quan · resultat) */

.nt-filtres {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px 18px;
    margin: 0 0 12px;
    padding: 14px 16px 16px;
    border: 1px solid var(--line);
    border-radius: var(--r-card);
    background: #fff;
}

.nt-grup {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.nt-grup legend {
    margin: 0 0 6px;
    padding: 0;
    font-size: .7rem;
    font-weight: 650;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--n-500);
}

/* control compacte amb l'etiqueta a dins */
.nt-ctl {
    display: flex;
    align-items: center;
    width: 100%;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: var(--r-ctl);
    background: #fff;
    overflow: hidden;
    transition: border-color .15s, box-shadow .15s;
}

.nt-ctl-et {
    flex: none;
    padding: 0 0 0 10px;
    font-size: .8rem;
    color: var(--n-500);
    white-space: nowrap;
}

.nt-ctl select,
.nt-ctl input {
    flex: 1;
    width: 100%;
    height: 100%;
    min-width: 0;
    padding: 0 10px 0 6px;
    border: 0;
    background: transparent;
    font-size: .85rem;
    font-weight: 550;
    color: var(--n-900);
    outline: 0;
    -webkit-appearance: none;
    appearance: none;
}

.nt-ctl select {
    padding-right: 26px;
    background: var(--fletxa) no-repeat right 9px center;
    text-overflow: ellipsis;
    cursor: pointer;
}

/* rang: dues dates o dos números en un sol control */
.nt-ctl--rang input {
    padding: 0 4px 0 6px;
    font-size: .8rem;
}

.nt-ctl--rang input[type="date"] {
    padding-right: 2px;
}

.nt-ctl input[type="date"]::-webkit-calendar-picker-indicator {
    width: 12px;
    height: 12px;
    margin: 0 0 0 2px;
    padding: 0;
    opacity: .55;
    cursor: pointer;
}

.nt-ctl--rang input[type="search"] {
    text-align: left;
}

.nt-rang-sep {
    flex: none;
    color: var(--n-400);
    font-size: .8rem;
}

.nt-ctl input:disabled {
    opacity: .4;
}

.nt-netejar {
    align-self: flex-start;
    margin-top: 2px;
    padding: 4px 0;
    border: 0;
    background: none;
    font-size: .8rem;
    color: var(--n-500);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.nt-netejar:hover {
    color: var(--n-900);
}

.nt-netejar[hidden] {
    display: none;
}

/* ------------------------------------------------------------------ filtres actius */

.nt-xips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 10px;
}

.nt-xips:empty {
    display: none;
}

.nt-xip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    height: 26px;
    padding: 0 8px 0 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--n-100);
    font-size: .8rem;
    color: var(--n-700);
    cursor: pointer;
}

.nt-xip > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nt-xip:hover {
    background: var(--n-200);
}

.nt-xip-x {
    font-size: .68rem;
    color: var(--n-500);
}

.nt-xip--tots {
    padding: 0 10px;
    background: transparent;
    border-style: dashed;
    color: var(--n-500);
}

/* ------------------------------------------------------------------ resultats */

.nt-resultats {
    border: 1px solid var(--line);
    border-radius: var(--r-card);
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 17, 23, .04);
    overflow: hidden;
}

.nt-resultats-cap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}

.nt-resum {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 28px;
    margin: 0;
}

.nt-resum dt {
    font-size: .75rem;
    color: var(--n-500);
}

.nt-resum dd {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 650;
    color: var(--n-900);
    white-space: nowrap;
}

.nt-resum-pct {
    font-size: .8rem;
    font-weight: 500;
    color: var(--n-500);
}

.nt-resum-pct:not(:empty)::before {
    content: "(";
}

.nt-resum-pct:not(:empty)::after {
    content: ")";
}

.nt-ordre select {
    height: 32px;
    padding: 0 26px 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--r-ctl);
    background: #fff var(--fletxa) no-repeat right 9px center;
    font-size: .85rem;
    color: var(--n-700);
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

/* taula (ordinador) */
.nt-taula {
    width: 100%;
    border-collapse: collapse;
}

.nt-taula thead th {
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--n-500);
    text-align: left;
    white-space: nowrap;
}

.nt-taula th[data-ordre] {
    cursor: pointer;
    user-select: none;
}

.nt-taula th[data-ordre]:hover {
    color: var(--n-900);
}

.nt-taula th[aria-sort="ascending"]::after {
    content: " ↑";
    color: var(--n-900);
}

.nt-taula th[aria-sort="descending"]::after {
    content: " ↓";
    color: var(--n-900);
}

.nt-dreta {
    text-align: right !important;
}

.nt-fila td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--n-100);
    vertical-align: top;
    font-size: .875rem;
    color: var(--n-700);
}

.nt-fila:last-child td {
    border-bottom: 0;
}

.nt-fila:hover td {
    background: var(--n-50);
}

/* fila clicable: obre el panell de detall */
.nt-fila--clic {
    cursor: pointer;
}

.nt-fila--clic:focus-visible {
    outline: 2px solid var(--n-900);
    outline-offset: -2px;
}

/* com a la intranet: en passar-hi per sobre, filet llima */
.nt-fila:hover td:first-child {
    box-shadow: inset 3px 0 0 var(--llima);
}

.nt-resultats.is-carregant tbody {
    opacity: .45;
    transition: opacity .15s;
}

.nt-data {
    white-space: nowrap;
    color: var(--n-900);
}

.nt-data-curta {
    display: none;
}

.nt-sub {
    display: block;
    margin-top: 1px;
    font-size: .78rem;
    color: var(--n-500);
}

.nt-centre {
    display: block;
    font-weight: 550;
    color: var(--n-900);
    overflow-wrap: anywhere;
}

.nt-codi {
    display: inline-block;
    min-width: 34px;
    margin-right: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .78rem;
    font-weight: 600;
    color: var(--n-500);
    text-decoration: none;
    border: 0;
    cursor: help;
}

.nt-esp-nom {
    color: var(--n-700);
    overflow-wrap: anywhere;
}

.nt-jor,
.nt-per,
.nt-proc {
    white-space: nowrap;
}

.nt-num {
    font-weight: 600;
    color: var(--n-900);
}

.nt-noadj {
    font-size: .8rem;
    font-weight: 600;
    color: var(--vermell);
    white-space: nowrap;
}

.nt-proc {
    color: var(--n-600);
}

/* esquelet */
.nt-fila--esquelet td {
    padding: 14px 12px;
}

.nt-os {
    display: block;
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(90deg, var(--n-100) 0, var(--n-50) 40%, var(--n-100) 80%);
    background-size: 220% 100%;
    animation: nt-brilla 1.2s linear infinite;
}

@keyframes nt-brilla {
    from { background-position: 120% 0; }
    to { background-position: -100% 0; }
}

/* estats */
.nt-buit,
.nt-error {
    padding: 28px 16px;
    text-align: center;
    color: var(--n-500);
}

.nt-buit[hidden],
.nt-error[hidden] {
    display: none;
}

.nt-buit-titol {
    margin: 0 0 2px;
    font-weight: 600;
    color: var(--n-900);
}

.nt-peu {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    border-top: 1px solid var(--line);
    background: var(--n-50);
}

.nt-peu-text {
    margin: 0;
    font-size: .8rem;
    color: var(--n-500);
}

.nt-boto {
    height: 32px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-ctl);
    background: #fff;
    font-size: .85rem;
    font-weight: 550;
    color: var(--n-900);
    cursor: pointer;
}

.nt-boto[hidden] {
    display: none;
}

.nt-boto:hover {
    background: var(--n-100);
}

.nt-boto.is-carregant {
    opacity: .6;
    cursor: progress;
}

.nt-avis {
    margin: 10px 2px 0;
    font-size: .78rem;
    color: var(--n-500);
}

.nt-avis a {
    color: var(--n-700);
}

/* enllaç a la interfície DataTables d'abans (nomenaments2_antic.php): botó destacat a la dreta de la barra de cerca,
   amb un degradat verd USTEC que es mou suaument perquè es vegi (estàtic si l'usuari demana menys moviment) */
.nt-btn-antic {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    margin-left: auto;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: var(--r-ctl);
    background: linear-gradient(110deg, #2e7d1e 0%, #4caf1a 25%, var(--llima) 50%, #4caf1a 75%, #2e7d1e 100%);
    background-size: 300% 100%;
    font-size: .85rem;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    text-shadow: 0 1px 1px rgba(0, 0, 0, .25);
    white-space: nowrap;
    flex: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 0 0 0 rgba(150, 215, 1, .45);
    animation: nt-antic-degradat 4s ease-in-out infinite, nt-antic-pols 2.6s ease-out infinite;
    transition: box-shadow .15s, filter .15s;
}

.nt-btn-antic:hover {
    filter: brightness(1.07);
    animation-play-state: paused;
}

.nt-btn-antic:focus-visible {
    outline: 0;
    box-shadow: var(--ring);
    animation: nt-antic-degradat 4s ease-in-out infinite;
}

@keyframes nt-antic-degradat {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes nt-antic-pols {
    0%   { box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 0 0 0 rgba(150, 215, 1, .55); }
    70%  { box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 0 0 7px rgba(150, 215, 1, 0); }
    100% { box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 0 0 0 rgba(150, 215, 1, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .nt-btn-antic {
        animation: none;
        background-position: 50% 50%;
    }
}

.nt-btn-antic svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ------------------------------------------------------------------ ≤ 900 px: filtres plegats */

@media (max-width: 900px) {
    .nt-btn-filtres {
        display: inline-flex;
    }

    .nt-filtres {
        display: none;
        grid-template-columns: 1fr;
        padding: 12px;
    }

    .is-filtres-oberts .nt-filtres {
        display: grid;
    }

    .is-filtres-oberts .nt-btn-filtres {
        background: var(--n-100);
    }

    /* els controls d'un grup, de dos en dos */
    .nt-grup {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .nt-grup legend {
        grid-column: 1 / -1;
        margin-bottom: 2px;
    }

    .nt-ctl--rang,
    .nt-netejar {
        grid-column: 1 / -1;
    }
}

@media (max-width: 520px) {
    .nt-grup {
        grid-template-columns: 1fr;
    }

    .nt-btn-antic {
        padding: 0 11px;
    }

    .nt-btn-antic span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}

/* ------------------------------------------------------------------ ≤ 760 px: llista compacta */

@media (max-width: 760px) {
    .nt-resultats-cap {
        padding: 10px 12px;
    }

    .nt-resum {
        gap: 4px 18px;
    }

    .nt-resum dd {
        font-size: .95rem;
    }

    .nt-taula thead {
        display: none;
    }

    .nt-taula,
    .nt-taula tbody {
        display: block;
    }

    /* cada nomenament: centre ··· número / especialitat ··· jornada / data · període · procediment */
    .nt-fila {
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        column-gap: 10px;
        row-gap: 2px;
        padding: 11px 12px;
        border-bottom: 1px solid var(--n-100);
    }

    .nt-fila:last-child {
        border-bottom: 0;
    }

    .nt-fila td {
        display: block;
        padding: 0;
        border: 0;
        min-width: 0;
        background: transparent !important;
        box-shadow: none !important;
    }

    .nt-c-centre { order: 1; flex: 1 1 60%; }
    .nt-c-num { order: 2; margin-left: auto; }
    .nt-c-esp { order: 3; flex: 1 1 60%; }
    .nt-c-jor { order: 4; margin-left: auto; }
    .nt-c-data { order: 6; }
    .nt-c-per { order: 7; }
    .nt-c-proc { order: 8; }

    /* salt de línia abans de data · període · procediment */
    .nt-fila::after {
        content: "";
        order: 5;
        flex-basis: 100%;
        height: 0;
    }

    .nt-centre {
        font-size: .92rem;
        line-height: 1.3;
    }

    .nt-c-centre .nt-sub {
        display: none;
    }

    .nt-codi {
        min-width: 0;
    }

    .nt-esp-nom,
    .nt-jor {
        font-size: .82rem;
    }

    .nt-jor {
        color: var(--n-500);
    }

    /* la darrera línia, petita i grisa: acte · període · procediment */
    .nt-fila .nt-c-data,
    .nt-fila .nt-c-per,
    .nt-fila .nt-c-proc,
    .nt-c-data .nt-data-curta,
    .nt-c-per .nt-per,
    .nt-c-proc .nt-proc {
        font-size: .76rem;
        color: var(--n-500);
    }

    .nt-c-data .nt-data {
        display: none;
    }

    .nt-c-data .nt-data-curta {
        display: inline;
    }

    .nt-c-data .nt-sub,
    .nt-c-per .nt-sub {
        display: inline;
        margin: 0 0 0 4px;
        font-size: .76rem;
    }

    .nt-c-per .nt-sub::before {
        content: "· ";
    }

    .nt-c-per::before,
    .nt-c-proc::before {
        content: "·";
        margin-right: 6px;
        color: var(--n-300);
    }

    .nt-fila--esquelet td:nth-child(n+3) {
        display: none;
    }

    .nt-fila--esquelet td {
        flex: 1 1 100%;
    }

    .nt-peu {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .nt-boto[data-accio="mes"] {
        height: 40px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
