:root {
    --fc-primary: #3056d3;
    --fc-soft: #eef3ff;
    --fc-text: #1f2937;
    --fc-text-strong: #111827;
    --fc-text-muted: #374151;
    --fc-surface-soft: #f8fafc;
}

body {
    background: linear-gradient(180deg, #f7f9fc 0%, #eef2f7 100%);
    min-height: 100vh;
    color: var(--fc-text);
}

.navbar-brand {
    letter-spacing: 0.02em;
}

.card {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 12px 30px rgba(47, 72, 112, 0.08);
}

.card-title {
    color: var(--fc-text-strong);
}

.metric-box {
    background: var(--fc-soft);
    border-radius: 0.9rem;
    padding: 1rem;
    color: var(--fc-text-strong);
}

.table thead th {
    white-space: nowrap;
}

.table-tools {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(48, 86, 211, 0.16);
    border-radius: 0.9rem;
    padding: 0.9rem;
}

.table-tools label.text-muted,
.table-tools .text-muted {
    color: var(--fc-text-muted) !important;
}

.table-sortable thead th[data-sortable-column] {
    cursor: pointer;
    position: relative;
    user-select: none;
    padding-right: 1.75rem;
}

.table-sortable thead th[data-sortable-column]::after {
    content: '↕';
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: #64748b;
}

.table-sortable thead th[data-sort-direction="asc"]::after {
    content: '↑';
    color: var(--fc-primary);
}

.table-sortable thead th[data-sort-direction="desc"]::after {
    content: '↓';
    color: var(--fc-primary);
}

.table-sortable thead th[data-sortable-column]:hover {
    background: rgba(48, 86, 211, 0.06);
}

.table-empty-state {
    border-style: dashed;
    background: var(--fc-surface-soft);
    color: var(--fc-text);
}

.text-muted {
    color: var(--fc-text-muted) !important;
}

small.text-muted,
.footer-note {
    color: var(--fc-text-muted) !important;
}

.alert-light {
    color: #111827;
}

.form-text {
    color: var(--fc-text) !important;
}

.form-control::placeholder,
.form-select::placeholder,
textarea.form-control::placeholder {
    color: #6b7280;
    opacity: 1;
}

.badge-soft {
    background-color: var(--fc-soft);
    color: var(--fc-primary);
}

.badge-action-add {
    background-color: #dcfce7;
    color: #166534;
}

.badge-action-delete {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-action-calc {
    background-color: #dbeafe;
    color: #1d4ed8;
}

.badge-action-export {
    background-color: #ede9fe;
    color: #6d28d9;
}

.badge-action-login {
    background-color: #ccfbf1;
    color: #0f766e;
}

.badge-action-logout {
    background-color: #f3f4f6;
    color: #374151;
}

.badge-action-failure {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-action-account {
    background-color: #ffedd5;
    color: #9a3412;
}

.badge-action-poll {
    background-color: #fce7f3;
    color: #9d174d;
}

/* Journal d'audit : détails longs et regroupement par visite */
.audit-details {
    overflow-wrap: anywhere;
}

.visite-audit {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    background-color: #fff;
}

.visite-audit > summary,
.visite-isolee {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.visite-audit > summary {
    cursor: pointer;
}

.visite-isolee {
    background-color: #f9fafb;
}

.footer-note {
    font-size: 0.95rem;
}


/* Castellum : marque, tuiles du tableau de bord, administration */
.brand-logo {
    width: 2rem;
    height: 2rem;
    border-radius: 0.6rem;
    flex-shrink: 0;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.6rem;
    background: var(--fc-primary);
    color: #fff;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.1rem;
}

.navbar .nav-link.active {
    color: var(--fc-primary);
}

.tool-tile {
    color: var(--fc-text);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

a.tool-tile:hover,
a.tool-tile:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(47, 72, 112, 0.14);
}

.tool-tile-soon {
    background: rgba(255, 255, 255, 0.6);
    box-shadow: none;
    border: 1px dashed rgba(48, 86, 211, 0.25);
}

.tool-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.8rem;
    background: var(--fc-soft);
    color: var(--fc-primary);
    font-size: 1.3rem;
    font-weight: 600;
}

.tool-icon-admin {
    background: #fff4e5;
    color: #9a5b00;
}

.metric-box-warning {
    background: #fff4e5;
}

.admin-table td input[name="nom"] {
    min-width: 9rem;
}

.admin-table td input[type="email"] {
    min-width: 15rem;
}

.admin-table td select {
    min-width: 10rem;
}

.admin-table .input-dix {
    min-width: 6rem;
    max-width: 7rem;
}

/* Statuts de paiement et comptes bloqués */
.badge-paye {
    background: #e7f6ec;
    color: #1d6b3a;
}

.badge-a-payer {
    background: #fff4e5;
    color: #8a4b00;
}

.badge-bloque {
    background: #fde8e8;
    color: #9b1c1c;
}

/* Tableau d'administration des copropriétaires : actions compactes */
.admin-table .actions-cell {
    white-space: nowrap;
    width: 1%;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
}

.admin-table .btn-enregistrer:disabled {
    background: transparent;
    border-color: #ced4da;
    color: #6c757d;
}

.admin-table tr.ligne-modifiee > td {
    background: var(--fc-soft);
}

.dialog-castellum {
    border: none;
    border-radius: 1rem;
    padding: 1.5rem;
    width: min(26rem, calc(100vw - 2rem));
    box-shadow: 0 24px 60px rgba(17, 24, 39, 0.25);
}

.dialog-castellum::backdrop {
    background: rgba(17, 24, 39, 0.45);
}

.metric-box-ok {
    background: #e7f6ec;
}

/* Barre de navigation */
.castellum-nav .nav-link {
    color: var(--fc-text-muted);
    font-weight: 500;
    border-radius: 0.5rem;
}

.castellum-nav .nav-link:hover,
.castellum-nav .nav-link:focus-visible {
    color: var(--fc-primary);
}

.castellum-nav .nav-link.active {
    color: var(--fc-primary);
}

@media (min-width: 992px) {
    .castellum-nav .navbar-nav > .nav-item > .nav-link {
        padding: 0.5rem 0.85rem;
    }

    .castellum-nav .navbar-nav > .nav-item > .nav-link.active {
        background: var(--fc-soft);
    }
}

.castellum-nav .dropdown-menu {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 12px 30px rgba(47, 72, 112, 0.14);
    padding: 0.4rem;
}

.castellum-nav .dropdown-item {
    border-radius: 0.5rem;
    padding: 0.45rem 0.75rem;
}

.castellum-nav .dropdown-item.active,
.castellum-nav .dropdown-item:active {
    background: var(--fc-soft);
    color: var(--fc-primary);
    font-weight: 600;
}

.castellum-nav .avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    background: var(--fc-primary);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Agenda */
.agenda-date {
    flex: 0 0 auto;
    width: 3.25rem;
    border-radius: 0.75rem;
    background: var(--fc-soft);
    color: var(--fc-primary);
    padding: 0.35rem 0;
    line-height: 1.1;
}

.agenda-date-jour {
    font-size: 1.3rem;
    font-weight: 700;
}

.agenda-date-semaine {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.agenda-date-sm {
    width: 2.9rem;
}

.agenda-date-sm .agenda-date-jour {
    font-size: 1.1rem;
}

.agenda-description {
    color: var(--fc-text-muted);
    white-space: pre-line;
}

/* Agenda : grille mensuelle */
.agenda-grille {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.agenda-grille th {
    padding: 0.6rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--fc-text-muted);
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
}

.agenda-grille td {
    height: 7.5rem;
    padding: 0.35rem;
    vertical-align: top;
    border: 1px solid #eef0f4;
    overflow: hidden;
}

.agenda-grille tr:last-child td {
    border-bottom: 0;
}

.agenda-grille td:first-child {
    border-left: 0;
}

.agenda-grille td:last-child {
    border-right: 0;
}

.agenda-grille td.week-end {
    background-color: #fafbfd;
}

.agenda-grille td.hors-mois {
    background-color: #f6f7f9;
}

.agenda-grille td.hors-mois .agenda-numero,
.agenda-grille td.hors-mois .agenda-puce {
    opacity: 0.55;
}

.agenda-numero {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.agenda-numero > span:first-child {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.7rem;
    height: 1.7rem;
    border-radius: 999px;
}

.agenda-grille td.aujourdhui .agenda-numero > span:first-child {
    background: var(--fc-primary);
    color: #fff;
}

.agenda-puce {
    display: block;
    width: 100%;
    margin-bottom: 0.2rem;
    padding: 0.1rem 0.35rem;
    border: 0;
    border-radius: 0.35rem;
    background: transparent;
    color: inherit;
    font-size: 0.8rem;
    line-height: 1.35;
    text-align: left;
    /* Titre sur deux lignes au plus, puis « … » */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.agenda-puce:hover,
.agenda-puce:focus-visible {
    background: var(--fc-soft);
}

.agenda-puce-heure {
    font-weight: 600;
    color: var(--fc-primary);
    margin-right: 0.15rem;
}

.agenda-puce-journee {
    background: var(--fc-soft);
    color: var(--fc-primary);
    font-weight: 600;
}

.agenda-puce-journee:hover,
.agenda-puce-journee:focus-visible {
    background: #d9e2fb;
}

.min-w-0 {
    min-width: 0;
}

.tool-icon-sm {
    width: 2rem;
    height: 2rem;
    font-size: 1rem;
    border-radius: 0.6rem;
}

/* Page d'erreur */
.erreur-code {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--fc-primary);
    opacity: 0.85;
    letter-spacing: 0.05em;
}

/* Pied de page collé en bas des pages courtes */
body {
    display: flex;
    flex-direction: column;
}

body > main {
    flex: 1 0 auto;
}

.pied-de-page {
    flex-shrink: 0;
}

/* Nouveautés */
.nouveaute {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
    margin-bottom: 1.1rem;
}

.nouveaute:last-child {
    margin-bottom: 0;
}

.nouveaute .tool-icon {
    flex-shrink: 0;
}

/* Section réservée aux administrateurs, séparée des notes de tous */
.nouveautes-admin {
    padding-bottom: 1.1rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid #e5e7eb;
}

/* Sondages */
.texte-libre {
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.reponse {
    display: inline-block;
    min-width: 1.6rem;
    font-weight: 700;
}

.reponse-oui { color: #15803d; }
.reponse-si-besoin { color: #b45309; }
.reponse-non { color: #b91c1c; opacity: 0.6; }

.grille-sondage th {
    font-size: 0.85rem;
    white-space: nowrap;
}

.resultat-choix {
    padding: 0.75rem;
    border-radius: 0.75rem;
    background: var(--fc-surface-soft);
}

.resultat-choix-meilleur {
    background: var(--fc-soft);
}

.commentaire-sondage {
    padding: 0.5rem 0.75rem;
    border-left: 3px solid var(--fc-soft);
    background: var(--fc-surface-soft);
    border-radius: 0.25rem;
}
