/* Base theme */
:root {
    --bg: #eef2ff;
    --bg-2: #f8fafc;
    --surface: rgba(255, 255, 255, 0.92);
    --surface-solid: #ffffff;
    --surface-soft: #f8fafc;
    --border: #dbe3ef;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --primary-soft: #dbeafe;
    --accent: #0f766e;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.12);
    --shadow-md: 0 14px 32px rgba(15, 23, 42, 0.10);
    --shadow-sm: 0 4px 14px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    background:
        radial-gradient(circle at top left, rgba(29, 78, 216, 0.10), transparent 35%),
        radial-gradient(circle at top right, rgba(15, 118, 110, 0.10), transparent 28%),
        linear-gradient(180deg, #f8fbff 0%, #eef2ff 100%);
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text) !important;
    font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif !important;
    background: transparent !important;
    padding: 24px !important;
    line-height: 1.55;
}

a {
    color: inherit;
}

img,
svg {
    max-width: 100%;
}

header,
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 18px 24px;
    margin-bottom: 24px;
    background: var(--surface);
    border: 1px solid rgba(219, 227, 239, 0.85);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(14px);
}

.logo-area h2,
.page-title,
h2,
h3,
h4 {
    margin: 0;
    letter-spacing: -0.03em;
}

.logo-area h2 {
    color: var(--primary) !important;
    font-size: 1.25rem;
    font-weight: 800;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-weight: 600;
}

.btn-logout,
.btn,
.btn-action,
.btn-action-modal,
.tab-btn,
.sub-nav-item,
.role-btn,
.toggle-link,
.fab,
.btn-submit,
.btn-cancel,
.btn-cancel-custom,
.btn-pdf,
.btn-pdf,
.btn-action-modal.btn-edit-m,
.btn-mod.val,
.btn-fast.val {
    background: transparent;
    color: #fff;
}

.btn-pdf:hover,
.btn-action-modal.btn-edit-m:hover,
.btn-mod.val:hover,
.btn-fast.val:hover {
    background: #DDFFDD;
}

/* Specific style only for the edit button */
.btn-mod.edit {
    background: #374151;
    /* gray-700 */
    color: #fff;
}

.btn-mod.edit:hover {
    background: #1f2937;
    /* gray-800 */
}

.btn-logout:hover {
    background: var(--danger);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(220, 38, 38, 0.18);
}

/* Restore btn-logout style */
.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 999px;
    background: #fff1f2;
    color: var(--danger);
    text-decoration: none;
    border: 1px solid #fecdd3;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(220, 38, 38, 0.08);
}

.tabs-nav,
.sub-nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(219, 227, 239, 0.9);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    width: fit-content;
}

.tab-btn,
.sub-nav-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: 999px;
    text-decoration: none;
    color: var(--muted);
    font-weight: 700;
    border: 1px solid transparent;
}

.tab-btn:hover,
.sub-nav-item:hover {
    color: var(--text);
    background: rgba(29, 78, 216, 0.06);
}

.tab-btn.active,
.sub-nav-item.active {
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: #fff;
    box-shadow: 0 12px 22px rgba(37, 99, 235, 0.22);
}

main {
    width: 100%;
}

.page-shell,
.form-card,
.wizard-shell,
.auth-panel,
.login-container,
.config-grid>.card,
.personnel-view>.card,
.inbox-container,
.table-responsive,
.history-table,
.planning-container,
.modal-content,
.card {
    background: var(--surface);
    border: 1px solid rgba(219, 227, 239, 0.85);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
}

.card,
.form-card,
.wizard-shell,
.login-container,
.auth-panel,
.page-shell,
.personnel-view,
.inbox-container {
    padding: 24px;
}

.page-hero,
.section-title,
.m-card-title,
.page-title,
.page-subtitle {
    color: var(--text);
}

.page-hero,
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.page-subtitle,
.welcome-user,
.m-creation-date,
.muted,
.text-muted {
    color: var(--muted);
}

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

input,
select,
textarea {
    width: 100% !important;
    padding: 12px 14px !important;
    border-radius: 12px !important;
    border: 1.5px solid var(--border) !important;
    background: #fff !important;
    color: var(--text) !important;
    box-shadow: none !important;
    outline: none !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease !important;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(29, 78, 216, 0.7) !important;
    background: #fff !important;
    box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.12) !important;
}

textarea {
    resize: vertical;
}

.form-group,
.field-group,
.info-item,
.m-info-group,
.list-item,
.recap-item {
    position: relative;
}

label,
.form-group label,
.field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
}

.grid-2,
.grid-3,
.config-grid,
.filters-grid,
.m-grid-info,
.info-grid {
    display: grid;
    gap: 18px;
}

.grid-2,
.m-grid-info,
.info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.config-grid {
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}

.btn,
.btn-submit,
.btn-action,
.btn-action-modal,
.btn-cancel,
.btn-cancel-custom,
.btn-pdf,
.btn-clear,
.btn-delete-task,
.btn-mod,
.btn-fast,
.nav-arrow,
.btn-reset-filter,
.role-btn,
.toggle-link,
.fab {
    text-decoration: none;
}

.btn-submit,
.btn-primary,
.btn-success,
.btn-action-modal.btn-edit-m,
.btn-mod.val,
.btn-mod.edit,
.btn-pdf,
.fab {
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: #fff;
    border: none;
}

.btn-submit,
.btn-primary,
.btn-success,
.btn-cancel,
.btn-cancel-custom,
.btn-action-modal,
.btn-action,
.btn,
.btn-mod,
.btn-fast,
.nav-arrow,
.btn-reset-filter,
.role-btn {
    cursor: pointer;
}

.btn-submit,
.btn-primary,
.btn-success {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 18px;
    border-radius: 14px;
    font-weight: 800;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.18);
}

.btn-submit:hover,
.btn-primary:hover,
.btn-success:hover,
.fab:hover,
.btn-action-modal.btn-edit-m:hover,
.btn-action-modal.btn-file-m:hover,
.btn-mod:hover,
.btn-pdf:hover,
.btn-clear:hover,
.btn-delete-task:hover,
.role-btn:hover,
.btn-cancel:hover,
.btn-cancel-custom:hover {
    transform: translateY(-1px);
}

.btn-cancel,
.btn-cancel-custom,
.btn-reset-filter,
.btn-file-m,
.btn-toggle,
.btn-action-modal.btn-file-m {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 700;
    background: #fff;
    color: var(--muted);
    border: 1px solid var(--border);
}

.btn-cancel:hover,
.btn-cancel-custom:hover,
.btn-reset-filter:hover,
.btn-file-m:hover,
.btn-toggle:hover {
    background: #f8fafc;
    color: var(--text);
    border-color: #cbd5e1;
}

.btn-danger,
.btn-clear,
.btn-delete-task,
.btn-mod.del {
    background: #fff1f2;
    color: var(--danger);
    border: 1px solid #fecdd3;
}

.btn-pdf,
.btn-action-modal.btn-edit-m,
.btn-mod.edit,
.btn-mod.val,
.btn-fast.val {
    background: #374151;
    /* gray-700 */
    color: #fff;
}

.btn-pdf:hover,
.btn-action-modal.btn-edit-m:hover,
.btn-mod.edit:hover,
.btn-mod.val:hover,
.btn-fast.val:hover {
    background: #1f2937;
    /* gray-800 */
}

/* Isolate .btn-fast.val: light gray default, very light green on hover */
.btn-fast.val {
    background: transparent;
    color: var(--text);
    border: 1px solid #e5e7eb;
}

.btn-fast.val:hover {
    background: #ecfdf5;
    /* green-50 */
    color: var(--text);
}

.btn-action-modal,
.btn-mod,
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 700;
    border: 1px solid transparent;
}

.btn-action-modal.btn-file-m,
.btn-file-m {
    background: #f8fafc;
    color: var(--text);
    border-color: var(--border);
}

.fab {
    position: fixed;
    right: 28px;
    bottom: 28px;
    width: 66px;
    height: 66px;
    border-radius: 50%;
    box-shadow: 0 18px 32px rgba(37, 99, 235, 0.28);
    z-index: 100;
    padding: 0;
    margin: 0;
    text-decoration: none;
}

.fab i {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 30px;
    line-height: 1;
    margin: 0;
    padding: 0;
}

/* Planning */
.planning-container {
    overflow-x: auto;
    border-radius: var(--radius-xl);
}

.toolbar-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    margin-bottom: 18px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(219, 227, 239, 0.9);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 12px;
    z-index: 80;
}

.toolbar-left,
.toolbar-right,
.toolbar-center {
    display: flex;
    align-items: center;
    gap: 14px;
}

.toolbar-left,
.toolbar-right {
    flex: 1;
}

.toolbar-right {
    justify-content: flex-end;
}

.toolbar-center {
    flex: 2;
    justify-content: center;
}

.tab-select-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
}

.tab-label {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.week-title-box {
    padding: 8px 14px;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid var(--border);
}

.week-range {
    color: var(--text);
    font-weight: 800;
}

.nav-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f8fafc;
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 900;
}

.nav-arrow:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-fullscreen {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 700;
}

.btn-fullscreen:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-reset-filter {
    color: var(--danger);
}

.btn-reset-filter:hover {
    color: #fff;
    background: var(--danger);
    border-color: var(--danger);
}

.planning-grid {
    display: grid;
    grid-template-columns: 80px repeat(5, minmax(180px, 1fr));
    min-width: 900px;
    gap: 1px;
    background: rgba(219, 227, 239, 0.8);
}

.grid-header,
.time-col,
.planning-grid>div {
    background: #fff;
}

.grid-header {
    padding: 16px;
    text-align: center;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.72rem;
    color: var(--muted);
    background: #f8fafc;
}

.time-col,
.time-slot {
    padding: 14px 12px;
    text-align: center;
    font-weight: 800;
    color: var(--muted);
    background: #f8fafc;
}

.grid-cell {
    min-height: 100px;
    padding: 10px;
    background: #fff;
}

.task-item {
    position: relative;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 8px;
    border: 1px solid rgba(219, 227, 239, 0.9);
    border-left-width: 5px;
    border-radius: 14px;
    background: linear-gradient(180deg, #fff 0%, #fbfdff 100%);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.task-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 28px rgba(15, 23, 42, 0.10);
}

.task-clickable-area {
    padding: 12px;
    cursor: pointer;
    flex: 1;
}

.task-fast-actions {
    display: flex;
    border-top: 1px solid rgba(219, 227, 239, 0.9);
    background: #f8fafc;
}

.btn-fast {
    flex: 1;
    padding: 8px 10px;
    text-align: center;
    text-decoration: none;
    font-size: 1rem;
    color: var(--muted);
}

.btn-fast:hover {
    background: rgba(29, 78, 216, 0.06);
}

.urgency-bar {
    position: absolute;
    inset: 0 auto 0 0;
    width: 6px;
}

.urgency-red {
    background: #dc2626;
}

.urgency-orange {
    background: #f59e0b;
}

.urgency-green {
    background: #16a34a;
}

.badge-essayage,
.badge-count,
.badge-new,
.badge,
.badge-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 999px;
    font-weight: 800;
}

.badge-essayage {
    padding: 3px 10px;
    background: #fce7f3;
    color: #be185d;
    font-size: 0.68rem;
    text-transform: uppercase;
}

.badge-count,
.badge-new {
    background: #ef4444;
    color: #fff;
    padding: 2px 8px;
    font-size: 0.72rem;
}

.motif-modification {
    display: block;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px dashed #dbe3ef;
    font-size: 0.72rem;
    font-style: italic;
    color: #7c3aed;
}

/* Modals */
.modal-global,
.modal-view {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    justify-content: center;
    align-items: center;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(10px);
}

.modal-content,
.modal-view-content {
    width: min(1000px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.m-header {
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: #fff;
    background: linear-gradient(135deg, #0f172a, #1d4ed8);
}

#toast-container {
    position: fixed;
    right: 20px;
    top: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

.toast {
    background: rgba(17, 24, 39, 0.95);
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.35);
    font-weight: 700;
    opacity: 1;
    transition: opacity 0.4s ease, transform 0.2s ease;
}

.toast.hide {
    opacity: 0;
    transform: translateY(-6px);
}

.m-tabs-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 14px 18px 0;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.m-tab-link,
.m-tab-btn {
    padding: 11px 16px;
    border-radius: 12px 12px 0 0;
    color: var(--muted);
    font-weight: 800;
    cursor: pointer;
    border: 1px solid transparent;
}

.m-tab-link.active,
.m-tab-btn.active {
    background: #fff;
    color: var(--primary);
    border-color: var(--border);
    border-bottom-color: #fff;
}

.m-body {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 18px;
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc;
}

/* Remove modal inner background so titles like "Historique des essayages" don't sit on a colored bar */
.modal-content .m-body {
    background: transparent;
    padding: 0 20px 20px 20px;
}

/* Clean modal section: remove background, border and card chrome for specific modal sections */
.modal-content .modal-clean-section {
    background: transparent !important;
    padding: 0 20px 0 20px;
}

.modal-content .modal-clean-section .m-card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0;
}

.modal-content .modal-clean-section .m-card .m-card-title {
    border-bottom: none !important;
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.modal-content .modal-clean-section .timeline-container {
    padding-left: 20px;
    border-left: none;
}

.m-body.layout-details {
    grid-template-columns: 1fr 320px;
}

.m-col-left {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.m-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.m-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #edf2f7;
    font-size: 0.76rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.m-info-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.m-label,
.info-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    font-weight: 800;
}

.m-value,
.info-value {
    color: var(--text);
    font-weight: 600;
}

.m-value.missing {
    color: #cbd5e1;
    font-style: italic;
}

.m-col-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

#modal-svg-container {
    width: 100%;
    min-height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#modal-svg-container svg {
    width: 100%;
    height: auto;
}

.tooth-active {
    fill: #1d4ed8 !important;
    stroke: #1e3a8a !important;
}

.m-dents-list {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 14px;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 999px;
    font-weight: 800;
    box-shadow: inset 0 0 0 1px rgba(29, 78, 216, 0.12);
}

.timeline-container {
    padding-left: 20px;
    border-left: 2px solid #dbe3ef;
}

.timeline-item {
    position: relative;
    margin-bottom: 16px;
    padding: 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -27px;
    top: 18px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid #fff;
}

.text-prewrap {
    white-space: pre-wrap;
}

.ml-auto {
    margin-left: auto;
}

.is-hidden {
    display: none !important;
}

.essayage-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--text);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
}

.essayage-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 0.72rem;
}

.essayage-grid {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #edf2f7;
}

.essayage-note {
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.85rem;
    font-style: italic;
}

.essayage-value-primary {
    color: var(--primary);
    font-weight: 800;
}

.essayage-value-success {
    color: var(--success);
    font-weight: 800;
}

.modal-actions {
    display: flex;
    gap: 10px;
}

.m-body-single {
    display: none;
    grid-template-columns: 1fr;
}

.empty-note {
    color: var(--muted);
    font-style: italic;
    font-size: 0.9rem;
}

.m-footer,
.modal-view-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid var(--border);
}

.m-footer>div,
.modal-view-footer>div {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Auth / login */
body.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px !important;
}

.auth-page .auth-shell,
.auth-page .login-container {
    width: min(1080px, 100%);
}

.auth-shell {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 24px;
    align-items: stretch;
}

.auth-hero,
.auth-panel {
    padding: 28px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(219, 227, 239, 0.9);
    box-shadow: var(--shadow-md);
}

.auth-hero {
    color: #fff;
    background: linear-gradient(160deg, #0f172a 0%, #1d4ed8 55%, #0f766e 100%);
    overflow: hidden;
    position: relative;
}

.auth-hero::after {
    content: "";
    position: absolute;
    inset: auto -40px -40px auto;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.10);
}

.auth-hero h1 {
    font-size: clamp(2rem, 3vw, 3rem);
    line-height: 1.05;
    margin-bottom: 14px;
}

.auth-hero p {
    max-width: 54ch;
    color: rgba(255, 255, 255, 0.86);
    font-size: 1rem;
}

.auth-panel {
    background: rgba(255, 255, 255, 0.92);
}

.login-container {
    max-width: none;
    margin: 0;
    text-align: left;
}

.role-selection {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0 20px;
}

.role-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 108px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #fff;
    color: var(--text);
    font-weight: 800;
    box-shadow: var(--shadow-sm);
}

.role-btn.active {
    background: linear-gradient(135deg, rgba(29, 78, 216, 0.12), rgba(15, 118, 110, 0.10));
    border-color: rgba(29, 78, 216, 0.35);
    color: var(--primary);
}

.form-section {
    display: none;
}

.toggle-link {
    display: inline-flex;
    margin-top: 16px;
    color: var(--primary);
    font-weight: 700;
}

.toggle-link:hover {
    color: var(--primary-hover);
}

.error,
.success,
.alert {
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 16px;
    font-weight: 700;
    border: 1px solid transparent;
}

.error {
    background: #fff1f2;
    color: #9f1239;
    border-color: #fecdd3;
}

.success,
.alert-success {
    background: #ecfdf5;
    color: #166534;
    border-color: #bbf7d0;
}

.loader {
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-right: 8px;
    vertical-align: middle;
    border: 3px solid rgba(22, 163, 74, 0.18);
    border-top-color: var(--success);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Tables & history */
.table-responsive,
.history-table {
    overflow: hidden;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th,
.history-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.history-table th,
table thead th {
    background: #f8fafc;
    color: var(--muted);
    font-weight: 800;
    text-align: left;
}

table tbody tr:hover {
    background: rgba(29, 78, 216, 0.035);
}

/* Personnel and dashboard helpers */
.list-item {
    padding: 12px 0;
    border-bottom: 1px solid #edf2f7;
}

.is-inactif,
.list-item[style*="opacity:0.5"],
.list-item[style*="opacity:0.6"] {
    opacity: 0.55;
}

.btn-add {
    background: var(--primary);
    color: #fff;
}

.btn-toggle {
    background: #f8fafc;
    color: var(--text);
}

.alert-danger {
    background: #fff1f2;
    color: #9f1239;
    border-color: #fecdd3;
}

.envelopes-wrapper {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding: 10px 0 20px;
}

.envelope-card {
    min-width: 220px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.envelope-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: #fff;
    font-weight: 800;
}

/* Teeth chart */
.tooth-chart {
    max-width: 520px;
    margin: 0 auto;
    padding: 18px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

.tooth {
    cursor: pointer;
    transition: transform 0.15s ease, fill 0.15s ease, stroke 0.15s ease;
    stroke: var(--primary);
    stroke-width: 1.5;
    fill: #fff;
}

.tooth:hover {
    fill: #dbeafe !important;
    transform: translateY(-1px);
}

.tooth.selected {
    fill: var(--primary) !important;
    stroke: #1e3a8a;
}

.tooth-label {
    font-family: inherit;
    font-size: 13px;
    fill: var(--muted);
    font-weight: 800;
    pointer-events: none;
    text-anchor: middle;
}

/* Wizard / create pages */
.wizard-shell,
.form-card {
    max-width: 960px;
    margin: 0 auto;
}

.step {
    display: none;
}

.step.active {
    display: block;
}

.step-indicator {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 24px;
    padding: 10px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.step-dot {
    position: relative;
    padding: 14px 12px 16px;
    text-align: center;
    border-radius: 14px;
    color: var(--muted);
    font-weight: 800;
    background: #fff;
}

.step-dot.active {
    color: var(--primary);
    box-shadow: inset 0 0 0 1px rgba(29, 78, 216, 0.15);
}

.step-dot.active::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 8px;
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary), #0f766e);
}

.recap-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 18px;
}

.recap-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid #edf2f7;
}

.back-arrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #f8fafc;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-weight: 700;
}

.back-arrow:hover {
    background: var(--primary);
    color: #fff;
    transform: translateX(-2px);
}

/* Misc */
.actions-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn-delete-task svg {
    width: 16px;
    height: 16px;
}

.text-center {
    text-align: center;
}

.empty-state {
    padding: 30px;
    text-align: center;
    color: var(--muted);
    background: #f8fafc;
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
}

.badge-status {
    padding: 4px 12px;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 0.8rem;
}

.notes-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 16px;
    border-radius: var(--radius-md);
}

/* Responsive */
@media (max-width: 1100px) {

    .auth-shell,
    .m-body,
    .m-body.layout-details {
        grid-template-columns: 1fr;
    }

    .m-col-right {
        order: -1;
    }
}

@media (max-width: 820px) {
    body {
        padding: 14px !important;
    }

    header,
    .site-header {
        padding: 16px;
        border-radius: var(--radius-lg);
    }

    .tabs-nav,
    .sub-nav {
        width: 100%;
    }

    .grid-2,
    .grid-3,
    .config-grid,
    .filters-grid,
    .m-grid-info,
    .info-grid,
    .step-indicator,
    .role-selection {
        grid-template-columns: 1fr;
    }

    .planning-grid {
        min-width: 760px;
    }

    .m-body {
        padding: 16px;
    }

    .card,
    .form-card,
    .wizard-shell,
    .login-container,
    .auth-panel,
    .page-shell,
    .personnel-view,
    .inbox-container {
        padding: 18px;
    }
}

@media (max-width: 640px) {
    .user-info {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .page-hero,
    .section-title,
    .m-footer,
    .modal-view-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-logout,
    .btn-submit,
    .btn-primary,
    .btn-success,
    .btn-cancel,
    .btn-action-modal,
    .btn-action,
    .btn-mod,
    .btn-pdf,
    .btn-clear {
        width: 100%;
        justify-content: center;
    }

    .m-header {
        padding: 16px 18px;
    }

    .m-tabs-nav {
        padding: 12px 14px 0;
    }
}

.envelope-body {
    padding: 10px;
}

/* Barre d'outils principale */
.planning-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    gap: 15px;
    flex-wrap: wrap;
}

/* Navigation Semaine */
.nav-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-nav {
    background: #f1f5f9;
    color: #1e293b;
    text-decoration: none;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: bold;
    transition: 0.2s;
}

.btn-nav:hover {
    background: #e2e8f0;
}

.week-display {
    text-align: center;
}

.week-title {
    display: block;
    font-weight: 800;
    color: #0f172a;
    font-size: 1rem;
}

.week-year {
    font-size: 0.75rem;
    color: #64748b;
}

/* Onglets de Tri Ergonomiques */
.sorting-tabs {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
}

.tab-item {
    text-decoration: none;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    border-radius: 8px;
    transition: 0.3s;
}

.tab-item.active {
    background: #fff;
    color: #3b82f6;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Filtres Dropdowns */
.filter-dropdowns {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-dropdowns select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    font-size: 0.85rem;
    outline: none;
}

.btn-reset {
    color: #ef4444;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.2rem;
}

/* Bouton Plein Écran */
.btn-fullscreen {
    background: #1e293b;
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.85rem;
    transition: 0.2s;
}

.btn-fullscreen:hover {
    background: #0f172a;
    transform: translateY(-1px);
}

/* Zone des Enveloppes */
.envelopes-container {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 10px 5px 25px 5px;
}

.envelope {
    min-width: 180px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.env-head {
    background: #3b82f6;
    color: #fff;
    padding: 6px 10px;
    font-size: 0.75rem;
    display: flex;
    justify-content: space-between;
    font-weight: bold;
}

.env-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.env-dentist {
    font-size: 0.7rem;
    color: #3b82f6;
    font-weight: bold;
}

.env-patient {
    font-size: 0.95rem;
    font-weight: 800;
    color: #1e293b;
}

.env-work {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 8px;
}

.env-footer {
    border-top: 1px solid #f1f5f9;
    padding-top: 8px;
    font-size: 0.75rem;
    font-weight: bold;
    color: #475569;
}


/* Container principal de la barre */
.toolbar-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
}

/* GAUCHE : Filtres */
.toolbar-left {
    display: flex;
    gap: 12px;
    flex: 1;
}

/* CENTRE : Navigation Semaine */
.toolbar-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex: 1;
}

.nav-arrow {
    text-decoration: none;
    color: #1e293b;
    font-weight: bold;
    font-size: 1.2rem;
    padding: 5px 10px;
    background: #f1f5f9;
    border-radius: 8px;
    transition: 0.2s;
}

.nav-arrow:hover {
    background: #e2e8f0;
}

.week-title-box {
    text-align: center;
}

.week-range {
    display: block;
    font-size: 1.1rem;
    font-weight: 800;
    color: #0f172a;
}

.week-year {
    font-size: 0.8rem;
    color: #64748b;
}

/* DROITE : Plein écran */
.toolbar-right {
    display: flex;
    justify-content: flex-end;
    flex: 1;
}

/* Classe personnalisée pour ton bouton */
.btn-fs-custom {
    background: #1e293b;
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-fs-custom:hover {
    background: #334155;
    box-shadow: 0 4px 10px rgba(30, 41, 59, 0.3);
}

/* Styles pour les sélecteurs de filtres */
.tab-select-container {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 4px 10px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
}

.tab-select-container.active {
    border-color: #3b82f6;
    background: #fff;
}

.tab-label {
    font-size: 0.65rem;
    font-weight: bold;
    color: #94a3b8;
    margin-bottom: -5px;
}

.tab-select-container select {
    border: none;
    background: transparent;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
    outline: none;
    cursor: pointer;
}

.btn-reset-filter {
    display: flex;
    align-items: center;
    color: #ef4444;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.2rem;
}

/* Bouton Quitter spécifique */
.btn-fs-custom.btn-exit {
    background: #ef4444;
    /* Rouge pour bien le distinguer */
    color: white;
}

.btn-fs-custom.btn-exit:hover {
    background: #dc2626;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
}

/* On s'assure que le bouton reste visible et stylé en plein écran */
#planning-board:fullscreen .btn-fs-custom {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}


/* --- Schéma Dentaire Interactif --- */
.tooth-chart {
    max-width: 450px;
    margin: 20px auto;
    background: #fff;
    border-radius: 15px;
    padding: 15px;

}

.tooth {
    cursor: pointer;
    transition: fill 0.2s, stroke 0.2s;
    stroke: #3b82f6;
    stroke-width: 1.5;
    fill: #ffffff;
}

.tooth:hover {
    fill: #dbeafe !important;
}

.tooth.selected {
    fill: #3b82f6 !important;
    /* Bleu JPC */
    stroke: #1e293b;
}

.tooth-label {
    font-family: sans-serif;
    font-size: 16px;
    fill: #1e293b;
    pointer-events: none;
    font-weight: bold;
}

.dmft-label {
    display: none;
    /* Cache les textes DFM superflus du SVG si besoin */
}