/* ============================================================
   0. TIPOGRAFIES PERSONALITZADES
   Ruta relativa des de assets/css/ cap a fonts/
   ============================================================ */

@font-face {
    font-family: 'AriataDisplay';
    src: url('../../fonts/AriataDisplay-Black.eot');
    src: url('../../fonts/AriataDisplay-Black.eot?#iefix') format('embedded-opentype'),
         url('../../fonts/AriataDisplay-Black.woff2') format('woff2'),
         url('../../fonts/AriataDisplay-Black.woff') format('woff'),
         url('../../fonts/AriataDisplay-Black.ttf') format('truetype'),
         url('../../fonts/AriataDisplay-Black.otf') format('opentype'),
         url('../../fonts/AriataDisplay-Black.svg#AriataDisplay-Black') format('svg');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'AriataDisplay';
    src: url('../../fonts/AriataDisplay-Medium.eot');
    src: url('../../fonts/AriataDisplay-Medium.eot?#iefix') format('embedded-opentype'),
         url('../../fonts/AriataDisplay-Medium.woff2') format('woff2'),
         url('../../fonts/AriataDisplay-Medium.woff') format('woff'),
         url('../../fonts/AriataDisplay-Medium.ttf') format('truetype'),
         url('../../fonts/AriataDisplay-Medium.otf') format('opentype'),
         url('../../fonts/AriataDisplay-Medium.svg#AriataDisplay-Medium') format('svg');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'TradeGothic';
    src: url('../../fonts/TradeGothicLH-BoldExtended.eot');
    src: url('../../fonts/TradeGothicLH-BoldExtended.eot?#iefix') format('embedded-opentype'),
         url('../../fonts/TradeGothicLH-BoldExtended.woff2') format('woff2'),
         url('../../fonts/TradeGothicLH-BoldExtended.woff') format('woff'),
         url('../../fonts/TradeGothicLH-BoldExtended.ttf') format('truetype'),
         url('../../fonts/TradeGothicLH-BoldExtended.otf') format('opentype'),
         url('../../fonts/TradeGothicLH-BoldExtended.svg#TradeGothicLH-BoldExtended') format('svg');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'TradeGothic';
    src: url('../../fonts/TradeGothicLH-Extended.eot');
    src: url('../../fonts/TradeGothicLH-Extended.eot?#iefix') format('embedded-opentype'),
         url('../../fonts/TradeGothicLH-Extended.woff2') format('woff2'),
         url('../../fonts/TradeGothicLH-Extended.woff') format('woff'),
         url('../../fonts/TradeGothicLH-Extended.ttf') format('truetype'),
         url('../../fonts/TradeGothicLH-Extended.otf') format('opentype'),
         url('../../fonts/TradeGothicLH-Extended.svg#TradeGothicLH-Extended') format('svg');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* 1. CONFIGURACIÓ GENERAL */
:root {
    --color-principal: #F8BD01;
    --color-secundari: #6c757d;
    --alcada-nav: 44px;
    --fons-clar: #ede8de;
    --radi-lg: 22px;
    --ombra-suau: 0 6px 20px rgba(0,0,0,0.06);
    --ombra-targeta: 0 10px 30px rgba(0,0,0,0.08);
    --color-apagat: #8e8e93;
    --color-fosc: #212529;
    --color-vora: #ececec;
    --color-vora-clara: #f2f2f7;
}

body {
    /* El padding-bottom ha de ser gran perquè la barra no tapi el contingut */
    padding-bottom: calc(var(--alcada-nav) + env(safe-area-inset-bottom) + 20px);

    /* Base crema càlida — el background el posa la classe de pàgina */
    background-color: #f5f0e8;

    font-family: 'TradeGothic', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Titulars — Ariata Display Black */
h1, h2, h3, h4, h5, h6,
.page-title,
.page-title-bold,
.page-title-form,
.task-page-title {
    font-family: 'AriataDisplay', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 900;
}

/* Subtítols i labels — Ariata Display Medium */
.label-category-xs,
.modal-title-custom {
    font-family: 'AriataDisplay', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 500;
}

/* Botons, badges, selects — Trade Gothic Bold */
.btn,
.badge,
.badge-status-select,
.badge-prio-select,
.btn-filter-view,
.btn-view-toggle,
.filter-select-pill,
.fw-bold,
.fw-semibold {
    font-family: 'TradeGothic', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 700;
}

.btn {
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

/* Inputs, textareas, selects — Trade Gothic Regular */
input, textarea, select,
.form-control,
.form-select,
.input-clean,
.input-clean-lg,
.text-muted,
.small, small {
    font-family: 'TradeGothic', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 400;
}

/* Navbar footer + etiquetes nav — Trade Gothic Bold */
.btn-action-title,
.btn-action-sub {
    font-family: 'TradeGothic', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 700;
}

/* Widgets — Trade Gothic (valor i label) */
.widget-value,
.widget-value-sm,
.widget-label,
.widget-title {
    font-family: 'TradeGothic', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

a,
.btn-link {text-decoration: none;}

/* 2. BARRA DE NAVEGACIÓ INFERIOR (ESTIL IPHONE) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 78px;
    background: rgba(245, 240, 232, 0.88);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(255,255,255,0.6);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.07);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 2000;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    position: relative;
    text-align: center;
    color: var(--color-apagat);
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    font-family: 'TradeGothic', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: color 0.2s;
    letter-spacing: 0.01em;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.nav-item i {
    font-size: 24px;
    margin-bottom: 3px;
    transition: all .25s ease;
}



/* animació icona activa */
.nav-item.active i { transform: translateY(-2px) scale(1.1); color: var(--color-principal); }

/* icona ui compatible amb Tabler / Phosphor / Remix */
.icon-ui {
    font-size: 22px;
    color: #666;
    transition: all .2s ease;
}
.nav-item.active .icon-ui { color: var(--color-principal); transform: scale(1.1); }

/* hover tàctil */
.nav-item:active { transform: scale(0.95); }

/* 3. EL BOTÓ CENTRAL "MÀGIC" */
.btn-plus-container {
    position: relative;
    top: -22px;
    text-decoration: none;
}

.btn-plus {
    background: linear-gradient(145deg, #1a1a1a 0%, #333 100%) !important;
    color: white !important;
    width: 62px;
    height: 62px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid white;
    box-shadow:
        0 8px 24px rgba(0,0,0,0.35),
        0 2px 6px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(255,255,255,0.08);
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.18s ease;
}

.btn-plus i {
    color: white;
    font-size: 26px;
    font-weight: 300;
    line-height: 1;
}

.btn-plus:active {
    transform: scale(0.91);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* 4. TARGETES I ELEMENTS VISUALS */
/* Estil base compartit entre cards principals */
.card-custom,
.card-main-form,
.card-encarrec-grid,
.card-table {
    background: #ffffff;
    border: 1px solid var(--color-vora) !important;
    border-radius: 18px;
    box-shadow: var(--ombra-targeta);
    transition: transform .15s ease, box-shadow .15s ease;
    text-decoration: none !important;
}

.card-custom { border-radius: 24px; margin-bottom: 15px; }

.card-main-form { border-radius: 25px; padding: 1.5rem; }

.card-profile-main { border-radius: 24px !important; box-shadow: var(--ombra-targeta) !important; }

.card-tool-box {
    border-radius: 15px;
    background: var(--fons-clar);
    border: 1px solid #eee !important;
}

.card-config-panel {
    border: none;
    border-radius: var(--radi-lg) !important;
    box-shadow: var(--ombra-targeta) !important;
}

/* Hover effect per cards clicables */
.card-custom:hover,
.card-encarrec-grid:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(0,0,0,0.12) !important; }

/* Icona cercle genèrica */
.icon-circle-blue {
    width: 60px;
    height: 60px;
    background: rgba(248,189,1,0.12);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    color: var(--color-principal);
}

/* Icona moderna (quadrada) */
.icon-modern {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(248,189,1,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--color-principal);
}

/* 5. ESTILS DEL MODAL (ACCIONS RÀPIDES) */
.custom-modal {
    border: none;
    border-radius: 28px !important;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    backdrop-filter: blur(10px);
}

.btn-action {
    padding: 14px 16px;
    border-radius: 16px;
    border: none;
    font-weight: 600;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--fons-clar);
}
.btn-action:hover { filter: brightness(0.96); transform: scale(0.99); }
.btn-action:active { transform: scale(0.96); filter: brightness(0.92); }

.btn-action-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.btn-action-project .btn-action-icon  { background: #dbeafe; color: #2563eb; }
.btn-action-hours   .btn-action-icon  { background: #fef3c7; color: #d97706; }
.btn-action-expense .btn-action-icon  { background: #dcfce7; color: #16a34a; }

.btn-action-text { flex-grow: 1; }
.btn-action-title { font-size: 0.95rem; font-weight: 700; color: var(--color-fosc); line-height: 1.2; }
.btn-action-sub   { font-size: 0.75rem; color: var(--color-apagat); font-weight: 400; }

.btn-action-arrow { color: var(--color-apagat); font-size: 0.75rem; flex-shrink: 0; }


/* 6. FORMULARIS I INPUTS */
.form-label-caps {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--color-secundari);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}


/* Inputs base */
.input-clean {
    border: 1px solid var(--color-vora) !important;
    background: #ffffff !important;
    border-radius: 12px !important;
    padding: 12px 15px !important;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
    transition: all 0.2s;
}

.input-clean-lg {
    border: 1.5px solid #d0d0d0 !important;
    background: #ffffff !important;
    border-radius: 50px !important;
    padding: 1rem 1.5rem !important;
    font-size: 1rem !important;
    box-shadow: none;
}
textarea.input-clean-lg {
    border-radius: 24px !important;
}

.input-despesa,
.input-hores {
    background: #ffffff !important;
    border: 1px solid var(--color-vora) !important;
    border-radius: 12px !important;
}

.input-group-clean-container {
    background-color: var(--fons-clar);
    border-radius: 50px;
    padding: 0 1rem;
}

.input-clean:focus,
.input-clean-lg:focus {
    background-color: #fff !important;
    border-color: var(--color-principal) !important;
    box-shadow: 0 0 0 4px rgba(248,189,1,0.15) !important;
    outline: none;
}

.input-color-custom { height: 50px !important; padding: 5px !important; }

.input-color-picker {
    height: 45px;
    width: 100%;
    border-radius: 50px !important;
    border: 1px solid #eee !important;
    background-color: #f9f9f9 !important;
}

/* Botó mostrar/ocultar contrasenya - dues classes unificades */
.btn-show-password,
.btn-show-password-input {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    color: var(--color-apagat);
    z-index: 10;
    background: transparent !important;
}

.btn-show-password-input:focus { box-shadow: none !important; }

.d-none-autofill { display: none; }

/* 7. BOTONS ESPECÍFICS */
/* Botons pill - base compartit */
.btn-pill,
.btn-pill-lg {
    border-radius: 50px !important;
    font-weight: 700;
    letter-spacing: .02em;
}

.btn-pill-lg { padding: 1rem; }

/* Botons d'acció principals (submit) */
.btn-pill,
.btn-pill-lg,
.btn-submit-project,
.btn-submit-hores,
.btn-submit-despesa {
    background: var(--color-principal);
    color: white;
    border: none;
    box-shadow: 0 6px 16px rgba(248,189,1,0.35);
}

.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--color-principal);
    --bs-btn-border-color: var(--color-principal);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--color-secundari);
    --bs-btn-hover-border-color: var(--color-secundari);
    --bs-btn-focus-shadow-rgb: 49, 132, 253;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--color-secundari);
    --bs-btn-active-border-color: var(--color-secundari);
    --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: var(--color-principal);
    --bs-btn-disabled-border-color: var(--color-principal);
}

.btn-pill:hover,
.btn-pill-lg:hover { background: var(--color-secundari); color: white; filter: none; }

/* Botó submit de formularis (despesa i hores compartits) */
.btn-submit-despesa,
.btn-submit-hores {
    width: 100%;
    padding: 1rem !important;
    font-weight: 700 !important;
    border-radius: 50px !important;
}

/* Botó enrere circular */
.btn-back,
.btn-back-task {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    border-radius: 50%;
    border: none;
    color: var(--color-fosc);
    text-decoration: none;
    margin-right: 1rem;
}


/* Botons circulars petits */
.btn-edit-circle,
.btn-add-task-round {
    background-color: var(--fons-clar);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
}


.btn-save-hours,
.btn-save-despesa-circle {
    border-radius: 50% !important;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-save-hours { height: 42px; }
.btn-save-despesa-circle {
    width: 45px;
    height: 45px;
    margin: 0 auto;
    padding: 0;
    flex: 0 0 auto;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
}


.btn-cancel-modal {
    margin-top: 1rem;
    color: var(--color-secundari);
    text-decoration: none;
}

.btn-cancel-modal:hover { color: #495057; }


/* 8. ALERTES CUSTOM */
.alert-pill {
    border-radius: 50px;
    border: none;
    font-size: 0.85rem;
    padding: 12px 25px;
}

.alert-custom-profile {
    border-radius: 15px !important;
    border: none !important;
    padding: 1rem;
}

.alert-login-error {
    font-size: 0.875rem;
    padding: 0.5rem;
    text-align: center;
    border-radius: 12px;
}

.alert-msg-custom {
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
    margin-bottom: 1.5rem;
    padding: 1rem 0;
    border: 0;
}

/* 9. CAPÇALERES DE PÀGINA */
.page-header {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
}

.task-header-container,
.header-usuaris-flex {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.header-usuaris-flex { justify-content: space-between; }

/* Títols de pàgina — classe única unificada */
.page-title {
    margin-bottom: 0;
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--color-fosc);
    letter-spacing: -0.04em;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    line-height: 1.1;
}

/* Aliases legacy — redirigits a page-title per retrocompatibilitat */
.page-title-bold,
.page-title-form,
.task-page-title,
.title-usuaris {
    margin-bottom: 0;
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--color-fosc);
    letter-spacing: -0.04em;
    line-height: 1.1;
}

.task-project-subtitle,
.subtitle-usuaris { color: var(--color-secundari); }
.subtitle-usuaris { font-size: 0.875rem; }

/* 10. TAULES DE LLISTATS */
.card-table { border-radius: 20px; overflow: hidden; }

.table-custom { border-collapse: separate; border-spacing: 0 8px; }

.table-custom thead { background-color: var(--fons-clar); }

/* Capçalera de taula - estil unificat */
.table-custom th,
.form-label-caps,
.widget-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-apagat);
    letter-spacing: .08em;
}

.table-custom th { border-bottom: 1px solid var(--color-vora-clara); }

.table-custom td { padding: 15px 0; border-bottom: none; }

.table-custom tbody tr {
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    transition: all .15s ease;
}

.table-custom tbody tr:hover { transform: scale(1.01); }

.table-hover tbody tr:hover { background-color: #fafafa; }

.info-box-light {
    background-color: var(--color-vora-clara);
    border: 1px solid #e5e5ea;
    border-radius: 15px;
    padding: 15px;
}

/* 11. AVATARS I ICONES CIRCULARS */
.avatar-client,
.avatar-client-container {
    width: 48px;
    height: 48px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Ariata', 'TradeGothic', system-ui, sans-serif;
    font-weight: 900;
    letter-spacing: -0.04em;
    font-size: 1.2rem;
    color: #ffffff;
    flex-shrink: 0;
    border: none;
    box-shadow: none;
    text-shadow: none;
}

.avatar-client {
    width: 48px;
    height: 48px;
    border-radius: 13px;
    flex-shrink: 0;
}

.avatar-client-lg {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    font-size: 1.7rem;
}

.avatar-profile-circle {
    width: 80px;
    height: 80px;
    background: rgba(248,189,1,0.1);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.avatar-text {
    font-size: calc(80px * 0.45);
    font-weight: bold;
    color: var(--color-principal);
}

.avatar-profile-sm {
    width: 38px;
    height: 38px;
    background-color: #e7f1ff;
    color: var(--color-principal);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.95rem;
    font-weight: 700;
    border: 1px solid rgba(248,189,1,0.1);
}

.icon-empty-list { font-size: 2rem; opacity: 0.3; }
.icon-empty-list-large { font-size: 3rem; }
.empty-state-icon { font-size: 4rem; }

/* 12. LLISTES DE TARGETES */

.badge-client-light {
    background-color: var(--fons-clar);
    color: var(--color-secundari);
    border: 1px solid #dee2e6;
    border-radius: 50px;
    padding: 0.5rem 1rem;
}

/* Selects pill i inline */
.select-pill-minimal {
    width: auto;
    font-size: 0.75rem;
    cursor: pointer;
    border: none !important;
    background-color: var(--fons-clar) !important;
    border-radius: 50px !important;
}

.select-estat-dinamic {
    background-color: color-mix(in srgb, var(--estat-color), transparent 80%);
    color: var(--estat-color);
    cursor: pointer;
    outline: none;
}


.separator-subtle { opacity: .15; }

/* Labels de mida petita */
.label-xs-caps,
.label-category-xs {
    font-size: 0.6rem;
    color: var(--color-secundari);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hores-data-font,
.date-text-xs { font-size: 0.75rem; }
.hores-desc-font { font-size: 0.7rem; }


.profile-data-row { padding: 8px 0; border-bottom: 1px solid var(--color-vora-clara); }
.profile-data-muted { color: var(--color-apagat); }

.lowercase-text { text-transform: none !important; }

/* 13. ESTILS D'IMPRESSIÓ I INFORMES */

.body-print { background-color: white !important; padding-bottom: 0 !important; }

.invoice-box {
    padding: 40px;
    border: 1px solid var(--color-vora-clara);
    border-radius: 20px;
    max-width: 900px;
    margin: 20px auto;
    background: white;
}

.invoice-logo {
    color: #1c1c1e;
    font-size: 22px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.invoice-total-row { background-color: var(--fons-clar); border-radius: 12px; }

.invoice-footer {
    margin-top: 60px;
    padding-top: 20px;
    border-top: 1px solid var(--color-vora-clara);
    text-align: center;
    color: var(--color-apagat);
    font-size: 0.75rem;
}

.col-data-informe { width: 15%; }

/* --- 14. ESTILS ESPECÍFICS INDEX.PHP (LLISTAT) --- */

.card-filter-bar {
    border: none !important;
    border-radius: 20px !important;
}

/* ---- BARRA DE FILTRES PROJECTES (projectes.php) ---- */

.filter-view-bar {
    display: flex;
    gap: 8px;
    padding: 6px;
    background: rgba(0,0,0,0.04);
    border-radius: 18px;
}

.btn-filter-view {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    border-radius: 13px;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    color: #666;
    background: transparent;
    border: none;
    transition: all 0.22s ease;
    white-space: nowrap;
}

.btn-filter-view i { font-size: 1rem; }

.btn-filter-view:hover:not(.active) {
    background: rgba(255,255,255,0.7);
    color: var(--color-fosc);
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

/* Actiu: Actuals — degradat càlid taronja → or */
.btn-filter-actuals.active {
    background: linear-gradient(135deg, #ff6a00 0%, #ffb300 100%);
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(255,106,0,0.5),
                inset 0 1px 0 rgba(255,255,255,0.3);
}

/* Actiu: Fets — degradat verd */
.btn-filter-fets.active {
    background: linear-gradient(135deg, #22c55e 0%, #86efac 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(34,197,94,0.35);
}

/* Actiu: Facturats — degradat violeta (#930fff) → rosa */
.btn-filter-facturats.active {
    background: linear-gradient(135deg, #930fff 0%, #c86fff 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(147,15,255,0.35);
}

/* Actiu: Arxivats — degradat gris fosc → gris clar */
.btn-filter-arxivats.active {
    background: linear-gradient(135deg, #555 0%, #878787 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(100,100,100,0.3);
}

/* Actiu: Tots — degradat fosc neutral */
.btn-filter-tots.active {
    background: linear-gradient(135deg, #2d2d2d 0%, #555 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}

.filter-select-pill {
    border: none !important;
    background-color: var(--fons-clar) !important;
    border-radius: 50px !important;
    padding: 0 1rem !important;
    font-size: 0.875rem !important;
}

.view-switcher-pill {
    display: inline-flex;
    background-color: var(--fons-clar);
    border-radius: 50px;
    overflow: hidden;
    padding: 4px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.03);
}

.btn-view-toggle {
    padding: 6px 16px;
    border-radius: 50px;
    color: var(--color-apagat);
    text-decoration: none;
    border: none;
    background: transparent;
    transition: all 0.2s ease;
}

.btn-view-toggle.active {
    background-color: var(--color-principal) !important;
    color: white !important;
    box-shadow: 0 2px 6px rgba(248,189,1,0.3);
}

.btn-cerca-toggle {
    padding: 6px 14px;
    border-radius: 50px;
    border: 1.5px solid var(--color-apagat);
    background: transparent;
    color: var(--color-apagat);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.btn-cerca-toggle:hover {
    border-color: var(--color-principal);
    color: var(--color-principal);
}

.btn-cerca-toggle.active {
    background-color: var(--color-principal);
    border-color: var(--color-principal);
    color: white;
    box-shadow: 0 2px 6px rgba(248,189,1,0.3);
}

.card-encarrec-grid {
    border-radius: 24px !important;
    border: 2px solid transparent !important;
    transition: all 0.2s ease;
}

.card-encarrec-grid:active { transform: scale(0.98); }

.card-encarrec-grid:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(0,0,0,0.15) !important; }

.title-max-width { max-width: 270px; }

/* Badges de status i prioritat (base compartit) */
.badge-status-select, .badge-prio-select {
    padding: 8px 12px;
    border-radius: 40px;
    text-transform: uppercase;
    border: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
    color: white;
    appearance: none;
    cursor: pointer;
    text-align: center;
    text-align-last: center;
    letter-spacing: 1px;
}

.badge-status-select { font-size: 0.65rem; }
.badge-prio-select { font-size: 0.6rem; }

@media (max-width: 767.98px) {
    .badge-status-select,
    .badge-prio-select {
        letter-spacing: 0;
        text-align: center;
        text-align-last: center;
    }
}


.badge-rol-usuari {
    border-radius: 50px;
    text-transform: uppercase;
    font-size: 0.65rem !important;
}
.badge-rol-admin { background-color: var(--color-fosc); }
.badge-rol-standard {
    background-color: var(--fons-clar);
    color: var(--color-fosc);
    border: 1px solid #dee2e6;
}

.badge-dynamic-color { background-color: var(--bg-color-dinamic); color: #fff; }
.badge-hours-display { padding: 0.35em 0.65em; font-weight: 700; }

/* Progress bars */
.progress-percent-font { font-size: 0.85rem; }
.percentage-text { font-size: 0.7rem; }
.widget-progress-height { height: 4px; }


/* Selects de taula */
.prio-select-table,
.prio-select-grid {
    border: none;
    color: white;
    border-radius: 112px;
}
.prio-select-table { font-size: 0.75rem; padding: 4px 8px; }
.prio-select-grid { font-size: 0.7rem; padding: 4px 10px; }

.category-badge-table { font-size: 0.75rem; }
.category-badge-grid { font-size: 0.65rem; }
.grid-progress-text { font-size: 0.7rem; font-weight: bold; }
.price-badge-font { font-size: 0.75rem; }

.widget-progress-70 { width: 70%; }
.widget-progress-100 { width: 100%; }
.widget-progress-60 { width: 60%; }
.widget-progress-40 { width: 40%; }

/* ---- WIDGET CARDS AMB DEGRADAT (index.php dashboard) ---- */

.widget-card {
    border-radius: 20px !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18) !important;
    overflow: hidden;
    position: relative;
}

/* Degradat blau/violeta — Hores (blau→magenta→ambre) */
.widget-card-primary {
    background-color: #3060f0 !important;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.20'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 110% 100% at 0% 0%, rgba(50,110,255,1) 0%, transparent 70%),
        radial-gradient(ellipse 90% 90% at 62% 58%, rgba(255,40,165,0.95) 0%, transparent 70%),
        radial-gradient(ellipse 100% 90% at 100% 100%, rgba(255,155,20,0.92) 0%, transparent 70%) !important;
    background-size: 200px 200px, 100% 100%, 100% 100%, 100% 100% !important;
}

/* Degradat verd — Projectes (llima→teal→coral) */
.widget-card-success {
    background-color: #20b870 !important;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.18'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 100% 90% at 0% 0%, rgba(195,225,20,0.96) 0%, transparent 70%),
        radial-gradient(ellipse 95% 85% at 100% 10%, rgba(0,195,170,0.93) 0%, transparent 70%),
        radial-gradient(ellipse 100% 85% at 30% 100%, rgba(240,115,55,0.90) 0%, transparent 70%) !important;
    background-size: 200px 200px, 100% 100%, 100% 100%, 100% 100% !important;
}

/* Degradat vermell/taronja — Valor (or→vermell→carmesí) */
.widget-card-danger {
    background-color: #e84000 !important;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.20'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 100% 90% at 0% 0%, rgba(255,185,0,0.96) 0%, transparent 70%),
        radial-gradient(ellipse 95% 85% at 100% 0%, rgba(255,45,20,0.94) 0%, transparent 70%),
        radial-gradient(ellipse 85% 90% at 50% 100%, rgba(200,0,55,0.92) 0%, transparent 70%) !important;
    background-size: 200px 200px, 100% 100%, 100% 100%, 100% 100% !important;
}

/* Degradat violeta — Pendent de cobrar (coral→magenta→índigo) */
.widget-card-purple {
    background-color: #cc1080 !important;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.18'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 100% 90% at 0% 0%, rgba(250,105,70,0.95) 0%, transparent 70%),
        radial-gradient(ellipse 90% 80% at 78% 32%, rgba(235,0,135,0.93) 0%, transparent 70%),
        radial-gradient(ellipse 95% 90% at 18% 100%, rgba(105,70,240,0.92) 0%, transparent 70%) !important;
    background-size: 200px 200px, 100% 100%, 100% 100%, 100% 100% !important;
}

/* Etiqueta superior en negatiu (text blanc semi-transparent) */
.widget-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.75) !important;
}

/* Valor principal en negatiu (text blanc pur) */
.widget-card .widget-value,
.widget-card .widget-value-sm {
    color: #ffffff !important;
    font-weight: 800;
    text-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.widget-value-sm { font-size: 1.3rem; }

/* Barra de progrés en negatiu: track blanc semi-transparent + fill blanc */
.widget-card .progress {
    background-color: rgba(255, 255, 255, 0.25) !important;
    border-radius: 50px;
}

.widget-card .widget-progress-bar {
    background-color: #ffffff !important;
    border-radius: 50px;
    box-shadow: 0 0 6px rgba(255,255,255,0.5);
}

/* Degradat verd/teal — Tipus de projectes */
.widget-card-teal {
    background-color: #0a8aa8 !important;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.18'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 100% 90% at 0% 0%, rgba(20,200,220,0.96) 0%, transparent 70%),
        radial-gradient(ellipse 95% 85% at 100% 10%, rgba(80,230,180,0.92) 0%, transparent 70%),
        radial-gradient(ellipse 95% 90% at 40% 100%, rgba(60,120,220,0.90) 0%, transparent 70%) !important;
    background-size: 200px 200px, 100% 100%, 100% 100%, 100% 100% !important;
}

/* Project card — títol amb TradeGothic (sans) per millor llegibilitat */
.project-card .title,
.card-projecte h3,
.card-projecte .project-title,
.card-projecte .card-title {
    font-family: 'TradeGothic', system-ui, sans-serif;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.005em;
    color: #212529;
}

/* Chart de categories al widget — barres verticals */
.widget-cats-chart {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    gap: 5px;
    min-height: 80px;
    flex: 1;
}
.widget-cat-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    gap: 4px;
}
.widget-cat-bar-track-v {
    width: 100%;
    flex: 1;
    background: rgba(255,255,255,0.20);
    border-radius: 6px 6px 3px 3px;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
}
.widget-cat-bar-fill-v {
    width: 100%;
    background: #fff;
    border-radius: 6px 6px 3px 3px;
    box-shadow: 0 0 6px rgba(255,255,255,0.35);
    min-height: 3px;
    transition: height 0.4s ease;
}
.widget-cat-name {
    font-size: 0.52rem;
    color: rgba(255,255,255,0.85);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    flex-shrink: 0;
}


/* --- 15. NOUS ESTILS LOGIN I FORMULARIS --- */
.body-login { min-height: 100vh; }

/* --- 17. ESTILS ESPECÍFICS TASQUES (tasques_projecte.php) --- */

.card-tasks-input,
.card-hores-form,
.card-hores-list,
.list-group-tasks { border-radius: 20px !important; }

.card-hores-form.is-editing { border: 2px solid var(--color-principal) !important; }

.card-hores-list,
.list-group-tasks { overflow: hidden; }

.task-grab-handle { cursor: grab; font-size: 1.2rem; }
.task-check-icon { font-size: 1.3rem; }

.task-toggle-link {
    text-decoration: none;
    display: flex;
    align-items: center;
    flex-grow: 1;
    color: var(--color-fosc);
}

/* --- 20. FRANJA SUPERIOR I AVATAR D'USUARI --- */

.top-stripe {
    height: 4px;
    background-color: var(--color-principal);
    position: sticky;
    top: 0;
    z-index: 1030;
    width: 100%;
}

/* --- 21. ESTILS ESPECÍFICS FOOTER NAV I MODAL AFEGIR --- */

/* Tots els modals per sobre de la bottom-nav (z-index: 2000) i del backdrop */
.modal { z-index: 2100 !important; }
.modal-backdrop { z-index: 2050 !important; }

.modal-dialog-custom { padding: 0 1.5rem; }
.modal-body-padded { padding: 1.5rem; }
.modal-title-custom { margin-bottom: 1rem; font-weight: 800; font-size: 1rem; color: var(--color-apagat); text-transform: uppercase; letter-spacing: 0.05em; }


.progress-range-input { cursor: pointer; z-index: 5; }

/* --- 23 & 24. FORMULARIS DESPESA I HORES --- */

.card-despesa,
.card-hores-main { padding: 1.5rem !important; }

.card-hores-main { box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075) !important; }

.btn-submit-project { padding: 1rem 0; }


/* --- 27. DESPESES_PROJECTE.PHP --- */
.input-color-lg { height: 50px; }


/* --- 28. EINES I CONFIGURACIÓ (eines.php) --- */
.d-none-important { display: none !important; }
.d-block-important { display: block !important; }


/* --- 30 & 31. CLASSES GENERALS VISTES --- */

.container-main-view { margin-top: 1rem; padding: 8px 0 3rem; }

.label-indent { margin-left: 0.5rem; }
.form-group-spacing { margin-bottom: 1.5rem; }
.action-container-form { margin-top: 1.5rem; }

/* --- 32. NETEJA PERFIL.PHP --- */
.col-perfil-centrat { max-width: 500px; }
.profile-icon-data { color: var(--color-principal) !important; }

/* Etiquetes i valors de widgets */
.widget-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #888;
    margin-bottom: 6px;
}

.widget-value { font-size: 1.9rem; font-weight: 700; }

@media (min-width: 768px) and (max-width: 1024px) {
    .widget-value { font-size: 1.4rem; }
    .widget-value-sm { font-size: 1.1rem; }
}

@media (max-width: 767.98px) {
    .widget-value { font-size: 1.5rem; }
    .widget-value-sm { font-size: 1.3rem; }
}

/* --- MEDIA QUERIES PRINT --- */

@media print {
    .no-print { display: none !important; }
    body { padding: 0 !important; margin: 0 !important; }
    .invoice-box {
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
    }
.invoice-total-row { background-color: var(--fons-clar) !important; -webkit-print-color-adjust: exact; }
}

/* ============================================================
   FONS PER PÀGINA — sistema de blobs + noise per classe body
   Base compartida: crema càlida #f5f0e8, noise 0.28
   ============================================================ */

/* ============================================================
   FONS PER PÀGINA — estil grainy gradient mesh (inspirat en mostres)
   ::before fixat per compatibilitat iOS scroll
   ============================================================ */

body[class*="page-"] {
    position: relative;
}

body[class*="page-"]::before {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* --- INDEX — grocs càlids i corall (→ IMG_7289 + IMG_7282) --- */
body.page-index { background-color: #fbf2e4 !important; }
body.page-index::before {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.68' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.44'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 80% 65% at 78% 12%, rgba(255,135,90,0.72) 0%, transparent 62%),
        radial-gradient(ellipse 70% 60% at 15% 82%, rgba(255,205,40,0.68) 0%, transparent 58%),
        radial-gradient(ellipse 55% 50% at 50% 48%, rgba(255,175,110,0.32) 0%, transparent 65%),
        linear-gradient(160deg, #fdf8ef 0%, #faf2e0 100%);
    background-size: 200px 200px, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
}

/* --- DETALL — teal esquerra, corall dreta (→ IMG_7287) --- */
body.page-detall { background-color: #eff0ea !important; }
body.page-detall .card-custom,
body.page-detall .card-table { border: none !important; }
body.page-detall::before {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.68' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.44'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 72% 62% at 12% 18%, rgba(90,205,185,0.72) 0%, transparent 62%),
        radial-gradient(ellipse 68% 58% at 85% 78%, rgba(220,125,85,0.65) 0%, transparent 60%),
        radial-gradient(ellipse 45% 40% at 50% 50%, rgba(155,215,200,0.28) 0%, transparent 62%),
        linear-gradient(145deg, #edf7f4 0%, #f0ede6 100%);
    background-size: 200px 200px, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
}

/* --- EINES — verd diagonal sobre crema (→ IMG_7281) --- */
body.page-eines { background-color: #edf0e0 !important; }
body.page-eines::before {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.68' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.44'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 65% 55% at 65% 38%, rgba(70,195,115,0.72) 0%, transparent 58%),
        radial-gradient(ellipse 55% 48% at 22% 72%, rgba(155,220,80,0.55) 0%, transparent 58%),
        radial-gradient(ellipse 40% 35% at 85% 80%, rgba(100,210,140,0.35) 0%, transparent 58%),
        linear-gradient(150deg, #f4f5e4 0%, #eceee0 100%);
    background-size: 200px 200px, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
}

/* --- LOGIN — magenta/rosa a taronja (→ IMG_7290 + IMG_7283) --- */
body.page-login { background-color: #f9e8ec !important; }
body.page-login::before {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.68' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.44'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 78% 58% at 48% 8%, rgba(255,75,140,0.72) 0%, transparent 62%),
        radial-gradient(ellipse 65% 55% at 62% 80%, rgba(255,145,55,0.65) 0%, transparent 58%),
        radial-gradient(ellipse 45% 40% at 15% 55%, rgba(255,120,100,0.32) 0%, transparent 58%),
        linear-gradient(170deg, #fdf0f2 0%, #f8e8e5 100%);
    background-size: 200px 200px, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
}

/* --- NOU ENCÀRREC — crema/lavanda/blau (→ IMG_7288) --- */
body.page-nou-encarrec { background-color: #ece8f2 !important; }
body.page-nou-encarrec::before {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.68' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.44'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 62% 52% at 18% 22%, rgba(240,225,195,0.78) 0%, transparent 58%),
        radial-gradient(ellipse 65% 55% at 62% 54%, rgba(200,180,235,0.68) 0%, transparent 62%),
        radial-gradient(ellipse 58% 48% at 82% 85%, rgba(155,170,225,0.62) 0%, transparent 58%),
        linear-gradient(155deg, #f6f2fc 0%, #eae6f5 100%);
    background-size: 200px 200px, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
}

/* --- PROJECTES — teal/cian i taronja càlid (→ IMG_7286) --- */
body.page-projectes { background-color: #e4f0ec !important; }
body.page-projectes::before {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.68' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.44'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 72% 58% at 14% 20%, rgba(95,200,182,0.72) 0%, transparent 62%),
        radial-gradient(ellipse 65% 55% at 82% 75%, rgba(215,145,95,0.65) 0%, transparent 58%),
        radial-gradient(ellipse 42% 38% at 55% 50%, rgba(130,210,195,0.30) 0%, transparent 60%),
        linear-gradient(148deg, #eaf6f2 0%, #e2eeea 100%);
    background-size: 200px 200px, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
}

/* --- CLIENTS — menta suau i crema càlida (→ IMG_7286 lleuger) --- */
body.page-clients { background-color: #e2f2ee !important; }
body.page-clients::before {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.68' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.44'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 75% 62% at 78% 18%, rgba(75,198,175,0.68) 0%, transparent 62%),
        radial-gradient(ellipse 62% 55% at 18% 78%, rgba(155,228,208,0.62) 0%, transparent 58%),
        radial-gradient(ellipse 45% 40% at 50% 45%, rgba(100,210,185,0.30) 0%, transparent 60%),
        linear-gradient(152deg, #eaf7f4 0%, #e0f0ea 100%);
    background-size: 200px 200px, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
}

/* --- USUARIS — lavanda i blau-gris (→ IMG_7288 versió freda) --- */
body.page-usuaris { background-color: #e8e6f4 !important; }
body.page-usuaris::before {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.68' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.44'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 68% 56% at 20% 25%, rgba(218,210,248,0.75) 0%, transparent 62%),
        radial-gradient(ellipse 62% 52% at 78% 72%, rgba(165,185,235,0.68) 0%, transparent 58%),
        radial-gradient(ellipse 45% 40% at 52% 52%, rgba(195,188,240,0.30) 0%, transparent 62%),
        linear-gradient(158deg, #f2f0fe 0%, #e6e4f5 100%);
    background-size: 200px 200px, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
}

/* --- SECUNDÀRIES — càlid neutre, taronja suau (→ IMG_7285 lleuger) --- */
body.page-secondary { background-color: #f0e8dc !important; }
body.page-secondary::before {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.68' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.44'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 70% 58% at 72% 28%, rgba(220,165,125,0.58) 0%, transparent 62%),
        radial-gradient(ellipse 58% 50% at 22% 75%, rgba(200,180,158,0.52) 0%, transparent 58%),
        radial-gradient(ellipse 40% 35% at 48% 48%, rgba(230,195,165,0.28) 0%, transparent 60%),
        linear-gradient(155deg, #faf4ec 0%, #f2e8da 100%);
    background-size: 200px 200px, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
}

/* --- ERROR — groc daurat i corall càlid --- */
body.page-error { background-color: #faf2dc !important; }
body.page-error::before {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.68' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.44'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 80% 65% at 15% 20%, rgba(248,189,1,0.55) 0%, transparent 62%),
        radial-gradient(ellipse 70% 60% at 82% 75%, rgba(255,140,80,0.52) 0%, transparent 60%),
        radial-gradient(ellipse 50% 45% at 50% 50%, rgba(255,210,80,0.22) 0%, transparent 65%),
        linear-gradient(150deg, #fdf8e8 0%, #faf0d0 100%);
    background-size: 200px 200px, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
}

body.page-error .error-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    text-align: center;
}

body.page-error .error-frase {
    font-family: 'AriataDisplay', serif;
    font-weight: 900;
    font-size: clamp(2.6rem, 10vw, 5.2rem);
    line-height: 1.05;
    color: #1a1a1a;
    margin-bottom: 2.5rem;
    max-width: 750px;
}

body.page-error .error-divider {
    width: 40px;
    height: 3px;
    background: #F8BD01;
    margin: 0 auto 1.5rem;
    border-radius: 2px;
}

body.page-error .error-titol {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #999;
    margin-bottom: 0.4rem;
}

body.page-error .error-missatge {
    color: #555;
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

body.page-error .btn-tornar {
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 0.6rem 1.8rem;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

body.page-error .btn-tornar:hover { background: #333; color: #fff; }

/* ============================================================
   BARRA DE PROGRÉS — degradat vermell→groc→verd→cyan universal
   ============================================================ */

/* Contenidor de la barra — necessita overflow visible per al clip */
/* Track: contenidor gris 100% */
.progress-rainbow-track {
    background: rgba(0,0,0,0.08);
    border-radius: 99px;
    height: 8px;
    width: 100%;
    position: relative;
}

/* Fill: sempre 100% d'amplada, degradat complet.
   clip-path talla per la dreta segons --pct passat per inline style.
   A 65%: clip-path talla el 35% de la dreta → veiem fins al verd. */
.progress-rainbow-fill {
    width: 100%;
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg,
        #e53935 0%,
        #fb8c00 25%,
        #fdd835 45%,
        #43a047 65%,
        #00acc1 100%
    );
    clip-path: inset(0 calc(100% - var(--pct, 0) * 1%) 0 0 round 99px);
    position: relative;
    overflow: hidden;
}

/* Shine animat */
.progress-rainbow-fill::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 55%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.38), transparent);
    animation: rainbow-shine 2.2s ease-in-out infinite;
}

@keyframes rainbow-shine {
    0%   { left: -55%; }
    100% { left: 160%; }
}

/* ============================================================
   DETALL.PHP — Components nous
   ============================================================ */

/* Barra de color del client integrada a la targeta */
.client-color-bar {
    height: 5px;
    border-radius: 12px 12px 0 0;
    width: 100%;
    display: block;
}

/* Caixes descripció / observacions */
.detall-info-box {
    background: rgba(255,255,255,0.55);
    border: 1px solid rgba(0,0,0,0.07);
    border-radius: 12px;
    padding: 11px 13px;
    font-size: 0.81rem;
    line-height: 1.45;
}

.calc-comparison-card {
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(255,255,255,0.52);
    padding: 14px 14px 12px;
}

.calc-comparison-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    font-size: 0.72rem;
    color: rgba(0,0,0,0.62);
}

.calc-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.calc-legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    display: inline-block;
}

.calc-comparison-item {
    display: grid;
    gap: 6px;
}

.calc-comparison-item-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
}

.calc-comparison-item-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(0,0,0,0.78);
    line-height: 1.1;
}

.calc-comparison-item-sub {
    font-size: 0.69rem;
    color: rgba(0,0,0,0.50);
    line-height: 1.1;
    text-align: right;
}

.calc-comparison-item-body {
    display: grid;
    grid-template-columns: 1fr 72px;
    gap: 8px;
    align-items: center;
}

.calc-comparison-track {
    height: 10px;
    border-radius: 999px;
    background: rgba(0,0,0,0.08);
    overflow: hidden;
    position: relative;
}

.calc-comparison-track--empty {
    background: rgba(0,0,0,0.04);
}

.calc-comparison-bar {
    height: 100%;
    border-radius: 999px;
    min-width: 4px;
}

.calc-comparison-bar--empty {
    width: 0;
    min-width: 0;
}

.calc-comparison-value {
    font-size: 0.73rem;
    font-weight: 700;
    text-align: right;
    color: rgba(0,0,0,0.72);
}

.calc-bar--resultat {
    background: linear-gradient(90deg, #0f172a 0%, #334155 100%);
}

.calc-bar--intern {
    background: linear-gradient(90deg, #f5b300 0%, #ffcc33 100%);
}

.calc-bar--referencies {
    background: linear-gradient(90deg, #11b5a4 0%, #39d8c6 100%);
}

.calc-bar--historic {
    background: linear-gradient(90deg, #7c3aed 0%, #a78bfa 100%);
}

.calc-bar--ia {
    background: linear-gradient(90deg, #ff7a59 0%, #ffb36b 100%);
}

.btn-calc-loading {
    position: relative;
    min-height: 52px;
    overflow: hidden;
}

.btn-calc-content,
.btn-calc-working {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity .18s ease, transform .18s ease;
}

.btn-calc-working {
    position: absolute;
    inset: 0;
    opacity: 0;
    transform: translateY(8px);
}

.is-loading .btn-calc-content {
    opacity: 0;
    transform: translateY(-8px);
}

.is-loading .btn-calc-working {
    opacity: 1;
    transform: translateY(0);
}

.calc-inline-spinner {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 2px solid rgba(255,255,255,0.38);
    border-top-color: #fff;
    animation: calc-spin .72s linear infinite;
}

.calc-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1085;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(247, 246, 242, 0.72);
    backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
}

.calc-loading-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.calc-loading-panel {
    width: min(420px, calc(100vw - 32px));
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 22px 24px;
    border-radius: 18px;
    background: rgba(255,255,255,0.94);
    box-shadow: 0 22px 70px rgba(15, 23, 42, 0.18);
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.calc-loading-orbit {
    width: 54px;
    height: 54px;
    position: relative;
    flex: 0 0 auto;
}

.calc-loading-orbit::before {
    content: "";
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    border: 2px solid rgba(15, 23, 42, 0.10);
    border-top-color: #0f172a;
    animation: calc-spin .92s linear infinite;
}

.calc-loading-orbit span {
    position: absolute;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #11b5a4;
    animation: calc-pulse 1.1s ease-in-out infinite;
}

.calc-loading-orbit span:nth-child(1) {
    top: 3px;
    left: 23px;
}

.calc-loading-orbit span:nth-child(2) {
    right: 4px;
    bottom: 13px;
    background: #7c3aed;
    animation-delay: .14s;
}

.calc-loading-orbit span:nth-child(3) {
    left: 7px;
    bottom: 11px;
    background: #ff7a59;
    animation-delay: .28s;
}

.calc-loading-title {
    font-size: 1rem;
    font-weight: 800;
    color: #101010;
}

.calc-loading-copy {
    margin-top: 2px;
    font-size: .82rem;
    line-height: 1.35;
    color: rgba(0,0,0,0.58);
}

@keyframes calc-spin {
    to { transform: rotate(360deg); }
}

@keyframes calc-pulse {
    0%, 100% { transform: scale(.72); opacity: .56; }
    50% { transform: scale(1); opacity: 1; }
}

@media (max-width: 991.98px) {
    .calc-comparison-item-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
    }
}

@media (max-width: 575.98px) {
    .calc-comparison-item-body {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .calc-comparison-value {
        text-align: left;
    }
}

/* Widgets baix (Total, Prioritat, Estat) */
.detall-widget {
    border-radius: 14px;
    padding: 11px 8px;
    color: white;
    text-align: center;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    position: relative;
    overflow: hidden;
}
.detall-widget::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.62'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 100% 90% at 0% 0%, rgba(255,255,255,0.28) 0%, transparent 65%),
        radial-gradient(ellipse 90% 100% at 100% 100%, rgba(0,0,0,0.30) 0%, transparent 65%);
    background-size: 120px 120px, 100% 100%, 100% 100%;
    mix-blend-mode: overlay;
    pointer-events: none;
    z-index: 0;
}
.detall-widget > * {
    position: relative;
    z-index: 1;
}
.detall-widget--total {
    background-color: #18c068;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.18'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 110% 100% at 0% 0%, rgba(195,230,10,0.96) 0%, transparent 70%),
        radial-gradient(ellipse 100% 90% at 100% 10%, rgba(0,200,170,0.93) 0%, transparent 70%),
        radial-gradient(ellipse 95% 95% at 50% 100%, rgba(0,180,90,0.90) 0%, transparent 70%);
    background-size: 120px 120px, 100% 100%, 100% 100%, 100% 100%;
}
.detall-widget-label {
    font-size: 0.60rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.78;
    font-family: 'TradeGothic', sans-serif;
}
.detall-widget-value {
    font-size: 1.0rem;
    font-weight: 900;
    font-family: 'AriataDisplay', sans-serif;
    letter-spacing: -0.02em;
    line-height: 1.1;
    text-align: center;
}
.detall-widget--total .detall-widget-value {
    font-family: 'TradeGothic', sans-serif;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.detall-widget-select {
    background: transparent;
    border: none;
    color: white;
    font-size: 0.82rem;
    font-weight: 700;
    font-family: 'TradeGothic', sans-serif;
    text-align: center;
    text-align-last: center;
    padding: 0;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
}
.detall-widget-select option {
    color: #222;
    background: white;
}

/* Mida lletra tasques */
.tasca-titol {
    font-size: 0.79rem;
    line-height: 1.3;
}

/* ============================================================
   PANELL EINES — popup flotant sobre el botó eines (baix dreta)
   ============================================================ */

.panell-eines {
    bottom: calc(78px + env(safe-area-inset-bottom) + 10px) !important;
    left: auto !important;
    right: 12px !important;
    width: 230px !important;
    height: auto !important;
    border-radius: 16px !important;
    border: none !important;
    box-shadow: 0 4px 28px rgba(0,0,0,0.18);
    background: #fff;
    z-index: 2001 !important;
}

/* Backdrop invisible però funcional (clic fora tanca el panel) */
.offcanvas-backdrop {
    z-index: 1999 !important;
}
.offcanvas-backdrop.show {
    opacity: 0 !important;
}
