/* ═══════════════════════════════════════════════════════════
   RdvBox — Feuille de style principale
   ═══════════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────────── */
:root {
    --color-doctor:  #2563EB;
    --color-lawyer:  #16A34A;
    --color-company: #CA8A04;

    --color-bg:       #F3F4F6;
    --color-surface:  #FFFFFF;
    --color-border:   #E5E7EB;
    --color-text:     #111827;
    --color-muted:    #6B7280;
    --color-primary:  #2563EB;
    --color-danger:   #DC2626;
    --color-success:  #16A34A;
    --color-warning:  #D97706;
    --color-info:     #0891B2;

    --radius-sm:  4px;
    --radius:     8px;
    --radius-lg:  12px;
    --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --shadow:     0 4px 12px rgba(0,0,0,.08);
    --shadow-lg:  0 8px 24px rgba(0,0,0,.1);

    --sidebar-width: 230px;
    --header-height: 58px;
    --transition:    .15s ease;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── Header ─────────────────────────────────────────────── */
.app-header {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--header-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    z-index: 200;
    box-shadow: var(--shadow-sm);
}
.header-brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
    font-size: 19px; font-weight: 800; letter-spacing: -.3px;
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition);
}
.brand-logo:hover { text-decoration: none; opacity: .85; }
.header-clock { font-size: 13px; color: var(--color-muted); font-variant-numeric: tabular-nums; }
.header-user { display: flex; align-items: center; gap: 12px; }
.user-name { font-weight: 600; font-size: 13px; }

/* ── Layout ─────────────────────────────────────────────── */
.app-layout {
    display: flex;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    padding: 12px 0 24px;
    position: fixed;
    top: var(--header-height); bottom: 0;
    overflow-y: auto;
    z-index: 100;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 4px; }

.sidebar-menu { list-style: none; }

.sidebar-menu li a {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 18px;
    color: var(--color-text);
    font-size: 13.5px;
    border-radius: 0;
    transition: background var(--transition), color var(--transition);
}
.sidebar-menu li a:hover { background: var(--color-bg); text-decoration: none; color: var(--color-primary); }
.sidebar-menu li.active > a {
    background: #EFF6FF;
    color: var(--color-primary);
    font-weight: 600;
    border-right: 3px solid var(--color-primary);
}
.menu-section {
    padding: 14px 18px 4px;
    font-size: 10.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em;
    color: var(--color-muted);
}

.content-wrapper { margin-left: var(--sidebar-width); flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main-content { padding: 28px 32px; flex: 1; }

/* Planning pleine hauteur */
.main-content--fullheight {
    height: calc(100vh - var(--header-height));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
    gap: 0;
}
.main-content--fullheight .page-header {
    flex-shrink: 0;
    margin-bottom: 0;
    padding-bottom: 12px;
}
.main-content--fullheight .week-grid-wrapper {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.main-content--fullheight .week-grid {
    height: 100%;
}
.main-content--fullheight .week-col {
    height: 100%;
}
.main-content--fullheight .week-col-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}
/* Vue mois en pleine hauteur : scroll vertical sur la grille */
.main-content--fullheight .calendar-grid {
    flex: 1;
    overflow-y: auto;
    align-content: start;
}

/* ── Page header ─────────────────────────────────────────── */
.page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
    margin-bottom: 24px;
}
.page-header h1 { font-size: 21px; font-weight: 700; line-height: 1.2; }
.page-header p  { font-size: 13px; color: var(--color-muted); margin-top: 3px; }
.page-actions   { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}
.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-body  { padding: 20px; }
.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
    border-radius: 0 0 var(--radius) var(--radius);
    display: flex; gap: 8px; align-items: center;
}

/* ── Tables ─────────────────────────────────────────────── */
.table-wrapper {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.table-scroll { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.table thead tr {
    background: var(--color-bg);
    border-bottom: 2px solid var(--color-border);
}
.table th {
    padding: 10px 16px;
    font-weight: 600; font-size: 12px;
    text-transform: uppercase; letter-spacing: .04em;
    color: var(--color-muted);
    text-align: left;
    white-space: nowrap;
}
.table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #F9FAFB; }
.table-actions { display: flex; gap: 6px; align-items: center; }
.table-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--color-muted);
}
.table-empty p { margin-top: 8px; font-size: 13px; }

/* ── Filters bar ─────────────────────────────────────────── */
.filters-bar {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 16px;
    display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}
.filters-bar .form-group { margin-bottom: 0; min-width: 140px; }
.filters-bar .form-label { font-size: 12px; font-weight: 600; color: var(--color-muted); margin-bottom: 4px; }

/* ── Forms ──────────────────────────────────────────────── */
.form-group  { margin-bottom: 18px; }
.form-label  { display: block; font-weight: 500; font-size: 13px; margin-bottom: 6px; color: var(--color-text); }
.form-hint   { font-size: 12px; color: var(--color-muted); margin-top: 4px; }
.form-control {
    display: block; width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color var(--transition), box-shadow var(--transition);
    appearance: none;
}
.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-control::placeholder { color: #9CA3AF; }
select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}
textarea.form-control { resize: vertical; min-height: 90px; }
.form-control[readonly] { background: var(--color-bg); color: var(--color-muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .form-row, .form-row-3 { grid-template-columns: 1fr; } }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px; font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background var(--transition), opacity var(--transition), box-shadow var(--transition);
    text-decoration: none; white-space: nowrap;
    line-height: 1;
}
.btn:hover { text-decoration: none; opacity: .9; }
.btn:active { transform: translateY(1px); }
.btn-primary  { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.btn-primary:hover { background: #1D4ED8; color: #fff; opacity: 1; }
.btn-danger   { background: var(--color-danger);  color: #fff; border-color: var(--color-danger); }
.btn-danger:hover { background: #B91C1C; color: #fff; opacity: 1; }
.btn-success  { background: var(--color-success); color: #fff; border-color: var(--color-success); }
.btn-warning  { background: var(--color-warning); color: #fff; border-color: var(--color-warning); }
.btn-secondary { background: #6B7280; color: #fff; border-color: #6B7280; }
.btn-outline  { background: transparent; border-color: var(--color-border); color: var(--color-text); }
.btn-outline:hover { background: var(--color-bg); opacity: 1; }
.btn-outline-primary { background: transparent; border-color: var(--color-primary); color: var(--color-primary); }
.btn-outline-primary:hover { background: #EFF6FF; opacity: 1; }
.btn-sm   { padding: 5px 10px; font-size: 12px; }
.btn-lg   { padding: 11px 24px; font-size: 15px; }
.btn-full { width: 100%; }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* ── Alerts ─────────────────────────────────────────────── */
.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    border: 1px solid transparent;
    font-size: 13.5px;
}
.alert-danger,  .alert--error   { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.alert-success, .alert--success { background: #F0FDF4; border-color: #BBF7D0; color: #14532D; }
.alert-warning, .alert--warning { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
.alert-info,    .alert--info    { background: #F0F9FF; border-color: #BAE6FD; color: #0C4A6E; }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11.5px; font-weight: 600;
    white-space: nowrap;
}
.badge-primary  { background: #DBEAFE; color: #1E40AF; }
.badge-success  { background: #DCFCE7; color: #14532D; }
.badge-danger   { background: #FEE2E2; color: #991B1B; }
.badge-warning  { background: #FEF9C3; color: #713F12; }
.badge-secondary{ background: #F3F4F6; color: #374151; }
.badge-info     { background: #E0F2FE; color: #075985; }
.badge--alert   { background: var(--color-danger); color: #fff; min-width: 18px; justify-content: center; }

/* statuts RDV */
.badge-pending   { background: #FEF9C3; color: #713F12; }
.badge-confirmed { background: #DCFCE7; color: #14532D; }
.badge-cancelled { background: #FEE2E2; color: #991B1B; }
.badge-done      { background: #E0E7FF; color: #3730A3; }
.badge-no_show   { background: #F3F4F6; color: #374151; }

/* rôles */
.badge--role-admin     { background: #EDE9FE; color: #5B21B6; }
.badge--role-secretary { background: #DCFCE7; color: #14532D; }
.badge--role-client    { background: #DBEAFE; color: #1E40AF; }

/* types professionnels */
.badge-doctor  { background: #DBEAFE; color: #1E40AF; }
.badge-lawyer  { background: #DCFCE7; color: #14532D; }
.badge-company { background: #FEF9C3; color: #713F12; }

/* ── Calendar ────────────────────────────────────────────── */
.calendar-nav {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; gap: 12px;
}
.calendar-nav h2 { font-size: 17px; font-weight: 700; }

/* La grille 7 colonnes — les headers ET les cellules sont des enfants directs */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

/* En-têtes des jours (Lun Mar … Dim) */
.calendar-day-header {
    padding: 10px 6px;
    text-align: center;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em;
    color: var(--color-muted);
    background: var(--color-bg);
    border-bottom: 2px solid var(--color-border);
}

/* Cellules jours */
.calendar-cell {
    min-height: 100px;
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    padding: 6px;
    background: var(--color-surface);
}
/* Supprimer la bordure droite de la dernière colonne */
.calendar-day-header:nth-child(7n),
.calendar-cell:nth-child(7n) { border-right: none; }

.calendar-cell--empty { background: #F9FAFB; }
.calendar-cell--today  { background: #EFF6FF; }
.calendar-cell--weekend { background: #FAFAFA; }

.cell-date {
    font-size: 12px; font-weight: 600;
    color: var(--color-muted);
    margin-bottom: 4px;
    display: flex; align-items: center; gap: 4px;
}
.cell-date > span:first-child {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 50%;
}
/* Compteur créneaux libres (vue mois) */
.cell-slots-count {
    font-size: 10px; font-weight: 700;
    background: #DBEAFE; color: #1D4ED8;
    border-radius: 10px;
    padding: 1px 6px;
    white-space: nowrap;
}
.calendar-cell--today .cell-date > span:first-child {
    background: var(--color-primary); color: #fff;
}
.cell-appt {
    display: flex; align-items: center; gap: 4px;
    padding: 2px 5px;
    border-radius: 3px;
    margin-bottom: 2px;
    font-size: 11px;
    border-left: 3px solid var(--color-primary);
    background: rgba(37,99,235,.07);
    cursor: pointer;
    overflow: hidden;
    text-decoration: none; color: var(--color-text);
    line-height: 1.3;
}
.cell-appt span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cell-appt:hover { opacity: .82; }
.cell-holiday {
    font-size: 10px; color: #92400E;
    background: #FEF3C7; border-radius: 3px;
    padding: 1px 4px; margin-bottom: 2px;
    font-weight: 500; line-height: 1.4;
}

/* ── Week view ───────────────────────────────────────────── */
.week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    background: var(--color-border); /* gap "lignes" entre colonnes */
}
.week-col {
    background: var(--color-surface);
    display: flex;
    flex-direction: column;
    min-height: 340px;
}
.week-col--weekend { background: #FAFAFA; }
.week-col--today   { background: #EFF6FF; }

.week-col-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 6px 8px;
    background: var(--color-bg);
    border-bottom: 2px solid var(--color-border);
    text-align: center;
}
.week-day-name {
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .07em;
    color: var(--color-muted);
}
.week-day-num {
    font-size: 20px; font-weight: 700;
    color: var(--color-text);
    line-height: 1;
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
}
.week-day-num.is-today {
    background: var(--color-primary);
    color: #fff;
}
.week-month {
    font-size: 10px; color: var(--color-muted);
}

.week-col-body {
    flex: 1;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.week-appt {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    min-height: 48px;
    padding: 6px 8px;
    border-radius: 4px;
    border-left: 3px solid var(--color-primary);
    background: rgba(37,99,235,.07);
    text-decoration: none;
    color: var(--color-text);
    font-size: 11.5px;
    line-height: 1.4;
    transition: opacity .15s, box-shadow .15s;
    text-align: left;
    cursor: pointer;
    width: 100%;
    border-top: none; border-right: none; border-bottom: none;
}
.week-appt:hover { opacity: .85; box-shadow: var(--shadow-sm); text-decoration: none; color: var(--color-text); }
.week-appt-time    { font-weight: 700; font-size: 12px; }
.week-appt-service { font-weight: 600; }
.week-appt-caller  { color: var(--color-muted); font-size: 11px; }

.week-holiday {
    font-size: 10px; color: #92400E;
    background: #FEF3C7; border-radius: 3px;
    padding: 2px 5px;
    font-weight: 500;
}
.week-add-btn {
    display: block;
    flex: 0 0 auto;
    margin-top: auto;
    padding: 3px;
    text-align: center;
    font-size: 18px; line-height: 1;
    color: var(--color-muted);
    background: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    opacity: 0;
    transition: opacity .15s;
}
.week-col:hover .week-add-btn { opacity: 1; }
.week-add-btn:hover { background: var(--color-bg); color: var(--color-primary); }
.week-empty { flex: 1; }

/* Créneau libre dans la vue semaine */
.week-slot {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    flex: 1;
    min-height: 48px;
    width: 100%;
    padding: 6px 8px;
    border: 1px dashed var(--color-border);
    border-radius: 4px;
    background: transparent;
    font-size: 12px; font-weight: 700;
    color: var(--color-muted);
    cursor: pointer;
    text-align: left;
    transition: border-color .12s, background .12s, color .12s;
}
.week-slot:hover {
    border-color: var(--color-primary);
    background: rgba(37,99,235,.05);
    color: var(--color-primary);
}
.week-slot-end {
    font-weight: 400;
    font-size: 10.5px;
    color: inherit;
    opacity: .7;
}

/* ── Planning grid (ancien, conservé pour compatibilité) ─── */
/* La grille elle-même est construite en inline style (colonnes dynamiques) */
.planning-grid {
    align-items: start;
}
.planning-col {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    min-height: 120px;
}
.planning-col-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px;
    background: var(--color-bg);
    border-bottom: 2px solid var(--color-border);
    font-weight: 700; font-size: 13px;
    /* border-top couleur par pro définie en inline */
}
.planning-col-header a:first-child { color: var(--color-text); text-decoration: none; }
.planning-col-header a:first-child:hover { color: var(--color-primary); }
.planning-col > .text-muted { padding: 12px; font-size: 12px; }
.planning-appt {
    display: block;
    padding: 7px 10px;
    margin: 6px;
    border-radius: 4px;
    font-size: 12px;
    border-left: 3px solid var(--color-primary);
    background: rgba(37,99,235,.07);
    color: var(--color-text);
    text-decoration: none;
    transition: box-shadow var(--transition);
}
.planning-appt:hover { box-shadow: var(--shadow-sm); text-decoration: none; color: var(--color-text); }
.appt-time { font-weight: 700; font-size: 13px; margin-bottom: 2px; }

/* ── Stats cards ─────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px 16px;
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-card--alert { border-top: 3px solid var(--color-danger); }
.stat-card--success { border-top: 3px solid var(--color-success); }
.stat-card--warning { border-top: 3px solid var(--color-warning); }
.stat-card--primary { border-top: 3px solid var(--color-primary); }
.stat-number { font-size: 30px; font-weight: 700; color: var(--color-primary); line-height: 1; }
.stat-label  { font-size: 12px; color: var(--color-muted); margin-top: 6px; }

/* ── Quick links ─────────────────────────────────────────── */
.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
}
.link-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px;
    padding: 20px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    text-align: center;
    font-weight: 500; font-size: 13.5px;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
    color: var(--color-text);
}
.link-card:hover { border-color: var(--color-primary); box-shadow: var(--shadow); text-decoration: none; color: var(--color-primary); }
.link-card-icon { font-size: 22px; }

/* ── Appointments ────────────────────────────────────────── */
.appointment-list { display: flex; flex-direction: column; gap: 6px; }
.appointment-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    border-left: 4px solid var(--color-border);
    transition: box-shadow var(--transition);
}
.appointment-item:hover { box-shadow: var(--shadow-sm); }
.appointment-item--doctor  { border-left-color: var(--color-doctor); }
.appointment-item--lawyer  { border-left-color: var(--color-lawyer); }
.appointment-item--company { border-left-color: var(--color-company); }
.appt-time    { font-weight: 700; font-size: 13px; min-width: 46px; font-variant-numeric: tabular-nums; }
.appt-pro     { font-weight: 600; }
.appt-service { color: var(--color-muted); flex: 1; font-size: 13px; }
.appt-caller  { font-size: 12px; color: var(--color-muted); }

/* ── Notes ──────────────────────────────────────────────── */
.note-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 8px;
    transition: box-shadow var(--transition);
}
.note-item:hover { box-shadow: var(--shadow-sm); }
.note-instruction { border-left: 4px solid var(--color-warning); }
.note-secretary   { border-left: 4px solid var(--color-info); }
.note-personal    { border-left: 4px solid var(--color-muted); }
.note-meta { font-size: 12px; color: var(--color-muted); margin-top: 6px; }

/* ── Professional cards ──────────────────────────────────── */
.professional-doctor  { border-left: 4px solid var(--color-doctor); }
.professional-lawyer  { border-left: 4px solid var(--color-lawyer); }
.professional-company { border-left: 4px solid var(--color-company); }

/* ── Caller detail ───────────────────────────────────────── */
.caller-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.info-item label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--color-muted); }
.info-item p     { font-size: 14px; margin-top: 2px; }

/* ── SMS ─────────────────────────────────────────────────── */
#sms-counter { font-size: 12px; color: var(--color-muted); }
.sms-preview-box {
    background: #F0FDF4;
    border: 1px solid #BBF7D0;
    border-radius: var(--radius);
    padding: 14px;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* ── Migration steps ─────────────────────────────────────── */
.migration-steps {
    display: flex; align-items: center; justify-content: center;
    gap: 0; margin-bottom: 28px;
}
.migration-step {
    display: flex; flex-direction: column; align-items: center;
    gap: 4px; opacity: .4;
}
.migration-step.active { opacity: 1; }
.migration-step.done   { opacity: 1; }
.migration-step .step-num {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--color-muted); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
}
.migration-step.active .step-num { background: var(--color-primary); }
.migration-step.done   .step-num { background: var(--color-success); }
.migration-step .step-label { font-size: 12px; color: var(--color-muted); }
.migration-step.active .step-label { color: var(--color-primary); font-weight: 600; }
.migration-step-line { flex: 1; height: 2px; background: var(--color-border); min-width: 60px; max-width: 100px; margin-bottom: 18px; }

/* ── Login ──────────────────────────────────────────────── */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--color-bg); }
.login-container { width: 100%; max-width: 400px; padding: 16px; }
.login-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 36px; box-shadow: var(--shadow-lg); }
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand h1 { font-size: 28px; font-weight: 800; color: var(--color-primary); }
.login-brand p  { color: var(--color-muted); margin-top: 4px; }

/* ── Error page ─────────────────────────────────────────── */
.error-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.error-container { text-align: center; padding: 40px; }
.error-code  { font-size: 80px; font-weight: 700; color: var(--color-primary); line-height: 1; }
.error-label { font-size: 22px; margin: 12px 0; font-weight: 600; }
.error-message { color: var(--color-muted); margin-bottom: 24px; }

/* ── Confirm card ────────────────────────────────────────── */
.confirm-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 28px;
    max-width: 480px;
    box-shadow: var(--shadow-sm);
}
.confirm-card p { margin-bottom: 12px; line-height: 1.6; }

/* ── Footer ─────────────────────────────────────────────── */
.app-footer {
    margin-left: var(--sidebar-width);
    padding: 14px 32px;
    border-top: 1px solid var(--color-border);
    color: var(--color-muted);
    font-size: 12px;
    display: flex; justify-content: space-between; align-items: center;
}

/* ── Utilities ──────────────────────────────────────────── */
.text-muted   { color: var(--color-muted); }
.text-danger  { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-primary { color: var(--color-primary); }
.text-sm      { font-size: 12px; }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.fw-600       { font-weight: 600; }
.fw-700       { font-weight: 700; }
.mt-0  { margin-top: 0; }
.mt-1  { margin-top: 6px; }
.mt-2  { margin-top: 12px; }
.mt-3  { margin-top: 20px; }
.mb-0  { margin-bottom: 0; }
.mb-1  { margin-bottom: 6px; }
.mb-2  { margin-bottom: 12px; }
.mb-3  { margin-bottom: 20px; }
.gap-1 { gap: 6px; }
.gap-2 { gap: 12px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }

/* ── Slot picker ─────────────────────────────────────────── */
.slot-picker {
    display: flex; flex-wrap: wrap; gap: 6px;
    min-height: 32px;
    padding: 4px 0;
}
.slot-btn {
    padding: 4px 10px;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    background: var(--color-surface);
    font-size: 12px; font-weight: 600;
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
    color: var(--color-text);
}
.slot-btn:hover  { border-color: var(--color-primary); color: var(--color-primary); }
.slot-btn.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.slot-loading, .slot-none { font-size: 12px; color: var(--color-muted); padding: 4px 0; }

/* Sélecteur jours de semaine */
.weekday-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.weekday-btn { cursor: pointer; }
.weekday-btn input { display: none; }
.weekday-btn span {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    font-size: 12px; font-weight: 600;
    transition: background .12s, border-color .12s, color .12s;
}
.weekday-btn input:checked + span {
    background: var(--color-primary); border-color: var(--color-primary); color: #fff;
}

/* Onglets dans la modale créneaux */
.tab-bar { display: flex; gap: 4px; border-bottom: 2px solid var(--color-border); }
.tab-btn {
    padding: 6px 14px;
    border: none; background: none; cursor: pointer;
    font-size: 13px; font-weight: 600;
    color: var(--color-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color .15s, border-color .15s;
}
.tab-btn:hover  { color: var(--color-text); }
.tab-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* Modale large */
.modal--wide { max-width: 640px; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-overlay.is-open {
    display: flex;
}
.modal {
    background: var(--color-surface);
    border-radius: calc(var(--radius) * 1.5);
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modal-in .18s ease;
}
@keyframes modal-in {
    from { opacity: 0; transform: translateY(-12px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}
.modal-title { font-size: 16px; font-weight: 700; margin: 0; }
.modal-close {
    background: none; border: none; cursor: pointer;
    font-size: 22px; line-height: 1; color: var(--color-muted);
    padding: 2px 6px; border-radius: 4px;
    transition: background .15s, color .15s;
}
.modal-close:hover { background: var(--color-bg); color: var(--color-text); }
.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}
.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--color-border);
    display: flex; justify-content: flex-end; gap: 10px;
    flex-shrink: 0;
}

/* Liste d'appelants dans la modale */
.caller-checklist {
    max-height: 160px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 4px 0;
}
.caller-check-item {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 13px;
    transition: background .1s;
}
.caller-check-item:hover { background: var(--color-bg); }
.caller-check-item input[type="checkbox"] { flex-shrink: 0; }
.caller-check-item span:first-of-type { flex: 1; font-weight: 500; }

/* ── Création rapide appelant ────────────────────────────── */
.caller-quick-form {
    margin-top: 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 12px;
    background: var(--color-bg);
}
.caller-quick-form-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--color-text);
}

/* ── Print ───────────────────────────────────────────────── */
@media print {
    .app-header, .sidebar, .app-footer, .modal-overlay, .no-print { display: none !important; }
    .content-wrapper { margin-left: 0 !important; }
    .main-content { padding: 0 !important; }
    .table td, .table th { padding: 6px 8px; }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    :root { --sidebar-width: 0px; }
    .sidebar { display: none; }
    .main-content { padding: 16px; }
    .app-footer { margin-left: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .calendar-cell { min-height: 60px; }
    .page-header { flex-direction: column; }
    .week-grid-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .week-grid { min-width: 700px; }
}

/* ── Slot wrapper avec bande couleur ─────────────────────── */
.week-slot-wrapper {
    display: flex;
    align-items: stretch;
    position: relative;
}
.week-slot-strip {
    width: 4px;
    flex-shrink: 0;
    border-radius: 2px 0 0 2px;
}
.week-slot { flex: 1; }
.week-slot-time { font-size: 11px; }

/* ── Légende planning ────────────────────────────────────── */
.planning-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 28px;
    padding: 10px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin: 8px 0 4px;
    font-size: 12px;
    color: var(--color-muted);
}
.planning-legend-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 12px;
}
.planning-legend-title {
    font-weight: 600;
    color: var(--color-text);
    margin-right: 4px;
}
.planning-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}
.planning-legend-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}
.planning-legend-swatch--strip {
    width: 4px;
    height: 14px;
    border-radius: 2px;
}

/* ── Checkbox sélection ──────────────────────────────────── */
.week-slot-cb { display: none; }
.slot-select-mode .week-slot-cb { display: block; margin-left: auto; }
.slot-select-mode [data-open-appt-modal] { pointer-events: none; }
.slot-select-mode [data-select-slot] { cursor: pointer; }

/* ── Barre d'action sélection ────────────────────────────── */
.select-bar {
    position: sticky;
    bottom: 0;
    left: 0; right: 0;
    background: var(--color-primary);
    color: #fff;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 600;
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0,0,0,.15);
    border-radius: 8px 8px 0 0;
}
.select-bar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.select-bar .form-control { color: var(--color-text); }
