:root {
    --primary: #00A8E8;
    --primary-dark: #0077B6;
    --primary-light: #48CAE4;
    --accent-navy: #023E8A;
    --sidebar-bg: #0a0f1a;
    --sidebar-hover: #152238;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --sidebar-width: 260px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 28px 12px 24px;
    border-bottom: 1px solid rgba(0, 168, 232, 0.15);
    background: #000000;
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    padding: 0;
}

.logo-img {
    display: block;
    object-fit: contain;
}

.logo-img-sidebar {
    width: 100%;
    max-width: 228px;
    height: auto;
    min-height: 70px;
    margin: 0 auto;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.4);
    padding: 0 12px 8px;
    font-weight: 600;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,0.75);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    margin-bottom: 2px;
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: white;
}

.nav-link.active {
    background: var(--primary);
    color: white;
}

.nav-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: white;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.top-bar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.page-content {
    padding: 24px 32px;
}

/* Cards */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Grid layouts */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

@media (max-width: 1024px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn svg {
    width: 16px;
    height: 16px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 168, 232, 0.2);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
}

table.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    background: var(--bg);
}

table.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    vertical-align: middle;
}

table.data-table tr:hover td {
    background: #f8fafc;
}

table.data-table a {
    font-weight: 500;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.badge-primary {
    background: rgba(0, 168, 232, 0.15);
    color: var(--primary);
}

.table-link {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}

.table-link:hover {
    color: var(--primary);
}

.table-link-muted {
    color: var(--text-muted);
    text-decoration: none;
}

.table-link-muted:hover {
    color: var(--primary);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.form-check input {
    width: auto;
}

.contact-dossier-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 14px;
}

.contact-dossier-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.contact-dossier-list li:last-child {
    border-bottom: none;
}

.contact-delete-form {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.contact-type-badge.contact-type-interne {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
}

.contact-type-badge.contact-type-autre {
    background: rgba(148, 163, 184, 0.2);
    color: #64748b;
}

.contact-type-badge.contact-type-client {
    background: rgba(0, 168, 232, 0.12);
    color: var(--primary);
}

.btn-success {
    background: #22c55e;
    color: #fff;
}

.btn-success:hover {
    background: #16a34a;
    color: #fff;
}

.mail-preview-actions .mail-invite-btn-accept {
    background: #22c55e;
    color: #fff;
}

.mail-preview-actions .mail-invite-btn-accept:hover {
    background: #16a34a;
    color: #fff;
}

.mail-invite-response-form {
    display: inline-flex;
}

.mail-delete-form {
    display: inline-flex;
}

.mail-mark-unread-form {
    display: inline-flex;
}

.mail-invite-status {
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
}

.mail-invite-status-accepted {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

.mail-invite-status-declined {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.calendar-pending-item {
    border-left: 3px solid #f59e0b;
    padding-left: 12px;
}

/* Status pipeline */
.pipeline {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.pipeline-step {
    flex: 1;
    min-width: 100px;
    text-align: center;
    padding: 12px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    background: var(--bg);
    color: var(--text-muted);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
}

.pipeline-step.active {
    border-color: currentColor;
    background: white;
    box-shadow: var(--shadow);
}

.pipeline-step.completed {
    color: var(--success);
}

/* Mail */
.mail-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding: 16px 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.mail-toolbar-account {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mail-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 15px;
}

.mail-toolbar-name {
    font-weight: 600;
    font-size: 14px;
}

.mail-toolbar-email {
    font-size: 12px;
    color: var(--text-muted);
}

.mail-toolbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.mail-layout {
    display: grid;
    grid-template-columns: 240px 380px 1fr;
    gap: 0;
    height: calc(100vh - 200px);
    min-height: 500px;
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.mail-folders {
    border-right: 1px solid var(--border);
    padding: 0;
    overflow: hidden;
    background: #fafbfc;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.mail-folders-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    min-height: 0;
}

.mail-quota-footer {
    flex-shrink: 0;
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    background: #fff;
}

.mail-quota-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.mail-quota-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
}

.mail-quota-percent {
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
}

.mail-quota-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 8px;
}

.mail-quota-bar-fill {
    height: 100%;
    background: #00A8E8;
    border-radius: 999px;
    transition: width 0.3s ease;
}

.mail-quota-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
}

.mail-quota-text strong {
    font-size: 14px;
    color: #0f172a;
}

.mail-quota-alert {
    margin: 8px 0 0;
    font-size: 11px;
    line-height: 1.4;
    font-weight: 600;
}

.mail-quota-warning .mail-quota-bar-fill {
    background: #f59e0b;
}

.mail-quota-warning .mail-quota-percent,
.mail-quota-warning .mail-quota-text strong {
    color: #b45309;
}

.mail-quota-warning .mail-quota-alert-soft {
    color: #b45309;
}

.mail-quota-danger .mail-quota-bar-fill {
    background: #ef4444;
}

.mail-quota-danger .mail-quota-percent,
.mail-quota-danger .mail-quota-text strong {
    color: #dc2626;
}

.mail-quota-danger .mail-quota-alert {
    color: #dc2626;
}

.mail-quota-danger {
    background: #fef2f2;
}

.mail-folders-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 8px 12px 12px;
}

.mail-folder {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text);
    margin-bottom: 2px;
    text-decoration: none;
    transition: all 0.15s;
    border: 2px solid transparent;
    box-sizing: border-box;
}

.mail-folder:hover {
    background: white;
    box-shadow: var(--shadow);
}

.mail-folder.active {
    background: #fff;
    color: var(--primary);
    font-weight: 600;
    border-color: var(--primary);
    box-shadow: none;
}

.mail-folder.active:hover {
    background: #f0f9ff;
    box-shadow: none;
}

.mail-folder-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.mail-folder-icon svg {
    width: 18px;
    height: 18px;
}

.mail-folder-label {
    flex: 1;
    min-width: 0;
}

.mail-folder-counts {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    margin-left: 4px;
}

.mail-folder-count {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1;
    padding: 2px 0;
    min-width: 14px;
    text-align: right;
}

.mail-folder-unread-badge {
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 8px;
    min-width: 18px;
    text-align: center;
}

.mail-folder.active .mail-folder-count {
    color: rgba(0, 119, 182, 0.75);
}

.mail-folder.active .mail-folder-unread-badge {
    background: var(--primary);
    color: #fff;
}

.mail-folder-badge {
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.mail-folder.active .mail-folder-badge {
    background: var(--primary);
    color: white;
}

.mail-folder.mail-folder-drop-target {
    outline: 2px dashed var(--primary);
    outline-offset: -2px;
    background: #e8f6fc;
    box-shadow: var(--shadow);
}

.mail-folder.active.mail-folder-drop-target {
    outline: 2px dashed var(--primary-dark);
    outline-offset: 2px;
    background: #e8f6fc;
    color: var(--primary);
    border-color: var(--primary);
}

.mail-folder.mail-folder-drop-invalid {
    opacity: 0.45;
    cursor: not-allowed;
}

.mail-folder.mail-folder-drop-busy {
    opacity: 0.7;
    pointer-events: none;
}

.mail-archives-section {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.mail-archives-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.mail-archives-add {
    width: 26px;
    height: 26px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--primary);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.mail-archives-add:hover {
    background: #f0f9ff;
    border-color: #bae6fd;
}

.mail-archives-empty {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    padding: 4px 10px 8px;
    margin: 0;
}

.mail-archive-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
}

.mail-archive-row .mail-folder {
    flex: 1;
    min-width: 0;
}

.mail-archive-folder {
    position: relative;
    padding-left: 12px;
}

.mail-archive-folder::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--archive-color, #00A8E8);
    border-radius: 3px;
    pointer-events: none;
}

.mail-archive-folder.active::before {
    left: 2px;
    top: 2px;
    bottom: 2px;
}

.mail-archive-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--archive-color, #00A8E8);
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.8);
}

.mail-archive-edit {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.mail-archive-row:hover .mail-archive-edit {
    opacity: 1;
}

.mail-archive-edit:hover {
    background: #f1f5f9;
    color: var(--text);
}

.mail-archive-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.mail-archive-color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
    cursor: pointer;
    padding: 0;
    transition: transform 0.12s ease, border-color 0.12s ease;
}

.mail-archive-color-swatch:hover {
    transform: scale(1.05);
}

.mail-archive-color-swatch.active {
    border-color: #0f172a;
    transform: scale(1.08);
}

.mail-archive-custom-color {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.mail-archive-custom-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.mail-archive-custom-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mail-archive-color-picker {
    width: 48px;
    height: 36px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

.mail-archive-custom-value {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    font-family: ui-monospace, monospace;
}

.mail-archive-edit-footer {
    justify-content: space-between;
    align-items: center;
}

.mail-archive-edit-actions {
    display: flex;
    gap: 8px;
}

.mail-archive-dropdown {
    position: relative;
    display: inline-block;
}

.mail-archive-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 200px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 50;
}

.mail-archive-dropdown.open .mail-archive-menu {
    display: block;
}

.mail-archive-menu form {
    margin: 0;
}

.mail-archive-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    text-align: left;
}

.mail-archive-menu-item:hover {
    background: #f8fafc;
}

.mail-archive-menu-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mail-list {
    border-right: 1px solid var(--border);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.mail-list-header {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    background: #fafbfc;
}

.mail-list-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.mail-list-folder-name {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
}

.mail-list-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.mail-list-filters {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.mail-list-bulk {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.mail-list-select-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.mail-list-select-all input {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--primary);
}

.mail-list-bulk .btn-danger:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.mail-item-check-wrap {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding-top: 2px;
    cursor: pointer;
}

.mail-item-check-wrap input {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--primary);
}

.mail-item-link {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
    min-width: 0;
    text-decoration: none;
    color: inherit;
    position: relative;
}

.mail-item.is-selected {
    background: #f1f5f9;
}

.mail-item.is-selected.active {
    background: #e8f6fc;
}

.mail-list-filter {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    border: 1px solid transparent;
    line-height: 1.2;
}

.mail-list-filter:hover {
    color: var(--primary);
    background: #f0f9ff;
}

.mail-list-filter.active {
    color: var(--primary);
    background: #e8f6fc;
    border-color: #bae6fd;
}

.mail-list-filter-count {
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
    line-height: 1.2;
}

.mail-list-count {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.mail-list-empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.mail-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 14px 16px 14px 12px;
    border-bottom: 1px solid var(--border);
    color: inherit;
    transition: background 0.1s;
    position: relative;
}

.mail-item.mail-item-draggable {
    cursor: grab;
}

.mail-item.mail-item-dragging {
    opacity: 0.45;
    cursor: grabbing;
}

.mail-item:hover {
    background: #f8fafc;
}

.mail-item.active {
    background: #e8f6fc;
    border-left: 3px solid var(--primary);
}

.mail-item.unread {
    background: #e8f6fc;
}

.mail-item.unread .mail-item-from {
    font-weight: 700;
    color: var(--primary);
}

.mail-item.unread .mail-item-subject,
.mail-item.unread .mail-item-preview {
    font-weight: 700;
    color: var(--text);
}

.mail-item.unread .mail-item-preview {
    color: #334155;
}

.mail-item-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e2e8f0;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.mail-item-content {
    flex: 1;
    min-width: 0;
}

.mail-item-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
}

.mail-item-from {
    font-size: 13px;
    color: var(--primary);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mail-item-date {
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.mail-read-tick {
    color: #16a34a;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}

.mail-read-tick-lg {
    font-size: 18px;
    margin-left: 6px;
}

.mail-read-pending {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    flex-shrink: 0;
    vertical-align: middle;
}

.mail-read-pending-lg {
    width: 10px;
    height: 10px;
    margin-left: 6px;
}

.mail-item-subject-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin-bottom: 2px;
}

.mail-item-subject {
    font-size: 13px;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mail-item.has-attachment .mail-item-subject-row {
    margin-bottom: 4px;
}

.mail-attach-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #7dd3fc;
    line-height: 1.2;
}

.mail-attach-badge-lg {
    font-size: 11px;
    padding: 4px 10px;
    text-transform: none;
    font-weight: 600;
}

.mail-attach-svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.mail-attach-badge-lg .mail-attach-svg {
    width: 14px;
    height: 14px;
}

.mail-preview-subject-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px 12px;
    margin-bottom: 12px;
}

.mail-preview-subject-row .mail-preview-subject {
    margin: 0;
    flex: 1;
    min-width: 0;
}

.mail-item-preview {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mail-unread-dot {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}

.mail-preview {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: white;
}

.mail-preview-header {
    padding: 24px 28px 16px;
    border-bottom: 1px solid var(--border);
}

.mail-preview-subject {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.3;
}

.mail-preview-from-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.mail-preview-from-row strong {
    color: var(--primary);
}

.mail-preview-email {
    font-size: 13px;
    color: var(--text-muted);
}

.mail-preview-date {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.mail-preview-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.mail-calendar-invite {
    border: 1px solid #c7e8f7;
    border-radius: 12px;
    background: linear-gradient(135deg, #f0f9ff 0%, #fff 100%);
    overflow: hidden;
    margin: 0;
}

.mail-cal-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 20px 22px;
    border-bottom: 1px solid #dbeafe;
    background: rgba(0, 168, 232, 0.06);
}

.mail-cal-icon {
    font-size: 28px;
    line-height: 1;
}

.mail-cal-type {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #0284c7;
    margin-bottom: 4px;
}

.mail-cal-title {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.35;
}

.mail-cal-body {
    padding: 16px 22px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mail-cal-row {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 8px 16px;
    font-size: 14px;
    line-height: 1.5;
    color: #334155;
}

.mail-cal-label {
    font-weight: 600;
    color: #64748b;
    font-size: 13px;
}

.mail-cal-desc span:last-child {
    white-space: pre-wrap;
}

.mail-body-extra {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.mail-invite-section {
    margin-bottom: 18px;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    overflow: hidden;
}

.mail-invite-header {
    padding: 16px 18px;
    background: rgba(0, 168, 232, 0.05);
    border-bottom: 1px solid transparent;
}

.mail-invite-section:has(.mail-invite-toggle:checked) .mail-invite-header {
    border-bottom-color: #e2e8f0;
}

.mail-invite-toggle-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    margin-bottom: 0;
}

.mail-invite-toggle-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.mail-invite-toggle-box {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: 2px solid #94a3b8;
    border-radius: 6px;
    margin-top: 2px;
    background: #fff;
    position: relative;
    transition: all 0.15s ease;
}

.mail-invite-toggle:checked + .mail-invite-toggle-box {
    background: var(--primary);
    border-color: var(--primary);
}

.mail-invite-toggle:checked + .mail-invite-toggle-box::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 11px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.mail-invite-toggle-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mail-invite-toggle-text strong {
    font-size: 14px;
    color: #0f172a;
}

.mail-invite-toggle-text small {
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
}

.mail-invite-fields {
    padding: 18px;
}

.mail-invite-preview {
    position: relative;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    margin-bottom: 18px;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
}

.mail-invite-preview-accent {
    height: 3px;
    background: linear-gradient(90deg, #00A8E8, #0077b6);
}

.mail-invite-preview-body {
    padding: 16px 18px;
}

.mail-invite-preview-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #00A8E8;
    margin-bottom: 8px;
}

.mail-invite-preview-title {
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 14px;
    line-height: 1.35;
}

.mail-invite-preview-schedule {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.mail-invite-preview-datebox {
    flex-shrink: 0;
    width: 64px;
    text-align: center;
    padding-right: 14px;
    border-right: 1px solid #e2e8f0;
}

.mail-invite-preview-month {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.05em;
}

.mail-invite-preview-day {
    display: block;
    font-size: 30px;
    font-weight: 700;
    color: #00A8E8;
    line-height: 1.1;
}

.mail-invite-preview-when {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mail-invite-preview-dateline {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.mail-invite-preview-timeline {
    font-size: 13px;
    color: #64748b;
}

.mail-invite-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
}

.mail-invite-location {
    grid-column: 1 / -1;
}

.form-label-optional {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 12px;
}

@media (max-width: 640px) {
    .mail-invite-form-grid {
        grid-template-columns: 1fr;
    }
}

.calendar-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    align-items: start;
}

.calendar-card {
    padding: 0;
}

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.calendar-month-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border-top: 1px solid var(--border);
}

.calendar-weekday {
    background: #f8fafc;
    padding: 10px 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.calendar-day {
    background: #fff;
    min-height: 96px;
    padding: 8px;
    vertical-align: top;
}

.calendar-day-empty {
    background: #f8fafc;
}

.calendar-day-today {
    background: #f0f9ff;
}

.calendar-day-num {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 6px;
}

.calendar-day-today .calendar-day-num {
    color: #0284c7;
}

.calendar-event {
    font-size: 11px;
    line-height: 1.35;
    padding: 4px 6px;
    border-radius: 6px;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-event-link {
    display: block;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}

.calendar-event-link:hover {
    filter: brightness(0.95);
}

.calendar-event-link.is-selected {
    box-shadow: 0 0 0 2px #0284c7;
    font-weight: 600;
}

.calendar-event-sent {
    background: #dbeafe;
    color: #1d4ed8;
}

.calendar-event-received {
    background: #dcfce7;
    color: #166534;
}

.calendar-sidebar .card + .card {
    margin-top: 16px;
}

.calendar-upcoming {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.calendar-upcoming-item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.calendar-upcoming-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.calendar-upcoming-item.is-selected {
    background: #f0f9ff;
    border-radius: 8px;
    padding: 8px;
    margin: -8px;
    margin-bottom: 4px;
}

.calendar-upcoming-link {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 12px;
    flex: 1;
    text-decoration: none;
    color: inherit;
}

.calendar-upcoming-link:hover strong {
    color: var(--primary);
}

.calendar-upcoming-date {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
}

.calendar-upcoming-date span {
    display: block;
    font-weight: 500;
    color: #64748b;
    font-size: 12px;
}

.calendar-upcoming-body strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
}

.calendar-upcoming-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.calendar-upcoming-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.calendar-tag {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 10px;
}

.calendar-tag-sent {
    background: #dbeafe;
    color: #1d4ed8;
}

.calendar-tag-received {
    background: #dcfce7;
    color: #166534;
}

.calendar-empty {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0;
}

.calendar-delete-form {
    margin: 0;
}

.calendar-detail-card {
    margin-bottom: 16px;
}

.calendar-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.calendar-detail-header h3 {
    margin: 0;
    font-size: 15px;
}

.calendar-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.calendar-detail-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 16px;
    line-height: 1.35;
    color: var(--text);
}

.calendar-detail-schedule {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 16px;
}

.calendar-detail-datebox {
    text-align: center;
    min-width: 56px;
    padding-right: 14px;
    border-right: 1px solid var(--border);
}

.calendar-detail-month {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
}

.calendar-detail-day {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.1;
}

.calendar-detail-when {
    font-size: 14px;
    color: var(--text-muted);
}

.calendar-detail-when strong {
    display: block;
    color: var(--text);
    margin-bottom: 4px;
}

.calendar-detail-list {
    margin: 0;
}

.calendar-detail-row {
    margin-bottom: 12px;
}

.calendar-detail-row dt {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.calendar-detail-row dd {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.calendar-detail-description {
    white-space: pre-wrap;
}

.calendar-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.calendar-status-accepted {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.calendar-status-declined {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.calendar-status-pending {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

@media (max-width: 1024px) {
    .calendar-layout {
        grid-template-columns: 1fr;
    }
}

.mail-text-inline {
    white-space: pre-wrap;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    color: #475569;
    margin: 0;
    background: transparent;
    border: none;
    padding: 0;
}

.mail-preview-body {
    flex: 1;
    padding: 0;
    overflow: hidden;
    background: #ffffff;
}

.mail-iframe {
    width: 100%;
    height: 100%;
    min-height: 400px;
    border: none;
    display: block;
}

.mail-text-body {
    padding: 24px 28px;
    white-space: pre-wrap;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.7;
}

.mail-preview-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    padding: 48px;
}

.mail-preview-empty-icon {
    width: 64px;
    height: 64px;
    opacity: 0.25;
    margin-bottom: 16px;
}

.mail-preview-empty-icon svg {
    width: 64px;
    height: 64px;
}

.mail-attachments {
    padding: 16px 28px;
    border-top: 1px solid var(--border);
    background: #f0f9ff;
}

.mail-attachments-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #0369a1;
    margin-bottom: 12px;
}

.mail-attachments-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mail-attachment-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid #bae6fd;
    border-radius: 10px;
    text-decoration: none;
    color: #0f172a;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.mail-attachment-item:hover {
    background: #e0f2fe;
    border-color: #38bdf8;
    box-shadow: 0 2px 8px rgba(14, 116, 144, 0.12);
}

.mail-attachment-item:focus-visible {
    outline: 2px solid #0284c7;
    outline-offset: 2px;
}

.mail-attachment-icon {
    display: flex;
    color: #0284c7;
}

.mail-attachment-name {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    color: var(--text);
}

.mail-attachment-size {
    color: var(--text-muted);
    font-size: 12px;
    flex-shrink: 0;
}

.mail-signature-preview {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
}

.mail-signature-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.mail-signature-content {
    font-size: 13px;
    color: #64748b;
    line-height: 1.6;
}

.mail-signature-content a {
    color: #2563eb;
    text-decoration: none;
}

.mail-signature-content a:hover {
    text-decoration: underline;
}

.mail-signature-content img {
    display: block;
    max-width: 130px;
    width: 130px;
    height: auto;
    margin-top: 12px;
}

@media (max-width: 1024px) {
    .mail-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
    .mail-folders {
        flex-direction: column;
        flex-wrap: nowrap;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .mail-folders-scroll {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        padding: 8px;
    }
    .mail-folder {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }
    .mail-quota-footer {
        width: 100%;
    }
}

/* Dossier detail */
.dossier-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.dossier-ref {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.dossier-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 4px 0;
}

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.tab {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab:hover {
    color: var(--text);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Documents */
.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.doc-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    transition: box-shadow 0.15s;
}

.doc-card:hover {
    box-shadow: var(--shadow);
}

.doc-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    background: var(--bg);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.doc-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    word-break: break-word;
}

.doc-meta {
    font-size: 11px;
    color: var(--text-muted);
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-dot {
    position: absolute;
    left: -24px;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid white;
    box-shadow: var(--shadow);
}

.timeline-content {
    font-size: 14px;
}

.timeline-date {
    font-size: 12px;
    color: var(--text-muted);
}

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #0a0f1a 0%, #023E8A 45%, #00A8E8 100%);
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.logo-img-login {
    max-width: 260px;
    width: 100%;
    height: auto;
    margin: 0 auto 16px;
    object-fit: contain;
}

.login-step-title {
    font-size: 1.125rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
}

.login-step-desc {
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 20px;
}

.login-submit-btn {
    width: 100%;
    padding: 12px;
    margin-top: 4px;
}

.login-otp-input {
    text-align: center;
    font-size: 1.5rem;
    letter-spacing: 0.35em;
    font-weight: 600;
}

.login-back-link {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
}

.totp-setup {
    text-align: center;
}

.totp-qr {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    background: white;
}

.totp-secret-box {
    margin-top: 12px;
    font-size: 13px;
}

.totp-secret-box code {
    display: block;
    margin-top: 4px;
    padding: 8px;
    background: var(--bg);
    border-radius: 6px;
    font-size: 12px;
    word-break: break-all;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-mail-compose {
    max-width: 1040px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-mail-compose .mail-compose-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.modal-mail-compose .modal-header {
    padding: 14px 20px;
    flex-shrink: 0;
}

.modal-mail-compose .modal-body {
    padding: 14px 20px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.modal-mail-compose .form-group {
    margin-bottom: 10px;
}

.modal-mail-compose .form-label {
    margin-bottom: 4px;
    font-size: 12px;
}

.modal-mail-compose .form-control {
    padding: 8px 12px;
    font-size: 14px;
}

.mail-compose-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.mail-compose-recipients {
    margin-bottom: 4px;
}

.mail-compose-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.mail-compose-label-row .form-label {
    margin-bottom: 0;
}

.mail-compose-recipient-toggles {
    display: flex;
    gap: 4px;
}

.mail-cc-toggle {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 6px;
    line-height: 1.2;
}

.mail-cc-toggle:hover {
    background: #f0f9ff;
    border-color: var(--primary-light);
}

.mail-cc-toggle.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.mail-compose-send-options {
    margin: 0;
}

.mail-compose-options-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin-top: 4px;
    margin-bottom: 8px;
}

.mail-compose-opt-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    user-select: none;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    margin: 0;
    line-height: 1.3;
}

.mail-compose-opt-chip:hover {
    border-color: #cbd5e1;
    color: #475569;
}

.mail-compose-opt-chip input {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.mail-compose-opt-chip:has(input:checked) {
    border-color: #bae6fd;
    background: #f0f9ff;
    color: var(--primary);
}

.modal-mail-compose .mail-invite-toggle-label.mail-compose-opt-chip input[type="checkbox"] {
    position: static;
    opacity: 1;
    width: 14px;
    height: 14px;
}

.modal-mail-compose .mail-invite-section.mail-invite-compact {
    margin: 0;
    border: none;
    background: transparent;
    overflow: visible;
}

.modal-mail-compose .mail-invite-compact .mail-invite-header {
    padding: 0;
    background: none;
    border: none;
}

.modal-mail-compose .mail-invite-compact .mail-invite-toggle-label {
    margin: 0;
}

.modal-mail-compose .mail-invite-compact:has(.mail-invite-toggle:checked) {
    flex: 1 1 100%;
    width: 100%;
}

.modal-mail-compose .mail-invite-compact .mail-invite-fields {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.modal-mail-compose .mail-invite-compact .mail-invite-preview {
    padding: 10px 12px;
    margin-bottom: 8px;
}

.modal-mail-compose .mail-invite-compact .mail-invite-form-grid {
    gap: 8px;
}

.mail-compose-attachments {
    margin-bottom: 8px;
}

.mail-attachment-field-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.mail-compose-attach-hint {
    font-size: 11px;
    margin: 0;
}

.mail-attachment-field-inline .mail-attachment-list {
    flex: 1;
    min-width: 0;
}

.mail-compose-signature-collapse {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
}

.mail-compose-signature-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-size: 12px;
    color: #64748b;
}

.mail-compose-signature-toggle:hover {
    background: #f1f5f9;
}

.mail-compose-signature-toggle-title {
    font-weight: 600;
    color: #475569;
}

.mail-compose-signature-toggle-hint {
    font-size: 11px;
    color: var(--text-muted);
}

.mail-compose-signature-chevron {
    margin-left: auto;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.mail-compose-signature-toggle[aria-expanded="true"] .mail-compose-signature-chevron {
    transform: rotate(180deg);
}

.mail-compose-signature-panel {
    padding: 8px 12px 10px;
    border-top: 1px solid var(--border);
}

.mail-compose-signature-panel .mail-signature-content img {
    max-width: 100px;
    width: 100px;
}

.mail-compose-footer {
    display: flex;
    gap: 10px;
    padding: 12px 20px;
    flex-shrink: 0;
    background: #fff;
    border-top: 1px solid var(--border);
}

.mail-compose-footer .btn {
    flex: 1;
    justify-content: center;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 600;
    min-height: 44px;
}

.mail-compose-track-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
}

.mail-compose-track-label input {
    margin-top: 3px;
}

.mail-compose-editor {
    min-height: 200px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.modal-mail-compose .mail-compose-editor {
    min-height: 160px;
}

.mail-compose-editor .ql-toolbar {
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    background: #f8fafc;
    padding: 6px 8px;
}

.mail-compose-editor .ql-container {
    border: none;
    font-family: inherit;
    font-size: 14px;
    min-height: 120px;
}

.modal-mail-compose .mail-compose-editor .ql-container {
    min-height: 110px;
}

.mail-compose-editor .ql-editor {
    min-height: 110px;
    padding: 10px 12px;
}

.mail-attachment-field {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mail-attachment-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.mail-attachment-btn input[type="file"] {
    display: none;
}

.mail-attachment-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mail-attachment-list li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text);
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

@media (max-width: 768px) {
    .modal-mail-compose {
        max-width: 100%;
    }

    .mail-compose-grid {
        grid-template-columns: 1fr;
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.125rem;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.hidden { display: none !important; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.4;
}

/* Filters bar */
.filters-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filters-bar .form-control {
    width: auto;
    min-width: 160px;
}

/* Search */
.search-box {
    position: relative;
}

.search-box input {
    padding-left: 36px;
}

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mail-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .page-content {
        padding: 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Activity feed */
.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.activity-text {
    font-size: 13px;
    flex: 1;
}

.activity-time {
    font-size: 11px;
    color: var(--text-muted);
}

/* Kanban mini */
.kanban-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.kanban-col {
    background: var(--bg);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.kanban-col-count {
    font-size: 1.5rem;
    font-weight: 700;
}

.kanban-col-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

/* Todo list */
.nav-badge {
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: auto;
}

.nav-link.active .nav-badge {
    background: white;
    color: var(--primary);
}

.todo-notif-banner {
    background: linear-gradient(135deg, #e8f6fc 0%, #f0f9ff 100%);
    border: 1px solid rgba(0, 168, 232, 0.35);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 24px;
}

.todo-notif-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 15px;
}

.todo-notif-icon {
    font-size: 20px;
}

.todo-notif-list {
    margin-bottom: 16px;
}

.todo-notif-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 168, 232, 0.15);
}

.todo-notif-item:last-child {
    border-bottom: none;
}

.todo-notif-title {
    font-weight: 600;
    color: var(--text);
}

.todo-notif-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.todo-notif-actions {
    display: flex;
    gap: 8px;
}

.todo-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.todo-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--card);
    border: 1px solid var(--border);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.15s;
}

.todo-filter:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.todo-filter.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.todo-filter-count {
    background: rgba(0,0,0,0.08);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.todo-filter.active .todo-filter-count {
    background: rgba(255,255,255,0.25);
}

.todo-sync-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1200;
    background: #0f172a;
    color: #fff;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 14px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
    animation: todoSyncToastIn 0.25s ease;
}

@keyframes todoSyncToastIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.todo-list {
    padding: 8px 0;
}

.todo-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

.todo-item:hover {
    background: #f8fafc;
}

.todo-item.todo-done {
    opacity: 0.65;
}

.todo-item.todo-done .todo-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

.todo-check-form {
    flex-shrink: 0;
}

.todo-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 6px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: white;
    transition: all 0.15s;
    padding: 0;
}

.todo-checkbox:hover {
    border-color: var(--primary);
}

.todo-checkbox.checked {
    background: var(--primary);
    border-color: var(--primary);
}

.todo-content {
    flex: 1;
    min-width: 0;
}

.todo-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.todo-title {
    font-weight: 600;
    font-size: 15px;
}

.todo-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin: 4px 0 8px;
}

.todo-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
}

.todo-meta-muted {
    color: #94a3b8;
}

.todo-assignee {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: var(--text);
}

.todo-avatar-sm {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: white;
}

.todo-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* Mail toast notification */
#mail-notifier-root {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    pointer-events: none;
}

.mail-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: white;
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: var(--shadow-lg);
    max-width: 380px;
    animation: mailToastIn 0.35s ease;
}

@keyframes mailToastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.mail-toast-icon {
    font-size: 24px;
    line-height: 1;
}

.mail-toast-body {
    flex: 1;
    min-width: 0;
}

.mail-toast-body strong {
    display: block;
    font-size: 13px;
    color: var(--primary);
    margin-bottom: 4px;
}

.mail-toast-subject {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mail-toast-from {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.mail-toast-btn {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
    padding-top: 2px;
}

.mail-toast-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

/* Démarchage commercial */
.demarchage-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 20px;
}

.demarchage-list-select {
    min-width: 260px;
}

.demarchage-search {
    flex: 1;
    min-width: 200px;
    max-width: 360px;
}

.demarchage-stats {
    margin-bottom: 20px;
}

.demarchage-stat {
    text-decoration: none;
    color: inherit;
    border: 2px solid transparent;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.demarchage-stat:hover {
    border-color: var(--border);
}

.demarchage-stat.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 168, 232, 0.15);
}

.demarchage-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.demarchage-sub {
    font-size: 13px;
    color: var(--text-muted);
}

.demarchage-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.demarchage-coords {
    font-size: 13px;
    line-height: 1.6;
}

.demarchage-coords a {
    display: block;
}

.demarchage-lookup {
    font-size: 12px;
    line-height: 1.5;
}

.demarchage-lookup-label {
    display: block;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.demarchage-lookup-link {
    display: inline-block;
    margin-right: 8px;
    color: var(--primary);
    text-decoration: none;
}

.demarchage-lookup-link:hover {
    text-decoration: underline;
}

.demarchage-note-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 12px;
}

.demarchage-note-link:hover {
    text-decoration: underline;
}

.demarchage-note-text {
    font-size: 12px;
    color: var(--text-muted);
}

.demarchage-note-site {
    display: block;
    margin: 2px 0;
}

.demarchage-site-link {
    display: block;
    font-size: 13px;
    color: var(--primary);
}

.demarchage-info strong {
    font-size: 14px;
}

.demarchage-notes-cell {
    max-width: 180px;
    font-size: 13px;
    color: var(--text-muted);
}

.demarchage-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.demarchage-quick-form {
    display: inline-flex;
}

.demarchage-icon-btn {
    min-width: 34px;
    padding: 4px 8px;
}

.demarchage-convert-form {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.demarchage-badge {
    font-size: 11px;
}

.demarchage-table td {
    vertical-align: top;
}

@media (max-width: 1024px) {
    .demarchage-quick-actions {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Paramètres — journaux */
.settings-tabs {
    margin-bottom: 24px;
}

.settings-tabs .tab {
    text-decoration: none;
}

.settings-logs-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.settings-logs-subtitle {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--text-muted);
}

.settings-logs-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.settings-logs-clear-form {
    display: inline;
}

.settings-logs-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.settings-logs-meta {
    font-size: 13px;
    color: var(--text-muted);
}

.settings-logs-filter-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.settings-log-filter {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px solid var(--border);
}

.settings-log-filter:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.settings-log-filter.active {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

.settings-log-panel {
    background: #0f172a;
    color: #e2e8f0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.55;
    padding: 16px;
    border-radius: 12px;
    max-height: 520px;
    overflow: auto;
    border: 1px solid #1e293b;
}

.settings-log-line {
    padding: 2px 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.settings-log-line.is-smtp {
    color: #38bdf8;
}

.settings-log-line.is-send-debut {
    color: #7dd3fc;
    font-weight: 600;
}

.settings-log-line.is-send-ok {
    color: #4ade80;
}

.settings-log-line.is-send-echec {
    color: #fb923c;
    font-weight: 600;
}

.settings-log-line.is-send-pause {
    color: #94a3b8;
    font-style: italic;
}

.settings-log-line.is-send-retry {
    color: #fbbf24;
    font-style: italic;
}

.settings-log-line.is-imap {
    color: #a78bfa;
}

.settings-log-line.is-error {
    color: #f87171;
}

.settings-log-empty {
    padding: 40px 16px;
    text-align: center;
    color: var(--text-muted);
    background: var(--bg);
    border-radius: 12px;
    border: 1px dashed var(--border);
}

.settings-mail-send-table .mail-send-subject {
    max-width: 220px;
    font-weight: 500;
}

.settings-mail-send-table .mail-send-to {
    max-width: 200px;
    font-size: 13px;
}

.settings-mail-send-table .mail-send-error {
    max-width: 320px;
    font-size: 12px;
    color: #fb923c;
    word-break: break-word;
}

.settings-mail-send-table tr.mail-send-ok .mail-send-error {
    color: var(--text-muted);
}

.badge-success {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
}

.badge-warning {
    background: rgba(251, 146, 60, 0.15);
    color: #fb923c;
}

.badge-info {
    background: rgba(0, 168, 232, 0.15);
    color: #0284c7;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.badge-secondary {
    background: #f1f5f9;
    color: #64748b;
}

.badge-muted {
    background: #f8fafc;
    color: #94a3b8;
}

/* Devis */
.devis-page .devis-tabs {
    margin-bottom: 16px;
}

.devis-statut-filter {
    max-width: 200px;
}

.devis-actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.inline-form {
    display: inline;
}

.devis-fiche-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
    align-items: start;
}

.devis-fiche-layout--embedded {
    grid-template-columns: 1fr 240px;
}

.devis-fiche-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.devis-client-field[readonly] {
    background: #f8fafc;
    color: var(--text);
    cursor: default;
}

.devis-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 16px 0 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.devis-line-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.devis-line-toolbar-bottom {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary, #f8fafc);
}

.devis-lines-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.devis-autosave-status {
    font-size: 12px;
    color: var(--text-muted);
    min-height: 1.2em;
}

.devis-autosave-status.is-saving {
    color: var(--primary);
}

.devis-autosave-status.is-saved {
    color: var(--success, #16a34a);
}

.devis-autosave-status.is-error {
    color: var(--danger, #dc2626);
}

.devis-line-toolbar select {
    min-width: 220px;
}

.devis-lines-table .col-qty { width: 72px; }
.devis-lines-table .col-unit { width: 72px; }
.devis-lines-table .col-price { width: 100px; }
.devis-lines-table .col-total { width: 100px; text-align: right; font-weight: 600; }

.devis-lines-table .form-control-sm {
    padding: 6px 8px;
    font-size: 13px;
}

.devis-memoriser-label {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
}

.devis-line-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    white-space: nowrap;
}

.devis-memoriser-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.devis-memoriser-btn input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.devis-memoriser-btn.is-hidden {
    display: none;
}

.devis-memoriser-btn.is-active,
.devis-memoriser-btn:has(input:checked) {
    color: #ca8a04;
    border-color: #fde047;
    background: #fefce8;
}

.devis-total-label {
    text-align: right;
    font-weight: 700;
}

.devis-total-value {
    font-weight: 700;
    color: var(--primary);
    text-align: right;
}

.devis-fiche-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

.devis-legal-preview {
    font-size: 12px;
    line-height: 1.55;
    color: var(--text-muted);
}

.devis-legal-preview p {
    margin: 0 0 10px;
}

.devis-tva-mention {
    font-style: italic;
    color: var(--primary);
}

.devis-catalogue-quick {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.devis-catalogue-quick-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
    cursor: pointer;
    text-align: left;
    font-size: 12px;
}

.devis-catalogue-quick-btn:hover {
    border-color: var(--primary-light);
    background: #f0f9ff;
}

.devis-catalogue-quick-btn small {
    color: var(--text-muted);
}

@media (max-width: 1100px) {
    .devis-fiche-layout {
        grid-template-columns: 1fr;
    }
    .devis-fiche-aside {
        order: -1;
    }
}

.settings-logs-hint {
    margin-top: 12px;
}

.settings-log-type {
    background: #e0f2fe;
    color: #0369a1;
}
