:root {
    --primary: #2f6fed;
    --primary-dark: #1f4ec2;
    --secondary: #0f1e3d;
    --sidebar: #0b1220;
    --sidebar-muted: #8b98b1;
    --bg: #f6f8fb;
    --text: #1a2433;
    --muted: #6b778b;
    --white: #ffffff;
    --radius: 18px;
    --shadow: 0 16px 32px rgba(15, 23, 42, 0.12);
    --border: 1px solid rgba(15, 23, 42, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Inter", "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

.auth-page {
    background: radial-gradient(circle at top, rgba(47, 111, 237, 0.12), rgba(246, 248, 251, 1) 45%);
    min-height: 100vh;
}

.auth-wrapper {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1.5rem;
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(12, 27, 54, 0.08);
    width: min(420px, 90vw);
    display: grid;
    gap: 1.4rem;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.auth-brand h1 {
    font-size: 1.25rem;
    margin: 0;
}

.auth-brand p {
    color: var(--muted);
    margin: 0.2rem 0 0;
}

.auth-form {
    display: grid;
    gap: 1rem;
}

.auth-form label {
    display: grid;
    gap: 0.4rem;
    font-weight: 600;
    color: var(--secondary);
}

.auth-form input {
    padding: 0.8rem 0.9rem;
    border-radius: 12px;
    border: var(--border);
    font-size: 1rem;
    font-family: inherit;
    background: var(--white);
    color: var(--text);
}

.auth-error {
    color: #b71c4a;
    font-weight: 600;
}

.auth-info {
    color: var(--muted);
}

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 24px;
}

 .portal {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(300px, 360px) 1fr;
    gap: 0;
    align-items: stretch;
    align-content: start;
}

.portal.collapsed {
    grid-template-columns: 0 1fr;
}

.portal-sidebar {
    background: var(--sidebar);
    color: var(--white);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    padding: 1rem 1.6rem 1.8rem;
    display: grid;
    align-content: start;
    gap: 1.4rem;
    min-height: 100vh;
    height: 100%;
    transition: width 0.2s ease, padding 0.2s ease, opacity 0.2s ease;
}

.portal.collapsed .portal-sidebar {
    width: 0;
    padding: 0;
    border-right: none;
    opacity: 0;
    overflow: hidden;
}

.portal.collapsed .portal-sidebar * {
    pointer-events: none;
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.btn-close-sidebar {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.btn-close-sidebar:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-header p {
    color: var(--sidebar-muted);
    margin-top: 0.3rem;
    font-size: 0.92rem;
}

.sidebar-section h3 {
    margin-bottom: 0.8rem;
    color: var(--white);
    font-size: 1rem;
}

.portal-main {
    padding: 0.2rem 1.6rem 0.8rem;
    display: grid;
    gap: 0.2rem;
}

.portal-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    column-gap: 0.6rem;
    row-gap: 0.4rem;
    margin: 0;
    padding-bottom: 0;
}

.portal-header h1 {
    margin: 0;
    font-size: clamp(1.6rem, 2.5vw, 2rem);
    font-weight: 700;
}

.header-title {
    display: grid;
    gap: 0.15rem;
    justify-self: start;
}

.btn-toggle {
    align-self: start;
    width: fit-content;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 0.6rem;
    font-size: 0.85rem;
    border-radius: 8px;
}

.btn-toggle i {
    font-size: 1.2rem;
}

.month-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    width: fit-content;
    background: var(--white);
    border: var(--border);
    border-radius: 999px;
    padding: 0.15rem 0.25rem;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
    margin-top: -0.2rem;
    margin-bottom: -0.1rem;
    justify-self: end;
}

.month-label {
    font-weight: 600;
    color: var(--secondary);
    font-size: 0.85rem;
    padding: 0 0.25rem;
    text-align: center;
}

.portal-header p {
    color: var(--muted);
    margin: 0;
    font-size: 0.95rem;
}

.header-logo {
    height: 170px;
    width: auto;
    object-fit: contain;
    margin-top: 0;
    margin-bottom: -0.2rem;
    justify-self: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.2rem;
    color: inherit;
}

.logo-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.2);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1.4rem;
    border-radius: 8px; /* Professional Squircle */
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
    box-sizing: border-box;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 12px 24px rgba(47, 111, 237, 0.28);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 12px 24px rgba(47, 111, 237, 0.32);
}

.btn-outline {
    border: 1px solid var(--border);
    color: var(--text);
    background: var(--white);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: #f0f9ff;
}

.btn-ghost {
    color: var(--muted);
    background: transparent;
    border: 1px solid transparent;
}

.btn-ghost:hover {
    background: #f1f5f9;
    color: var(--text);
}

.sidebar-menu {
    display: grid;
    gap: 0.4rem;
}

.menu-item {
    color: var(--sidebar-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
}

.menu-item.active,
.menu-item:hover {
    background: var(--sidebar-active);
    color: var(--white);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.menu-item.active {
    font-weight: 600;
    border-left: 3px solid var(--accent);
}

.menu-item i {
    width: 20px;
    text-align: center;
    font-size: 1.1em;
}

.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--white);
    cursor: pointer;
    color: var(--muted);
    display: grid;
    place-items: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: #f0f9ff;
}

.dashboard-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: var(--border);
    margin-top: 1.5rem;
    display: grid;
    gap: 1.5rem;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.2rem;
}

.filter-field {
    display: grid;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary);
}

.filter-field input,
.filter-field select {
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    border: var(--border);
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
    transition: border-color 0.2s;
}

.filter-field input:focus,
.filter-field select:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--white);
}

.filters-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    padding-top: 0.5rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 1rem;
    margin-bottom: 0.5rem;
}

.section-header h2 {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 0.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.section-header p {
    color: var(--muted);
    font-size: 0.95rem;
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    border: var(--border);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card p {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-card h3 {
    font-size: 2rem;
    color: var(--primary);
    font-weight: 700;
    line-height: 1;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(14, 165, 233, 0.1);
    display: grid;
    place-items: center;
    color: var(--accent);
    font-size: 1.25rem;
}

.stat-card.alert {
    background: #fff1f2;
    border-color: #fecdd3;
}

.stat-card.alert .stat-icon {
    background: rgba(244, 63, 94, 0.2);
    color: #e11d48;
}

.stat-card.upcoming {
    background: #fffbeb;
    border-color: #fde68a;
}

.stat-card.upcoming .stat-icon {
    background: rgba(245, 158, 11, 0.2);
    color: #d97706;
}

.dossiers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.dossier-card {
    border-radius: 12px;
    border: var(--border);
    padding: 1.5rem;
    background: var(--white);
    display: grid;
    gap: 1.2rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
}

.dossier-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.dossier-card.alert {
    border-left: 4px solid #f43f5e;
}

.dossier-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.dossier-header h3 {
    font-size: 1.1rem;
    color: var(--primary);
    font-weight: 600;
}

.dossier-header p {
    color: var(--muted);
    font-size: 0.9rem;
}

.dossier-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    background: #f8fafc;
    padding: 1rem;
    border-radius: 8px;
}

.dossier-metrics small {
    color: var(--muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
}

.dossier-metrics strong {
    display: block;
    font-size: 1.1rem;
    color: var(--primary);
    margin-top: 0.25rem;
}

.dossier-pill {
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.dossier-pill.ok {
    background: rgba(14, 165, 233, 0.1);
    color: var(--accent);
}

.dossier-pill.danger {
    background: rgba(244, 63, 94, 0.1);
    color: #e11d48;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: 12px;
    border: var(--border);
    box-shadow: var(--shadow-sm);
}

.recap-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    min-width: 800px;
    background: var(--white);
}

.recap-table thead {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

.recap-table th,
.recap-table td {
    padding: 1rem 1.2rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

.recap-table th {
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.recap-table tbody tr:hover {
    background: #f8fafc;
}

.status-badge {
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.status-badge.todo {
    background: #f1f5f9;
    color: var(--muted);
}

.status-badge.progress {
    background: rgba(14, 165, 233, 0.15);
    color: var(--accent);
}

.status-badge.done {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

@media print {
    body {
        background: var(--white);
    }

    .portal {
        grid-template-columns: 1fr;
    }

    .portal-sidebar,
    .filters-actions,
    .filters-grid,
    .month-switcher,
    #toggleSidebar {
        display: none !important;
    }

    .dashboard-section {
        box-shadow: none;
        border: none;
        padding: 0.8rem 0;
    }

    .table-wrapper {
        border: none;
    }
}


.planning-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(12, 27, 54, 0.08);
}

.planning-form {
    display: grid;
    gap: 1rem;
}

.planning-form .field {
    display: grid;
    gap: 0.4rem;
}

.planning-form label {
    font-weight: 600;
    color: var(--white);
}

.planning-form input,
.planning-form select,
.planning-form textarea {
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    border: var(--border);
    font-size: 1rem;
    font-family: inherit;
    background: var(--white);
    color: var(--text);
}

.planning-form textarea {
    resize: vertical;
}

.planning-form .field-full {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

#cancelEdit {
    display: none;
}

#cancelEdit.visible {
    display: inline-flex;
}

.planning-stats {
    display: flex;
    gap: 1rem;
}

.stat {
    background: var(--bg);
    border-radius: 14px;
    padding: 0.6rem 0.9rem;
    text-align: center;
    min-width: 80px;
    border: var(--border);
}

.stat span {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--secondary);
    display: block;
}

.stat small {
    color: var(--muted);
}

.stat.alert {
    background: rgba(237, 76, 120, 0.12);
}

.stat.upcoming {
    background: rgba(255, 193, 7, 0.15);
}

.clients-panel {
    margin-top: 2rem;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    padding: 1rem;
}

.clients-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.8rem;
    color: var(--white);
}

.count-pill {
    background: rgba(255, 255, 255, 0.15);
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.85rem;
}

.clients-list {
    list-style: none;
    display: grid;
    gap: 0.6rem;
    color: var(--sidebar-muted);
}

.clients-list li {
    display: grid;
    gap: 0.2rem;
    background: rgba(255, 255, 255, 0.06);
    padding: 0.55rem 0.75rem;
    border-radius: 12px;
}

.clients-list small {
    font-size: 0.8rem;
}

.client-empty {
    color: var(--sidebar-muted);
}

.tasks-panel {
    margin-top: 1.5rem;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    padding: 1rem;
}

.items-list {
    list-style: none;
    display: grid;
    gap: 0.6rem;
    color: var(--white);
}

.item-row {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    align-items: center;
    background: rgba(255, 255, 255, 0.06);
    padding: 0.55rem 0.75rem;
    border-radius: 12px;
}

.item-row span {
    display: block;
    font-size: 0.8rem;
    color: var(--sidebar-muted);
}

.item-actions {
    display: flex;
    gap: 0.4rem;
}

.portal-sidebar .icon-btn {
    background: rgba(255, 255, 255, 0.14);
    color: var(--white);
}

.planning-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
}

.planning-filters input,
.planning-filters select {
    flex: 1 1 200px;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(12, 27, 54, 0.15);
}


.planning-table {
    background: var(--bg);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(12, 27, 54, 0.08);
}

.portal-table {
    box-shadow: var(--shadow);
}

.table-head,
.table-row {
    display: grid;
    grid-template-columns: 1.3fr 1.2fr 0.9fr 0.7fr 0.6fr;
    gap: 1rem;
    padding: 1rem 1.2rem;
    align-items: center;
}

.table-head {
    font-weight: 700;
    background: rgba(12, 27, 54, 0.05);
    color: var(--secondary);
}

.table-body {
    display: grid;
    gap: 0.2rem;
}

.table-row {
    background: var(--white);
    border-top: 1px solid rgba(12, 27, 54, 0.08);
}

.table-row .cell {
    display: grid;
    gap: 0.35rem;
}

.table-row .cell span,
.table-row .cell em {
    font-size: 0.9rem;
    color: var(--muted);
    font-style: normal;
}

.table-row .actions {
    display: flex;
    gap: 0.4rem;
}

.table-row .actions .btn {
    padding: 0.4rem 0.8rem;
}

.table-empty {
    padding: 2rem;
    text-align: center;
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.badge-danger {
    background: rgba(237, 76, 120, 0.18);
    color: #b71c4a;
}

.badge-warning {
    background: rgba(255, 193, 7, 0.2);
    color: #a77a00;
}

.badge-neutral {
    background: rgba(12, 27, 54, 0.08);
    color: var(--muted);
}

.status-pill {
    display: inline-flex;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: rgba(10, 164, 226, 0.12);
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 0.85rem;
}

.schedule-wrapper {
    background: var(--white);
    border-radius: 18px;
    box-shadow: var(--shadow);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: var(--border);
    margin-top: -0.2rem;
    margin-bottom: 0.2rem;
    background-image: linear-gradient(180deg, rgba(240, 245, 255, 0.6) 0%, rgba(255, 255, 255, 0) 30%);
}

.schedule-grid {
    min-width: 0;
    position: relative;
}

.schedule-row {
    display: grid;
    grid-template-columns: 200px repeat(31, minmax(30px, 1fr));
    align-items: stretch;
    width: 100%;
}

.schedule-head .schedule-row {
    background: linear-gradient(90deg, rgba(47, 111, 237, 0.08), rgba(47, 111, 237, 0.02));
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.schedule-cell {
    padding: 0.35rem 0.25rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    border-right: 1px solid rgba(15, 23, 42, 0.04);
    display: grid;
    gap: 0.25rem;
    justify-items: center;
    align-content: start;
    text-align: center;
    font-size: 0.8rem;
    min-width: 0;
    background: rgba(255, 255, 255, 0.92);
}

.head-cell {
    color: var(--secondary);
    font-size: 0.7rem;
    letter-spacing: 0.02em;
    background: rgba(47, 111, 237, 0.06);
}

.dossier-cell {
    justify-items: start;
    text-align: left;
    background: linear-gradient(180deg, rgba(47, 111, 237, 0.12), rgba(47, 111, 237, 0.02));
    position: sticky;
    left: 0;
    z-index: 1;
    font-size: 0.82rem;
}

.dossier-cell span {
    color: var(--muted);
    font-size: 0.75rem;
}

.month-cell {
    background: rgba(255, 255, 255, 0.9);
    min-height: 110px;
    justify-items: center;
    text-align: center;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0.3rem;
    box-sizing: border-box;
}

.cell-empty {
    color: var(--muted);
}

.cell-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.75rem;
    background: linear-gradient(135deg, rgba(47, 111, 237, 0.3), rgba(47, 111, 237, 0.08));
    color: var(--primary-dark);
}

.cell-icon.overdue {
    background: rgba(237, 76, 120, 0.2);
    color: #b71c4a;
}

.cell-icon.upcoming {
    background: rgba(255, 193, 7, 0.2);
    color: #a77a00;
}

.month-cell small {
    color: var(--muted);
    font-size: 0.64rem;
    width: 100%;
    text-align: center;
}

.event-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    align-items: center;
    justify-content: flex-start;
    box-sizing: border-box;
}

.event-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    width: calc(100% - 4px);
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 0.3rem 0.2rem;
    border-radius: 6px;
    border: 1px solid rgba(47, 111, 237, 0.18);
    background: linear-gradient(180deg, rgba(47, 111, 237, 0.1), rgba(255, 255, 255, 0.9));
    cursor: grab;
    font-size: 0.6rem;
    color: var(--secondary);
    text-align: center;
    white-space: nowrap;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.event-chip span {
    color: var(--muted);
    font-size: 0.56rem;
    display: block;
    text-align: center;
}

.event-chip:active {
    cursor: grabbing;
}

/* Styles pour les échéances standards natives */
.standard-row {
    background: linear-gradient(to right, rgba(52, 152, 219, 0.02), transparent);
    border-left: 3px solid #3498db;
}

.standard-header {
    background: linear-gradient(135deg, #f0f7ff 0%, #ffffff 100%) !important;
    border-left: 4px solid #3498db !important;
}

.standard-cell {
    background-color: rgba(52, 152, 219, 0.02) !important;
}

.standard-chip {
    cursor: help !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-weight: 600;
    font-size: 0.65rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    white-space: nowrap !important;
    text-overflow: ellipsis;
    overflow: hidden;
}

.standard-chip:hover {
    opacity: 1 !important;
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.cell-icon.standard {
    background: linear-gradient(135deg, #3498db, #2ecc71);
    color: white;
}

.month-cell.drag-over {
    outline: 2px dashed rgba(47, 111, 237, 0.6);
    outline-offset: -4px;
}

.event-dialog {
    border: none;
    border-radius: 16px;
    padding: 0;
    width: min(420px, 90vw);
    box-shadow: var(--shadow);
}

.event-dialog::backdrop {
    background: rgba(15, 23, 42, 0.4);
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid rgba(12, 27, 54, 0.08);
    background: #f7f9fc;
}

.dialog-body {
    padding: 1rem 1.2rem;
    display: grid;
    gap: 0.6rem;
    color: var(--text);
}

.dialog-body input[type="date"] {
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    border: 1px solid rgba(12, 27, 54, 0.15);
    font-family: inherit;
}

.dialog-body input,
.dialog-body select,
.dialog-body textarea {
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    border: 1px solid rgba(12, 27, 54, 0.15);
    font-family: inherit;
}

.dialog-body textarea {
    resize: vertical;
}

.dialog-label {
    font-weight: 600;
    color: var(--secondary);
}

.dialog-actions {
    padding: 0.9rem 1.2rem 1.2rem;
    display: flex;
    gap: 0.8rem;
    justify-content: flex-end;
}

.schedule-body .schedule-row:nth-child(odd) .schedule-cell {
    background: linear-gradient(180deg, rgba(248, 250, 255, 0.85), rgba(255, 255, 255, 0.95));
}

.schedule-body .schedule-cell:hover {
    background: rgba(47, 111, 237, 0.12) !important;
    box-shadow: inset 0 0 0 1px rgba(47, 111, 237, 0.35);
}

.event-chip:hover {
    border-color: rgba(47, 111, 237, 0.5);
    background: rgba(47, 111, 237, 0.14);
}

.schedule-body .schedule-row .month-cell.overdue {
    background: rgba(237, 76, 120, 0.08);
}

.schedule-body .schedule-row .month-cell.upcoming {
    background: rgba(255, 193, 7, 0.12);
}

.schedule-body .schedule-row .month-cell.done {
    background: rgba(10, 164, 226, 0.08);
}

.schedule-body .schedule-row .month-cell.pending {
    background: rgba(12, 27, 54, 0.03);
}


@media (max-width: 980px) {
    .portal {
        grid-template-columns: 1fr;
    }

    .portal-sidebar {
        border-right: none;
        border-bottom: 1px solid rgba(12, 27, 54, 0.1);
    }
    
    .portal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .header-title {
        width: 100%;
    }
    
    .month-switcher {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 720px) {
    .table-head,
    .table-row {
        grid-template-columns: 1fr;
    }
    
    /* Afficher le bouton X dans le sidebar sur mobile */
    .btn-close-sidebar {
        display: flex !important;
    }
    
    /* Masquer le bouton toggle dans le header sur mobile */
    .btn-toggle {
        display: none !important;
    }
    
    /* Sidebar en overlay sur mobile */
    .portal-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1000;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.3);
        transition: transform 0.3s ease;
    }
    
    .portal.collapsed .portal-sidebar {
        transform: translateX(-100%);
    }
    
    .portal-main {
        width: 100%;
    }
    
    /* Bouton hamburger dans le header visible quand sidebar est fermée */
    .portal.collapsed .btn-toggle {
        display: flex !important;
        min-width: 44px;
        min-height: 44px;
        padding: 0.6rem;
        background: var(--primary);
        color: var(--white);
        border: none;
        box-shadow: 0 4px 12px rgba(47, 111, 237, 0.3);
    }
    
    /* Calendrier scrollable horizontalement */
    .schedule-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        position: relative;
    }
    
    .schedule-row {
        min-width: max-content;
        display: grid;
        grid-template-columns: 150px repeat(31, minmax(60px, 1fr));
    }
    
    .schedule-cell {
        min-width: 60px;
        box-sizing: border-box;
    }
    
    .month-cell {
        position: relative;
        width: 100%;
        min-width: 60px;
        max-width: 60px;
        padding: 0.4rem 0.2rem;
        overflow: hidden;
        box-sizing: border-box;
    }
    
    .event-list {
        width: 100%;
        overflow: hidden;
        box-sizing: border-box;
    }
    
    .event-chip {
        width: 100%;
        max-width: 100%;
        font-size: 0.65rem;
        padding: 0.25rem 0.15rem;
        box-sizing: border-box;
    }
    
    /* Optimisation mobile pour le planning */
    .schedule-grid {
        gap: 0.5rem;
        font-size: 0.85rem;
        position: relative;
    }
    
    .month-cell {
        min-height: 60px;
        padding: 0.4rem;
    }
    
    .month-cell h4 {
        font-size: 0.75rem;
    }
    
    .event-chip {
        font-size: 0.7rem;
        padding: 0.3rem 0.5rem;
        margin-bottom: 0.3rem;
    }
    
    /* Sidebar responsive */
    .portal.collapsed .portal-sidebar {
        display: none;
    }
    
    .btn-toggle {
        display: flex !important;
        min-width: 44px;
        min-height: 44px;
        font-size: 1.2rem;
        background: var(--white);
        border: 1px solid rgba(15, 23, 42, 0.1);
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
    }
    
    .sidebar-header {
        padding: 1rem;
    }
    
    .brand {
        font-size: 1rem;
    }
    
    .menu-item {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
    
    /* Boutons mobile */
    .btn {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }
    
    .icon-btn {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
    
    /* Dialog mobile */
    .event-dialog {
        width: 95vw;
        max-width: 95vw;
        margin: 1rem;
    }
    
    .dialog-body {
        max-height: 60vh;
        overflow-y: auto;
    }
    
    /* Formulaires mobile */
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .field-full {
        grid-column: 1;
    }
    
    /* Cards mobile */
    .dashboard-cards {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-card h3 {
        font-size: 1.5rem;
    }
    
    /* Header mobile */
    .portal-header h1 {
        font-size: 1.25rem;
    }
    
    .portal-header p {
        font-size: 0.85rem;
    }
    
    /* Améliorer le touch sur mobile */
    .event-chip,
    .btn,
    .icon-btn,
    .menu-item {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
}

@media (max-width: 480px) {
    /* Très petits écrans */
    .auth-card {
        padding: 1.5rem;
    }
    
    .schedule-grid {
        gap: 0.4rem;
        font-size: 0.75rem;
    }
    
    .schedule-row {
        grid-template-columns: 120px repeat(31, minmax(50px, 1fr));
    }
    
    .schedule-cell {
        min-width: 50px;
    }
    
    .month-cell {
        min-height: 50px;
        min-width: 50px;
        max-width: 50px;
        padding: 0.3rem 0.15rem;
        overflow: hidden;
    }
    
    .month-cell h4 {
        font-size: 0.7rem;
    }
    
    .event-chip {
        font-size: 0.6rem;
        padding: 0.2rem 0.1rem;
        width: 100%;
    }
    
    .btn-toggle {
        padding: 0.5rem;
    }
    
    .month-switcher {
        gap: 0.5rem;
    }
    
    .month-label {
        font-size: 0.9rem;
    }
}

/* Optimisation pour mode paysage mobile */
@media (max-width: 920px) and (orientation: landscape) {
    /* Garder le comportement mobile en mode paysage */
    .btn-close-sidebar {
        display: flex !important;
    }
    
    .btn-toggle {
        display: none !important;
    }
    
    .portal-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 250px;
        z-index: 1000;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.3);
        transition: transform 0.3s ease;
    }
    
    .portal.collapsed .portal-sidebar {
        transform: translateX(-100%);
    }
    
    .portal.collapsed .btn-toggle {
        display: flex !important;
        min-width: 44px;
        min-height: 44px;
        padding: 0.6rem;
        background: var(--primary);
        color: var(--white);
        border: none;
        box-shadow: 0 4px 12px rgba(47, 111, 237, 0.3);
    }
    
    /* Header compact */
    .portal-header {
        padding: 0.5rem 1rem;
        flex-shrink: 0;
    }
    
    .header-title {
        gap: 0.5rem;
    }
    
    .header-title h1 {
        font-size: 1rem;
        margin: 0;
    }
    
    .header-title p {
        display: none;
    }
    
    /* Calendrier optimisé */
    .schedule-wrapper {
        max-height: calc(100vh - 90px);
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Réduire les hauteurs de cellules */
    .month-cell {
        min-height: 70px;
        padding: 0.3rem 0.2rem;
    }
    
    .schedule-cell {
        padding: 0.3rem;
        font-size: 0.85rem;
    }
    
    .event-chip {
        font-size: 0.7rem;
        padding: 0.25rem 0.2rem;
    }
    
    /* Month switcher compact */
    .month-switcher {
        transform: scale(0.9);
    }
    
    .month-label {
        font-size: 0.85rem;
    }
    
    /* Optimiser les colonnes */
    .schedule-row {
        grid-template-columns: 140px repeat(31, minmax(55px, 1fr));
    }
    
    .dossier-cell {
        font-size: 0.8rem;
        padding: 0.3rem;
    }
}

/* Forcer la stabilité du layout lors de la rotation */
.schedule-row {
    display: grid;
    grid-template-columns: 200px repeat(31, minmax(30px, 1fr));
    align-items: stretch;
    width: 100%;
}

@media (max-width: 720px) {
    .schedule-row {
        grid-template-columns: 150px repeat(31, minmax(60px, 1fr));
    }
}

@media (max-width: 480px) {
    .schedule-row {
        grid-template-columns: 120px repeat(31, minmax(50px, 1fr));
    }
}
