/*
 * SI_MED — thème inspiré de Zoho CRM / Zoho One.
 * Sidebar sombre, barre supérieure blanche, vues liste avec panneau de filtres,
 * fiches « enregistrement » avec champs libellé / valeur.
 */
:root {
    --z-primary: #2264d1;
    --z-primary-hover: #1a52ad;
    --z-primary-soft: #e8f0fd;
    --z-sidebar: #1c2536;
    --z-sidebar-hover: #263247;
    --z-sidebar-active: #2e3c55;
    --z-sidebar-text: #aeb8c8;
    --z-sidebar-heading: #6c7a91;
    --z-bg: #f1f3f7;
    --z-surface: #ffffff;
    --z-border: #e2e6ec;
    --z-border-strong: #cfd6e0;
    --z-text: #1f2a3c;
    --z-muted: #6b778a;
    --z-danger: #d93a3a;
    --z-danger-soft: #fdecec;
    --z-success: #1f9254;
    --z-success-soft: #e6f6ed;
    --z-warning: #b86e00;
    --z-warning-soft: #fff4e0;
    --z-radius: 6px;
    --z-sidebar-width: 232px;
    --z-topbar-height: 56px;

    --bs-primary: var(--z-primary);
    --bs-primary-rgb: 34, 100, 209;
    --bs-body-font-family: 'Lato', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bs-body-font-size: 0.875rem;
    --bs-body-color: var(--z-text);
    --bs-border-color: var(--z-border);
    --bs-link-color: var(--z-primary);
    --bs-link-color-rgb: 34, 100, 209;
}

body {
    background: var(--z-bg);
    color: var(--z-text);
}

/* ---------- Boutons ---------- */
.btn {
    --bs-btn-font-size: 0.8125rem;
    --bs-btn-padding-y: 0.375rem;
    --bs-btn-padding-x: 0.875rem;
    --bs-btn-border-radius: var(--z-radius);
    font-weight: 600;
}
.btn-primary {
    --bs-btn-bg: var(--z-primary);
    --bs-btn-border-color: var(--z-primary);
    --bs-btn-hover-bg: var(--z-primary-hover);
    --bs-btn-hover-border-color: var(--z-primary-hover);
    --bs-btn-active-bg: var(--z-primary-hover);
}
.btn-light {
    --bs-btn-bg: #fff;
    --bs-btn-border-color: var(--z-border-strong);
    --bs-btn-color: var(--z-text);
    --bs-btn-hover-bg: #f6f8fb;
    --bs-btn-hover-border-color: var(--z-border-strong);
}
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
}

/* ---------- Layout ---------- */
.z-app {
    display: flex;
    min-height: 100vh;
}

.z-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--z-sidebar-width);
    background: var(--z-sidebar);
    color: var(--z-sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 1030;
}
.z-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--z-topbar-height);
    padding: 0 18px;
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.z-sidebar__brand:hover { color: #fff; }
.z-logo {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #3b82f6, #2264d1);
    color: #fff;
    font-size: 1.05rem;
}
.z-sidebar__brand strong { display: block; font-size: 0.95rem; letter-spacing: 0.02em; }
.z-sidebar__brand small { display: block; font-size: 0.7rem; color: var(--z-sidebar-text); }

.z-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 10px 20px;
}
.z-nav__heading {
    margin: 16px 10px 6px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--z-sidebar-heading);
}
.z-nav__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    margin-bottom: 1px;
    border-radius: var(--z-radius);
    color: var(--z-sidebar-text);
    text-decoration: none;
    font-size: 0.85rem;
}
.z-nav__link i { font-size: 1.05rem; width: 20px; text-align: center; }
.z-nav__link:hover { background: var(--z-sidebar-hover); color: #fff; }
.z-nav__link.is-active {
    background: var(--z-sidebar-active);
    color: #fff;
    box-shadow: inset 3px 0 0 #4c8dff;
}
.z-nav__soon {
    margin-left: auto;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--z-sidebar-heading);
    text-transform: uppercase;
}

.z-main {
    flex: 1;
    margin-left: var(--z-sidebar-width);
    min-width: 0;
}

.z-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--z-topbar-height);
    padding: 0 24px;
    background: var(--z-surface);
    border-bottom: 1px solid var(--z-border);
}
.z-search {
    position: relative;
    flex: 0 1 420px;
}
.z-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--z-muted);
}
.z-search input {
    width: 100%;
    height: 36px;
    padding: 0 12px 0 36px;
    border: 1px solid var(--z-border);
    border-radius: 18px;
    background: #f6f8fb;
    font-size: 0.85rem;
}
.z-search input:focus {
    outline: none;
    background: #fff;
    border-color: var(--z-primary);
    box-shadow: 0 0 0 3px var(--z-primary-soft);
}
.z-topbar__spacer { flex: 1; }
.z-topbar__icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--z-muted);
    font-size: 1.1rem;
    background: none;
    border: 0;
}
.z-topbar__icon:hover { background: #f1f3f7; color: var(--z-text); }
.z-topbar__icon .z-dot {
    position: absolute;
    top: 7px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--z-danger);
    border: 2px solid #fff;
}
.z-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 4px 4px;
    border-radius: 24px;
    border: 0;
    background: none;
    text-align: left;
}
.z-user:hover { background: #f1f3f7; }
.z-user strong { display: block; font-size: 0.82rem; line-height: 1.2; }
.z-user small { display: block; font-size: 0.72rem; color: var(--z-muted); }

.z-content {
    padding: 20px 24px 40px;
}

/* ---------- Avatar ---------- */
.z-avatar {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #dbe7fb;
    color: var(--z-primary);
    font-weight: 700;
    font-size: 0.78rem;
}
.z-avatar--lg { width: 64px; height: 64px; font-size: 1.4rem; }
.z-avatar--danger { background: var(--z-danger-soft); color: var(--z-danger); }

/* ---------- En-tête de page ---------- */
.z-pagehead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}
.z-pagehead h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}
.z-pagehead__sub {
    color: var(--z-muted);
    font-size: 0.8rem;
    margin-top: 2px;
}
.z-pagehead__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.z-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--z-muted);
    font-size: 0.8rem;
    text-decoration: none;
    margin-bottom: 4px;
}

/* ---------- Cartes ---------- */
.z-card {
    background: var(--z-surface);
    border: 1px solid var(--z-border);
    border-radius: var(--z-radius);
}
.z-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--z-border);
}
.z-card__title {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 700;
}
.z-card__body { padding: 16px; }

/* ---------- KPI ---------- */
.z-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.z-kpi {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--z-surface);
    border: 1px solid var(--z-border);
    border-radius: var(--z-radius);
}
.z-kpi__icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    font-size: 1.2rem;
    background: var(--z-primary-soft);
    color: var(--z-primary);
}
.z-kpi__icon--green { background: var(--z-success-soft); color: var(--z-success); }
.z-kpi__icon--orange { background: var(--z-warning-soft); color: var(--z-warning); }
.z-kpi__icon--red { background: var(--z-danger-soft); color: var(--z-danger); }
.z-kpi__label { font-size: 0.75rem; color: var(--z-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; }
.z-kpi__value { font-size: 1.35rem; font-weight: 700; line-height: 1.2; }

/* ---------- Vue liste (style Zoho) ---------- */
.z-listview {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
.z-filter {
    background: var(--z-surface);
    border: 1px solid var(--z-border);
    border-radius: var(--z-radius);
    position: sticky;
    top: calc(var(--z-topbar-height) + 20px);
}
.z-filter__title {
    padding: 12px 14px;
    font-weight: 700;
    font-size: 0.82rem;
    border-bottom: 1px solid var(--z-border);
}
.z-filter__group { padding: 10px 14px; border-bottom: 1px solid var(--z-border); }
.z-filter__group:last-child { border-bottom: 0; }
.z-filter__label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--z-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}
.z-filter__link {
    display: flex;
    justify-content: space-between;
    padding: 5px 8px;
    margin: 0 -8px;
    border-radius: 4px;
    color: var(--z-text);
    text-decoration: none;
}
.z-filter__link:hover { background: #f4f6f9; }
.z-filter__link.is-active { background: var(--z-primary-soft); color: var(--z-primary); font-weight: 700; }
.z-filter__link span:last-child { color: var(--z-muted); }

.z-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--z-border);
}
.z-toolbar__count { color: var(--z-muted); font-size: 0.8rem; }
.z-toolbar__count strong { color: var(--z-text); }

.z-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
}
.z-table th {
    background: #f7f9fb;
    color: var(--z-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--z-border);
    white-space: nowrap;
}
.z-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--z-border);
    vertical-align: middle;
    white-space: nowrap;
}
.z-table td.z-wrap { white-space: normal; min-width: 180px; }
.z-table tbody tr:hover { background: #f7faff; }
.z-table tbody tr:last-child td { border-bottom: 0; }
.z-table .z-col-check { width: 36px; }
.z-table .text-end { text-align: right; }
.z-table__name {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--z-text);
    font-weight: 700;
    text-decoration: none;
}
.z-table__name:hover { color: var(--z-primary); }
.z-table__name small { display: block; font-weight: 400; color: var(--z-muted); font-size: 0.75rem; }
.z-empty {
    padding: 48px 16px;
    text-align: center;
    color: var(--z-muted);
}
.z-empty i { display: block; font-size: 2rem; margin-bottom: 8px; color: var(--z-border-strong); }

/* ---------- Pastilles de statut ---------- */
.z-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 700;
    background: #eef1f5;
    color: var(--z-muted);
    white-space: nowrap;
}
.z-pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.z-pill--success { background: var(--z-success-soft); color: var(--z-success); }
.z-pill--danger { background: var(--z-danger-soft); color: var(--z-danger); }
.z-pill--warning { background: var(--z-warning-soft); color: var(--z-warning); }
.z-pill--info { background: var(--z-primary-soft); color: var(--z-primary); }
.z-tag {
    display: inline-block;
    padding: 1px 8px;
    border: 1px solid var(--z-border-strong);
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--z-muted);
    background: #fff;
}

/* ---------- Fiche enregistrement ---------- */
.z-record-head {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    margin-bottom: 16px;
}
.z-record-head h1 { font-size: 1.3rem; font-weight: 700; margin: 0; }
.z-record-head__meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 6px; color: var(--z-muted); font-size: 0.8rem; }
.z-record-head__meta i { margin-right: 4px; }
.z-record-head__actions { margin-left: auto; display: flex; gap: 8px; }

.z-record {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
.z-related {
    padding: 8px;
    position: sticky;
    top: calc(var(--z-topbar-height) + 20px);
}
.z-related__title {
    padding: 6px 8px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--z-muted);
}
.z-related a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 4px;
    color: var(--z-text);
    text-decoration: none;
}
.z-related a:hover { background: #f4f6f9; }
.z-related a.is-active { background: var(--z-primary-soft); color: var(--z-primary); font-weight: 700; }
.z-related a .z-tag { margin-left: auto; }

.z-section + .z-section { margin-top: 16px; }
.z-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 32px;
}
.z-field {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--z-border);
}
.z-field dt { font-weight: 400; color: var(--z-muted); text-align: right; }
.z-field dd { margin: 0; font-weight: 700; word-break: break-word; }
.z-field--wide { grid-column: 1 / -1; grid-template-columns: 160px minmax(0, 1fr); }

.z-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--z-radius);
    margin-bottom: 16px;
    font-weight: 700;
}
.z-banner i { font-size: 1.05rem; }
.z-banner--danger { background: var(--z-danger-soft); color: var(--z-danger); border: 1px solid #f5c2c2; }
.z-banner--warning { background: var(--z-warning-soft); color: var(--z-warning); border: 1px solid #f3d9a8; }
.z-banner--info { background: var(--z-primary-soft); color: var(--z-primary); border: 1px solid #c5d8f8; }

/* ---------- Formulaires « création » (libellé à gauche) ---------- */
.z-form-bar {
    position: sticky;
    top: var(--z-topbar-height);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: -20px -24px 20px;
    padding: 12px 24px;
    background: var(--z-surface);
    border-bottom: 1px solid var(--z-border);
}
.z-form-bar h1 { font-size: 1.1rem; font-weight: 700; margin: 0; }
.z-form-section {
    max-width: 1100px;
    margin-bottom: 16px;
}
.z-form-section .z-card__body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 40px;
    padding: 20px 24px 8px;
}
.z-form-section .z-card__body > .mb-3,
.z-form-section .z-card__body > fieldset.mb-3 {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    column-gap: 14px;
    align-items: start;
}
.z-form-section .z-card__body > .mb-3 > *:not(label):not(legend) { grid-column: 2; }
.z-form-section .z-card__body > .mb-3 > label,
.z-form-section .z-card__body > fieldset > legend {
    grid-column: 1;
    margin: 0;
    padding-top: 7px;
    text-align: right;
    color: var(--z-muted);
    font-size: 0.82rem;
    font-weight: 400;
    float: none;
    width: auto;
}
.z-form-section .z-card__body > .z-wide { grid-column: 1 / -1; }
.z-form-section .required::after,
.z-form-section legend.required::after { content: ' *'; color: var(--z-danger); }
.form-control, .form-select {
    font-size: 0.85rem;
    border-color: var(--z-border-strong);
    border-radius: 4px;
}
.form-control:focus, .form-select:focus {
    border-color: var(--z-primary);
    box-shadow: 0 0 0 3px var(--z-primary-soft);
}
.z-alert-input { border-color: #f0a8a8; background: #fff8f8; color: var(--z-danger); font-weight: 700; }
.form-text { font-size: 0.75rem; }
.z-checks .form-check { display: inline-block; margin: 6px 18px 4px 0; }

/* ---------- Alertes flash ---------- */
.z-flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 16px;
    border-radius: var(--z-radius);
    font-weight: 700;
    border: 1px solid;
}
.z-flash.alert-success { background: var(--z-success-soft); color: var(--z-success); border-color: #b8e2c8; }
.z-flash.alert-danger { background: var(--z-danger-soft); color: var(--z-danger); border-color: #f5c2c2; }
.z-flash.alert-info { background: var(--z-primary-soft); color: var(--z-primary); border-color: #c5d8f8; }

/* ---------- Connexion ---------- */
.z-login {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    min-height: 100vh;
}
.z-login__hero {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px;
    color: #fff;
    background:
        radial-gradient(circle at 20% 20%, rgba(76, 141, 255, 0.35), transparent 45%),
        radial-gradient(circle at 80% 90%, rgba(34, 100, 209, 0.45), transparent 50%),
        var(--z-sidebar);
}
.z-login__hero h2 { font-size: 2.4rem; font-weight: 900; line-height: 1.15; margin: 0 0 14px; }
.z-login__hero p { color: #c3cddc; font-size: 1rem; max-width: 440px; }
.z-login__features { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; max-width: 460px; margin-top: 28px; }
.z-login__features div { display: flex; gap: 10px; align-items: center; color: #dfe6f0; }
.z-login__features i { color: #79a8ff; font-size: 1.1rem; }
.z-login__panel { display: grid; place-items: center; padding: 32px; background: var(--z-surface); }
.z-login__form { width: 100%; max-width: 360px; }
.z-login__form h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }
.z-login__form .form-control { height: 42px; }
.z-login__form .btn { height: 42px; }

/* ---------- Module en construction ---------- */
.z-soon { max-width: 760px; margin: 24px auto; text-align: center; }
.z-soon__icon {
    display: inline-grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border-radius: 18px;
    background: var(--z-primary-soft);
    color: var(--z-primary);
    font-size: 2rem;
    margin-bottom: 14px;
}
.z-soon ul { text-align: left; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 24px; padding: 0; list-style: none; margin: 0; }
.z-soon li { display: flex; gap: 8px; align-items: baseline; }
.z-soon li i { color: var(--z-primary); }

/* ---------- Facture ---------- */
.z-invoice-total td, .z-invoice-total th { border: 0 !important; padding-top: 6px !important; padding-bottom: 6px !important; }
.z-invoice-total .z-grand { font-size: 1.1rem; font-weight: 900; color: var(--z-text); }

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
    .z-sidebar { transform: translateX(-100%); transition: transform 0.2s; }
    .z-sidebar.is-open { transform: none; }
    .z-main { margin-left: 0; }
    .z-listview, .z-record { grid-template-columns: 1fr; }
    .z-filter, .z-related { position: static; }
    .z-fields, .z-form-section .z-card__body { grid-template-columns: 1fr; }
    .z-login { grid-template-columns: 1fr; }
    .z-login__hero { display: none; }
}
@media (min-width: 993px) {
    .z-menu-toggle { display: none; }
}
@media print {
    .z-sidebar, .z-topbar, .z-pagehead__actions, .z-record-head__actions, .z-related { display: none !important; }
    .z-main { margin: 0; }
    .z-record { grid-template-columns: 1fr; }
}

/* ---------- Onglets de sous-modules ---------- */
.z-tabs {
    display: flex;
    gap: 4px;
    margin: -4px 0 16px;
    border-bottom: 1px solid var(--z-border);
    overflow-x: auto;
}
.z-tabs a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    color: var(--z-muted);
    font-weight: 700;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
}
.z-tabs a:hover { color: var(--z-text); }
.z-tabs a.is-active { color: var(--z-primary); border-bottom-color: var(--z-primary); }
.z-tabs .z-tag { font-size: 0.65rem; }

/* ---------- Documents ---------- */
.z-docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.z-doc {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--z-border);
    border-radius: var(--z-radius);
    background: #fff;
}
.z-doc__icon { font-size: 1.5rem; color: var(--z-primary); }
.z-doc__name { font-weight: 700; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; color: var(--z-text); text-decoration: none; }
.z-doc__meta { color: var(--z-muted); font-size: 0.72rem; }
.z-dropzone {
    border: 2px dashed var(--z-border-strong);
    border-radius: var(--z-radius);
    padding: 16px;
    background: #fafbfd;
}

/* ---------- Impression ---------- */
.z-print { max-width: 900px; margin: 0 auto; background: #fff; padding: 32px 40px; border: 1px solid var(--z-border); }
.z-print h1 { font-size: 1.4rem; font-weight: 900; letter-spacing: 0.04em; }
.z-print__box { border: 1px solid var(--z-border-strong); border-radius: 4px; padding: 12px 16px; margin-bottom: 14px; }
.z-print__box h2 { font-size: 0.8rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.06em; color: var(--z-primary); margin-bottom: 8px; }
.z-print dl { display: grid; grid-template-columns: 150px 1fr 150px 1fr; gap: 4px 12px; margin: 0; }
.z-print dt { font-weight: 400; color: var(--z-muted); }
.z-print dd { margin: 0; font-weight: 700; }
@media print {
    body { background: #fff; }
    .z-print { border: 0; padding: 0; }
    .z-no-print { display: none !important; }
}

/* ---------- Notifications ---------- */
.z-topbar__icon:focus { outline: none; }
.z-topbar__icon:focus-visible { box-shadow: 0 0 0 3px var(--z-primary-soft); }
.z-topbar__icon .z-badge {
    position: absolute;
    top: -3px;
    right: -9px;
    left: auto;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--z-danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    border: 2px solid #fff;
    box-sizing: content-box;
}
.z-notifs { width: 360px; max-height: 460px; overflow-y: auto; }
.z-notif {
    display: flex;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--z-border);
    color: var(--z-text);
    text-decoration: none;
    font-size: 0.82rem;
}
.z-notif:hover { background: #f7faff; }
.z-notif.is-unread { background: var(--z-primary-soft); }
.z-notif i { font-size: 1.1rem; margin-top: 2px; }
.z-toast {
    position: fixed;
    top: 70px;
    right: 24px;
    z-index: 1090;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    width: 360px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid var(--z-border);
    border-left: 4px solid var(--z-primary);
    border-radius: var(--z-radius);
    box-shadow: 0 10px 30px rgba(28, 37, 54, 0.18);
    animation: z-slide-in 0.25s ease-out;
}
.z-toast > i { color: var(--z-primary); font-size: 1.2rem; }
.z-toast > div { flex: 1; font-size: 0.85rem; }
@keyframes z-slide-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Planning semaine ---------- */
.z-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.z-week__day { background: var(--z-surface); border: 1px solid var(--z-border); border-radius: var(--z-radius); min-height: 340px; }
.z-week__day.is-today { border-color: var(--z-primary); box-shadow: 0 0 0 2px var(--z-primary-soft); }
.z-week__head { padding: 10px 12px; border-bottom: 1px solid var(--z-border); display: flex; justify-content: space-between; align-items: baseline; }
.z-week__head strong { text-transform: capitalize; }
.z-slot {
    display: block;
    margin: 8px;
    padding: 8px 10px;
    border-radius: 4px;
    border-left: 3px solid var(--z-primary);
    background: #f5f8fe;
    color: var(--z-text);
    text-decoration: none;
    font-size: 0.8rem;
}
.z-slot:hover { background: var(--z-primary-soft); }
.z-slot--admitted { border-left-color: var(--z-warning); background: var(--z-warning-soft); }
.z-slot--validated { border-left-color: var(--z-success); background: var(--z-success-soft); }
@media (max-width: 992px) { .z-week { grid-template-columns: 1fr; } }

/* ---------- Ordonnance / compte rendu ---------- */
.z-rx { list-style: none; padding: 0; margin: 0; counter-reset: rx; }
.z-rx li { counter-increment: rx; padding: 10px 0; border-bottom: 1px dashed var(--z-border); display: flex; gap: 12px; }
.z-rx li::before { content: counter(rx) '.'; font-weight: 900; color: var(--z-primary); }
.z-steps { display: flex; gap: 4px; align-items: center; }
.z-steps span { width: 22px; height: 4px; border-radius: 2px; background: var(--z-border); }
.z-steps span.is-done { background: var(--z-success); }

/* Tableau compact (PV, états imprimés) */
.z-table--compact th, .z-table--compact td { padding: 6px 8px; font-size: 0.78rem; white-space: normal; }

/* ---------- Graphiques ---------- */
.z-chart { position: relative; width: 100%; min-height: 40px; }
.z-chart svg { display: block; overflow: visible; }
.z-chart__legend { display: flex; gap: 16px; margin-bottom: 8px; font-size: 0.78rem; color: var(--z-muted); }
.z-chart__legend span { display: inline-flex; align-items: center; gap: 6px; }
.z-chart__legend i, .z-chart__tooltip i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.z-chart__tooltip {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    min-width: 150px;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid var(--z-border);
    border-radius: var(--z-radius);
    box-shadow: 0 6px 18px rgba(28, 37, 54, 0.12);
    font-size: 0.78rem;
    color: var(--z-text);
}
.z-chart__tooltip div { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.z-delta { font-size: 0.75rem; font-weight: 700; }
.z-delta--up { color: #006300; }
.z-delta--down { color: var(--z-danger); }

/* ---------- Messagerie ---------- */
.z-chat {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr) 250px;
    height: calc(100vh - var(--z-topbar-height) - 64px);
    min-height: 480px;
    background: var(--z-surface);
    border: 1px solid var(--z-border);
    border-radius: var(--z-radius);
    overflow: hidden;
}
.z-chat:has(.z-chat__pane--empty), .z-chat:has(.z-chat__pane--scroll) { grid-template-columns: 300px minmax(0, 1fr); }
.z-chat__list { display: flex; flex-direction: column; border-right: 1px solid var(--z-border); min-height: 0; }
.z-chat__listhead { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 4px; }
.z-chat__items { overflow-y: auto; flex: 1; }
.z-chat__item { display: flex; gap: 10px; align-items: center; padding: 10px 14px; color: inherit; text-decoration: none; border-left: 3px solid transparent; }
.z-chat__item:hover { background: var(--z-bg); }
.z-chat__item.is-active { background: var(--z-primary-soft); border-left-color: var(--z-primary); }
.z-chat__item.is-unread strong { color: var(--z-text); }
.z-chat__item.is-unread small.text-truncate { color: var(--z-text) !important; font-weight: 600; }
.z-chat__itemtext { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.z-chat__count { display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--z-success); color: #fff; font-size: 0.68rem; font-weight: 700; line-height: 18px; text-align: center; }
.z-avatar { position: relative; flex-shrink: 0; }
.z-avatar--group { background: #efe9fb; color: #6a42c2; }
.z-avatar--whatsapp { background: #e3f7ea; color: #1f9254; }
.z-online { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: var(--z-success); border: 2px solid #fff; }
.z-chat__pane { display: flex; flex-direction: column; min-height: 0; background: #f6f7fa; }
.z-chat__pane--empty { display: grid; place-items: center; }
.z-chat__pane--scroll { overflow-y: auto; background: var(--z-surface); display: block; }
.z-chat__panehead { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--z-surface); border-bottom: 1px solid var(--z-border); }
.z-chat__thread { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.z-msg { align-self: flex-start; max-width: min(70%, 520px); padding: 7px 10px 4px; background: var(--z-surface); border: 1px solid var(--z-border); border-radius: 10px 10px 10px 2px; }
.z-msg.is-mine { align-self: flex-end; background: var(--z-primary-soft); border-color: #cddcf6; border-radius: 10px 10px 2px 10px; }
.z-msg__author { display: block; font-weight: 700; color: var(--z-primary); font-size: 0.72rem; }
.z-msg__body { white-space: normal; overflow-wrap: anywhere; }
.z-msg__time { display: block; text-align: right; color: var(--z-muted); font-size: 0.68rem; }
.z-msg__image { display: block; max-width: 260px; max-height: 220px; border-radius: 6px; margin-bottom: 4px; }
.z-msg__file { display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin-bottom: 4px; background: rgba(255, 255, 255, 0.7); border: 1px solid var(--z-border); border-radius: 6px; color: inherit; text-decoration: none; max-width: 300px; min-width: 0; }
.z-msg__file i { font-size: 1.5rem; color: var(--z-danger); }
.z-msg__file small { color: var(--z-muted); }
.z-chat__composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; background: var(--z-surface); border-top: 1px solid var(--z-border); }
.z-chat__composer textarea { resize: none; max-height: 140px; }
.z-chat__composer label { cursor: pointer; }
.z-chat__chosen { font-size: 0.78rem; color: var(--z-muted); margin-bottom: 4px; }
.z-chat__info { border-left: 1px solid var(--z-border); padding: 16px; overflow-y: auto; }
.z-chat__doc { display: flex; gap: 8px; align-items: center; padding: 6px 0; color: inherit; text-decoration: none; font-size: 0.82rem; min-width: 0; }
.z-chat__doc i { font-size: 1.2rem; color: var(--z-muted); }
.z-chat__directory { max-height: 320px; overflow-y: auto; border: 1px solid var(--z-border); border-radius: var(--z-radius); }
.z-chat__contact { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; margin: 0; }
.z-chat__contact + .z-chat__contact { border-top: 1px solid var(--z-border); }
.z-chat__contact:hover { background: var(--z-bg); }
@media (max-width: 1199px) { .z-chat { grid-template-columns: 260px minmax(0, 1fr); } .z-chat__info { display: none; } }
@media (max-width: 767px) { .z-chat, .z-chat:has(.z-chat__pane--empty), .z-chat:has(.z-chat__pane--scroll) { grid-template-columns: 1fr; height: auto; } .z-chat__list { max-height: 260px; border-right: 0; border-bottom: 1px solid var(--z-border); } .z-chat__pane { min-height: 60vh; } }
.z-chat > * { min-width: 0; }
.z-chat__list .z-tabs { white-space: nowrap; overflow-x: auto; }
.z-chat__whatsapp { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--z-border); color: inherit; text-decoration: none; }
.z-chat__whatsapp > .bi-whatsapp { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #e3f7ea; color: var(--z-success); }
.z-chat__whatsapp:hover, .z-chat__whatsapp.is-active { background: var(--z-bg); }
@media (max-width: 575px) { .z-topbar__icon { width: 32px; } .z-topbar .z-user { padding-left: 2px; padding-right: 2px; } }
