/* KPI Card */
.kpi-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: box-shadow var(--transition), transform var(--transition);
}

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

.kpi-title {
    color: var(--color-text-light);
    font-size: 0.875rem;
    font-weight: 500;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

.kpi-change {
    font-size: 0.75rem;
    color: var(--color-text-light);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
}

.btn-outline {
    background: transparent;
    border-color: var(--color-border);
    color: var(--color-text);
}

.btn-outline:hover {
    background: var(--color-bg);
}

/* Tables */
.table-container {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

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

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

th {
    background: var(--color-bg);
    font-weight: 600;
    color: var(--color-text-light);
    font-size: 0.875rem;
}

tr:hover {
    background: var(--color-bg);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-low { background: #e0f2fe; color: #0369a1; }
.badge-medium { background: #fef9c3; color: #854d0e; }
.badge-high { background: #fee2e2; color: #991b1b; }
.badge-critical { background: #fecaca; color: #7f1d1d; }

.badge-easy { background: #dcfce7; color: #166534; }
.badge-difficult { background: #ffedd5; color: #9a3412; }
.badge-very-difficult { background: #fee2e2; color: #991b1b; }

.badge-recurring { background: #ede9fe; color: #6d28d9; }

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 500;
    animation: slideIn 0.3s ease;
}

.toast-success { background: var(--color-success); }
.toast-error { background: var(--color-danger); }
.toast-info { background: var(--color-secondary); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast-out {
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

/* ================= Forms ================= */
.form-group {
    margin-bottom: 1rem;
    flex: 1;
    min-width: 0;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text);
}

.form-group input,
.form-group select,
.form-group textarea,
.filter-select,
.filter-search {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.filter-select:focus,
.filter-search:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

/* Profile picture picker */
.profile-pic-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.profile-pic-preview {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary-soft, #eef2ff);
    border: 1px solid var(--color-border);
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
}
.profile-pic-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.profile-pic-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}
.form-hint {
    font-size: 0.78rem;
    color: var(--color-text-light);
    margin-top: 0.25rem;
}

/* Access Control matrix (admin settings) */
.access-control-card {
    margin-top: 1rem;
}
.access-table-wrap {
    overflow-x: auto;
    margin: 0.75rem 0;
}
.access-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}
.access-table th,
.access-table td {
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--color-border);
    text-align: center;
    font-size: 0.85rem;
}
.access-table th {
    background: var(--color-bg);
    color: var(--color-text-light);
    font-weight: 600;
}
.access-table td.access-role {
    text-align: left;
    font-weight: 500;
}
.access-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    cursor: pointer;
}
.access-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Per-user access overrides (admin settings) */
.access-user-card {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}
.access-user-picker {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.75rem 0;
}
.access-user-picker label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-light);
}
.access-user-picker select {
    max-width: 320px;
}
.access-user-body {
    margin-top: 0.5rem;
}
.access-user-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.access-user-table {
    min-width: 420px;
    max-width: 560px;
}
.access-user-table th:first-child,
.access-table td.access-feature-label {
    text-align: left;
}
.access-feature-label {
    font-weight: 500;
}

/* Weekly reports */
.alert-info {
    background: var(--color-primary-soft, #eef2ff);
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.9rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}
.weekly-report-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-border);
}
.weekly-report-item:last-child { border-bottom: none; }
.weekly-report-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    flex-wrap: wrap;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.checkbox-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-size: 0.85rem;
    cursor: pointer;
}

/* ================= Page header & layout ================= */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    gap: 1rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.page-subtitle {
    color: var(--color-text-light);
    font-size: 0.9rem;
    margin-top: 0.15rem;
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.filter-select,
.filter-search {
    width: auto;
    min-width: 150px;
}

.filter-search {
    flex: 1;
    min-width: 180px;
    max-width: 320px;
}

/* ---------- Date-range filter (My Tasks / My Projects) ---------- */
/* Full-width row of its own inside .filter-bar: everything below wraps, so the
   control can never push the page wider than the viewport (no overflow-x hacks). */
.date-filter {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem 0.5rem;
    flex: 1 1 100%;
    min-width: 0;
}

.date-filter-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-light);
    min-width: 0;
}

.date-filter .filter-select {
    min-width: 0;
    max-width: 100%;
}

/* "Showing: Sep 1 – Sep 30, 2026" — always on its own line, wraps if needed. */
.date-filter-summary {
    flex: 1 1 100%;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-light);
    overflow-wrap: anywhere;
    min-width: 0;
}

.date-filter-custom {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem 0.5rem;
    min-width: 0;
}

.date-filter-custom input[type="date"] {
    min-width: 0;
    max-width: 100%;
}

.date-filter-error {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-danger);
    overflow-wrap: anywhere;
    min-width: 0;
}

.date-filter-error:empty {
    display: none;
}

.date-filter-undated {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--color-text-light);
    cursor: pointer;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* ---------- Social board filters ---------- */
/* The shared .date-filter normally claims a full row of its own and keeps its
   "Showing: …" caption on the same flex line as its controls, which makes its
   intrinsic width label + select + caption. On the Social board every filter
   control belongs on ONE line next to the account select, so the date filter is
   a block here: the "Date range" label and the select sit inline, the caption
   becomes a normal block underneath, and the element's width is only as wide as
   that inline row (never label + select + caption). Controls keep their natural
   width — the row wraps rather than squeezing a <select>, which would truncate
   its own option text. Below the desktop breakpoint the original wrapping
   behaviour is kept (touch-friendly). */
.social-filter-bar #boardFilters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

@media (min-width: 1024px) {
    /* Natural width: a squeezed <select> truncates its own option text. */
    .social-filter-bar .filter-select {
        flex: 0 0 auto;
    }

    /* Inline with the other selects instead of owning a full row. */
    .social-filter-bar .date-filter {
        display: block;
        flex: 0 0 auto;
        max-width: 100%;
    }

    .social-filter-bar .date-filter > .date-filter-label {
        display: inline-block;
        margin-right: 0.5rem;
        vertical-align: middle;
        white-space: nowrap;
    }

    .social-filter-bar .date-filter > .filter-select {
        vertical-align: middle;
    }

    /* The active range reads as a caption under the filter row. */
    .social-filter-bar .date-filter > .date-filter-summary,
    .social-filter-bar .date-filter > .date-filter-custom,
    .social-filter-bar .date-filter > .date-filter-error,
    .social-filter-bar .date-filter > .date-filter-undated {
        display: block;
        margin-top: 0.25rem;
    }

    .social-filter-bar .date-filter > .date-filter-custom > .date-filter-label {
        margin-right: 0.35rem;
    }

    .social-filter-bar .date-filter > .date-filter-custom > input[type="date"] {
        margin-right: 0.6rem;
        vertical-align: middle;
    }
}

.view-toggle {
    display: inline-flex;
    gap: 0.25rem;    background: var(--color-bg);
    padding: 0.25rem;
    border-radius: var(--radius-sm);
}

.view-toggle .btn.active {
    background: var(--color-primary);
    color: white;
}

/* ================= Cards & panels ================= */
.panel-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.panel-card h3 {
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.chart-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.chart-card h3 {
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

/* Make dashboard chart canvases fill the card and keep a stable height.
   Without this, canvases render at their tiny HTML-default width (~300px),
   which is why bar labels got clipped/overlapped.
   (No !important: hBarChart sets its own dynamic inline height for
   workload/performance charts, and inline styles win over this.) */
.chart-card canvas {
    width: 100%;
    height: 220px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.kpi-card-clickable {
    cursor: pointer;
}

.kpi-icon {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--color-text-light);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* ================= Insights ================= */
.insights-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.insight-card {
    border-radius: var(--radius-md);
    padding: 0.9rem 1rem;
    border-left: 4px solid var(--color-secondary);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.insight-warning { border-left-color: var(--color-warning); }
.insight-danger { border-left-color: var(--color-danger); }
.insight-success { border-left-color: var(--color-success); }
.insight-info { border-left-color: var(--color-secondary); }

.insight-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.insight-detail {
    color: var(--color-text-light);
    font-size: 0.8rem;
    margin-top: 0.2rem;
}

/* ================= Activity ================= */
.activity-row {
    display: flex;
    gap: 0.6rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

.activity-row:last-child { border-bottom: none; }

.activity-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.activity-body { flex: 1; }

.activity-text {
    font-size: 0.85rem;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--color-text-light);
}

/* ================= Task cards ================= */
.task-card-by {
    font-size: 0.72rem;
    color: var(--color-text-light);
    margin-bottom: 0.35rem;
}

.project-task-section {
    margin: 1.25rem 0 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-light);
}

.project-task-group-label {
    margin: 1rem 0 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.task-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    cursor: pointer;
    transition: box-shadow var(--transition), transform var(--transition);
}

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

.task-card-top {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.task-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.task-card-desc {
    color: var(--color-text-light);
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.task-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--color-text-light);
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}

.task-card-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.task-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.task-card-actions {
    display: flex;
    gap: 0.25rem;
}

.icon-btn-sm {
    background: none;
    border: none;
    font-size: 0.9rem;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
}

.icon-btn-sm:hover {
    background: var(--color-bg);
}

/* Progress bars */
.progress-track {
    flex: 1;
    height: 10px;
    background: var(--color-bg);
    border-radius: 999px;
    overflow: hidden;
    min-width: 60px;
}

.progress-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 999px;
    transition: width 0.4s ease;
}

.progress-fill.status-not-started { background: #94a3b8; }
.progress-fill.status-in-progress { background: #0ea5e9; }
.progress-fill.status-under-review { background: #f59e0b; }
.progress-fill.status-completed { background: #10b981; }
.progress-fill.status-on-hold { background: #f97316; }

/* Progress slider row (used inside the edit task modal) */
.progress-slider-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.progress-slider-row .progress-slider {
    flex: 1;
    width: auto;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.progress-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text);
    min-width: 38px;
    text-align: right;
}

/* Status pills (task status, e.g. .status-text.status-completed) */
.status-text {
    display: inline-flex;
    align-items: center;
    font-size: 0.78rem;
    font-weight: 500;
}

.status-text.status-not-started,
.status-text.status-in-progress,
.status-text.status-under-review,
.status-text.status-completed,
.status-text.status-on-hold {
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    white-space: nowrap;
}

.status-text.status-not-started { background: #e2e8f0; color: #334155; }
.status-text.status-in-progress { background: #e0f2fe; color: #0369a1; }
.status-text.status-under-review { background: #fef3c7; color: #92400e; }
.status-text.status-completed { background: #dcfce7; color: #15803d; }
.status-text.status-on-hold { background: #ffedd5; color: #c2410c; }
.status-text.status-cancelled { background: #fee2e2; color: #b91c1c; }

/* Project status pills (.badge.project-status.status-active) */
.project-status.status-planning { background: #f1f5f9; color: #475569; }
.project-status.status-active { background: #e0f2fe; color: #0369a1; }
.project-status.status-on-hold { background: #ffedd5; color: #c2410c; }
.project-status.status-completed { background: #dcfce7; color: #15803d; }
.project-status.status-cancelled { background: #fee2e2; color: #b91c1c; }

/* KPI status pills (.badge.kpi-status.status-<slug>) */
.badge.kpi-status.status-active { background: #e0f2fe; color: #0369a1; }
.badge.kpi-status.status-on-track { background: #dcfce7; color: #15803d; }
.badge.kpi-status.status-at-risk { background: #fef3c7; color: #92400e; }
.badge.kpi-status.status-off-track { background: #fee2e2; color: #b91c1c; }
.badge.kpi-status.status-completed { background: #e0e7ff; color: #4338ca; }
.badge.kpi-status.status-cancelled { background: #f1f5f9; color: #64748b; }

/* Status dots (kanban / task) */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.status-dot.status-not-started { background: #94a3b8; }
.status-dot.status-in-progress { background: #0ea5e9; }
.status-dot.status-under-review { background: #f59e0b; }
.status-dot.status-completed { background: #10b981; }
.status-dot.status-on-hold { background: #f97316; }
.status-dot.status-cancelled { background: #ef4444; }

/* Social media status dots */
.status-dot.status-draft { background: #94a3b8; }
.status-dot.status-scheduled { background: #0ea5e9; }
.status-dot.status-approved { background: #10b981; }
.status-dot.status-published { background: #6366f1; }
.status-dot.status-rejected { background: #ef4444; }
.status-completed { color: var(--color-success); }

/* ================= Kanban ================= */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.kanban-column {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    min-height: 200px;
}

.kanban-column-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.kanban-count {
    margin-left: auto;
    background: var(--color-surface);
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    font-size: 0.75rem;
    color: var(--color-text-light);
}

.kanban-column-body {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.kanban-empty {
    text-align: center;
    color: var(--color-text-light);
    font-size: 0.8rem;
    padding: 1rem;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
}

/* ================= Calendar ================= */
.calendar-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.calendar-title {
    font-size: 1.2rem;
    flex: 1;
    text-align: center;
}

.calendar-grid {
    display: grid;
    /* minmax(0, 1fr): columns shrink with the available width instead of being
       held open by the nowrap event chips (prevents page-level overflow and
       cells sliding under the Day Details drawer). */
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 1px;
    background: var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 1.25rem;
}

.calendar-day-header {
    background: var(--color-bg);
    padding: 0.5rem;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-light);
}

.calendar-cell {
    background: var(--color-surface);
    /* Fixed height: the row never grows, no matter how much a day holds.
       Extra content is clipped and surfaced through "+N more" / the Day panel. */
    height: 140px;
    overflow: hidden;
    padding: 0.35rem;
    position: relative;
    cursor: pointer;
    /* Grid items default to min-width:auto, which would keep a column wider
       than its track; allow real shrinking. */
    min-width: 0;
}

.calendar-cell.empty { background: var(--color-bg); cursor: default; }

.calendar-cell.today {
    background: #eef2ff;
}

/* Day currently open in the Day Details panel */
.calendar-cell.selected {
    box-shadow: inset 0 0 0 2px var(--color-primary);
}

.calendar-day-num {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-bottom: 0.3rem;
}

.calendar-cell.today .calendar-day-num {
    color: var(--color-primary);
    font-weight: 700;
}

/* Per-day task summary inside a calendar cell: "8 Active Tasks • 3 Due".
   Built on the existing typography scale + colour variables (theme aware). */
.calendar-task-summary {
    margin-bottom: 0.3rem;
    font-size: 0.7rem;
    line-height: 1.25;
    white-space: normal;
}

.cal-task-active {
    font-weight: 600;
    color: var(--color-text);
}

.cal-task-sep {
    color: var(--color-text-light);
    font-weight: 600;
    margin: 0 1px;
}

/* "Due" uses the app's danger tone so it stands out from Active Tasks. */
.cal-task-due {
    font-weight: 700;
    color: var(--color-danger);
    background: color-mix(in srgb, var(--color-danger) 14%, transparent);
    border-radius: 4px;
    padding: 0 4px;
    white-space: nowrap;
}

/* Line break between the two counts — only rendered as a break on narrow
   columns, where the summary would otherwise wrap into extra lines. */
.cal-summary-br { display: none; }

@media (max-width: 1200px) {
    .cal-summary-br { display: inline; }
    .calendar-cell { height: 156px; }
}

/* Split layout: the drawer narrows the columns, so the summary is set a little
   smaller (and the line break above applies where needed) — the content still
   fits the unchanged fixed cell height. */
.page-container.calendar-panel-open .calendar-task-summary {
    font-size: 0.62rem;
    line-height: 1.2;
}

@media (max-width: 1200px) {
    .page-container.calendar-panel-open .cal-summary-br { display: inline; }
}

/* The "+N more" affordance opens the Day Details panel. */
.event-more { cursor: pointer; font-weight: 600; }
.event-more:hover { text-decoration: underline; }

/* ===== Day Details panel (right-side drawer) =====
   On wide screens the calendar page reserves the drawer's width
   (.calendar-panel-open below) so the grid narrows instead of being covered —
   every date stays clickable. Below 1024px the drawer takes the full width.
   Reuses the app's surface/border/shadow tokens and sits above the header but
   below the sidebar drawer (100), modals (200) and toasts (300). */
.day-panel {
    position: fixed;
    top: var(--header-height);
    right: 0;
    bottom: 0;
    width: 390px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--color-surface);
    border-left: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    z-index: 95;
}

/* Narrow screens: the drawer replaces the calendar view (no half-covered grid) */
@media (max-width: 1023px) {
    .day-panel {
        left: 0;
        width: auto;
        border-left: none;
    }
}

/* Wide screens: reserve the drawer's space (390px + gap) so nothing is covered */
@media (min-width: 1024px) {
    .page-container.calendar-panel-open {
        padding-right: 402px;
    }
}

.day-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.day-panel-date {
    font-size: 1rem;
    line-height: 1.3;
}

.day-panel-sub {
    font-size: 0.72rem;
    color: var(--color-text-light);
    margin-top: 0.15rem;
}

.day-panel-close {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-light);
    font-size: 0.8rem;
    line-height: 1;
    padding: 0.35rem 0.45rem;
    cursor: pointer;
    flex-shrink: 0;
}

.day-panel-close:hover {
    color: var(--color-text);
    border-color: var(--color-primary);
}

/* Independently scrollable content */
.day-panel-body {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
    -webkit-overflow-scrolling: touch;
}

.day-panel-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1.1rem;
}

.day-stat {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.6rem;
    min-width: 0;
}

.day-stat-value {
    display: block;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--color-text);
}

.day-stat-label {
    display: block;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--color-text-light);
    margin-top: 0.15rem;
}

.day-stat.is-active { border-left-color: var(--color-primary); }
.day-stat.is-due { border-left-color: var(--color-warning); }
.day-stat.is-completed { border-left-color: var(--color-success); }
.day-stat.is-overdue { border-left-color: var(--color-danger); }
.day-stat.is-active-project { border-left-color: var(--color-secondary); }
.day-stat.is-active-training { border-left-color: var(--color-success); }

/* Second row: projects / trainings running on this day (only when present). */
.day-panel-stats-running { margin-top: -0.6rem; }

.day-section { margin-bottom: 1.1rem; }

.day-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-light);
    margin-bottom: 0.45rem;
}

.day-section-count { color: var(--color-text); }

.day-item {
    display: block;
    width: 100%;
    text-align: left;
    font: inherit;
    color: inherit;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.55rem;
    margin-bottom: 0.4rem;
    cursor: pointer;
}

.day-item:hover { border-color: var(--color-primary); }

.day-item-title {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
    overflow-wrap: anywhere;
}

.day-item-meta {
    display: block;
    font-size: 0.72rem;
    color: var(--color-text-light);
    margin-top: 0.15rem;
}

.day-item-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.35rem;
}

/* Keep the shared status pills compact inside the panel */
.day-item .status-text.status-not-started,
.day-item .status-text.status-in-progress,
.day-item .status-text.status-under-review,
.day-item .status-text.status-completed,
.day-item .status-text.status-on-hold,
.day-item .status-text.status-cancelled,
.day-item .badge {
    font-size: 0.68rem;
    padding: 0.15rem 0.45rem;
}

.day-item-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-danger) 16%, transparent);
    color: var(--color-danger);
    white-space: nowrap;
}

/* Section accents mirror the calendar legend colours */
.day-section[data-section="tasks"] .day-item { border-left-color: var(--color-success); }
.day-section[data-section="projects"] .day-item { border-left-color: #6366f1; }
.day-section[data-section="trainings"] .day-item { border-left-color: #10b981; }
.day-section[data-section="meetings"] .day-item { border-left-color: var(--color-primary); }
.day-section[data-section="deadlines"] .day-item { border-left-color: var(--color-danger); }
.day-section[data-section="leaves"] .day-item { border-left-color: var(--color-warning); }
.day-section[data-section="other"] .day-item { border-left-color: var(--color-secondary); }

.day-section-more {
    background: none;
    border: none;
    padding: 0.15rem 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-primary);
    cursor: pointer;
}

.day-section-more:hover { text-decoration: underline; }

.day-panel-empty { padding: 1rem 0; }

.event-chip {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 2px;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: white;
}

/* Real social-media brand icons (inline SVG). */
.platform-icon {
    display: inline-block;
    vertical-align: -2px;
    margin-right: 4px;
    flex-shrink: 0;
    pointer-events: none;
}

/* "+N" overflow badge when a content item has more platforms than shown. */
.platform-extra {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-light);
}

/* "+N" overflow indicator inside media-calendar chips / upcoming rows. */
.platform-more {
    opacity: 0.85;
    margin-left: 3px;
    font-weight: 600;
}

/* Title inside a media-calendar chip (keeps icon + title on one truncated line). */
.social-chip-title {
    display: inline-block;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100% - 18px);
}

/* Account banner shown at the TOP of a social content card (highlighted). */
.social-card-account {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 4px 10px;
    margin: -1rem -1rem 0.75rem -1rem;
    border-radius: calc(var(--radius-md) - 1px) calc(var(--radius-md) - 1px) 0 0;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Small color dot next to an account name in the manage modal. */
.account-color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: -1px;
    border: 1px solid rgba(0, 0, 0, 0.12);
}

/* Rows inside the Manage Accounts & Platforms modal. */
.manage-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 6px;
    background: #f8fafc;
}
.manage-row .icon-btn-sm {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
}
.manage-actions {
    display: inline-flex;
    gap: 4px;
}

.event-meeting { background: var(--color-primary); }
.event-deadline { background: var(--color-danger); }
.event-task { background: var(--color-success); }
.event-leave { background: var(--color-warning); }
.event-other { background: var(--color-secondary); }

.event-more {
    font-size: 0.7rem;
    color: var(--color-primary);
}

.upcoming-event {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
}

.upcoming-event:last-child { border-bottom: none; }

.upcoming-event-info { flex: 1; }

.upcoming-event-title {
    font-weight: 500;
    font-size: 0.9rem;
}

.upcoming-event-date {
    font-size: 0.75rem;
    color: var(--color-text-light);
}

/* ================= Tabs ================= */
.tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 1.25rem;
}

.tab {
    padding: 0.6rem 1rem;
    font-weight: 500;
    color: var(--color-text-light);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color var(--transition), border-color var(--transition);
}

.tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* ---------- Team member management (account states + scheduled deletion) ---------- */
/* Admin-only surface: Auth accounts that have no TeamFlow profile yet, and the
   account state on every card (Active / Inactive / Scheduled for Deletion).
   Long values wrap (never `nowrap`) so mobile never overflows horizontally. */

/* Profiles whose Supabase Auth account is gone: reported, never auto-repaired. */

.team-card-status {
    margin: 0.4rem 0 0.25rem;
}

.team-status {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
}

.team-status-active { background: #dcfce7; color: #15803d; }
.team-status-inactive { background: #f1f5f9; color: #64748b; }
.team-status-scheduled { background: #fee2e2; color: #b91c1c; }

.team-card-deletion {
    font-size: 0.78rem;
    color: #b91c1c;
    margin-top: 0.2rem;
}

.team-card-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0.75rem;
}

.team-card-actions:empty { display: none; }

/* Danger zone inside the Manage User modal */
.user-danger-zone {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px dashed var(--color-border);
}

.user-danger-note {
    width: 100%;
    font-size: 0.85rem;
    color: #b91c1c;
}

.user-danger-hint {
    width: 100%;
    margin: 0;
    font-size: 0.78rem;
    color: var(--color-text-light);
}

/* "Schedule User Deletion" confirmation */
.schedule-delete p { margin: 0 0 0.5rem; }

.schedule-delete-user {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.75rem;
}

.schedule-delete-name { font-weight: 700; }

.schedule-delete-email {
    font-size: 0.82rem;
    color: var(--color-text-light);
    overflow-wrap: anywhere;
}

.schedule-delete-points {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 0.85rem;
    color: var(--color-text-light);
}

.schedule-delete-points li { margin-bottom: 0.3rem; }

/* ================= Team ================= */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.team-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
    cursor: pointer;
    position: relative;
    transition: box-shadow var(--transition), transform var(--transition);
}

.team-card-manage {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.team-card-manage:hover {
    background: var(--color-surface);
    border-color: var(--color-primary);
}

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

.team-card-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0 auto 0.75rem;
}

.team-card-avatar.lg {
    width: 80px;
    height: 80px;
    font-size: 2rem;
    margin: 0;
}

.team-card-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.team-card-role {
    display: inline-block;
    margin-bottom: 0.35rem;
}

.team-card-dept {
    color: var(--color-text-light);
    font-size: 0.85rem;
}

.team-card-title {
    color: var(--color-text-light);
    font-size: 0.8rem;
}

.employee-hero {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
}

.employee-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--color-text-light);
}

.team-member-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0;
}

.team-member-name { flex: 1; }

/* ================= Projects ================= */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.project-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    cursor: pointer;
    transition: box-shadow var(--transition), transform var(--transition);
}

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

.project-card-top {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.project-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.project-card-desc {
    color: var(--color-text-light);
    font-size: 0.82rem;
    margin-bottom: 0.75rem;
}

.project-card-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.project-card-stats {
    display: flex;
    gap: 0.9rem;
    font-size: 0.78rem;
    color: var(--color-text-light);
    margin-bottom: 0.75rem;
}

/* Optional "Linked Social Media content" line on project cards — shown only
   when the project has linked content (above the tasks/done/date line). */
.project-card-sm {
    display: inline-flex;
    align-items: center;
    gap: 0.9rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-secondary);
    background: color-mix(in srgb, var(--color-secondary) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--color-secondary) 20%, transparent);
    border-radius: 999px;
    padding: 0.2rem 0.75rem;
    margin-bottom: 0.6rem;
}

.project-card-team {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.team-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-secondary);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.project-manager {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--color-text-light);
}

.project-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-tile {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-primary);
}

.stat-label {
    color: var(--color-text-light);
    font-size: 0.8rem;
}

/* ================= Task details ================= */
.task-detail-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.task-detail-actions {
    display: flex;
    gap: 0.5rem;
}

.task-detail-main { padding: 1.5rem; }

.task-detail-top {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.task-detail-title {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.task-detail-desc {
    color: var(--color-text-light);
    margin-bottom: 1.25rem;
}

.task-detail-meta {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-light);
    margin-bottom: 0.15rem;
}

.meta-value {
    font-size: 0.9rem;
    font-weight: 500;
}

.task-progress-block {
    margin-bottom: 1rem;
}

.quick-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quick-status .filter-select { width: auto; }

/* ================= Global search ================= */
.header-search.has-search { position: relative; }

.global-search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    min-width: 320px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 400;
    display: none;
    max-height: 420px;
    overflow-y: auto;
}

.global-search-dropdown.show { display: block; }

.search-section { padding: 0.35rem 0; }

.search-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-light);
    padding: 0.4rem 0.9rem;
}

.search-result {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.5rem 0.9rem;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
}

.search-result:hover { background: var(--color-bg); }

.search-result-icon { font-size: 1.05rem; }

.search-result-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.search-result-title {
    font-weight: 500;
    font-size: 0.88rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-subtitle {
    font-size: 0.75rem;
    color: var(--color-text-light);
}

.search-empty {
    padding: 1rem 0.9rem;
    color: var(--color-text-light);
    font-size: 0.85rem;
}

.search-loading {
    display: flex;
    justify-content: center;
    padding: 1rem;
}

.search-loading .spinner { width: 24px; height: 24px; }

/* ================= Comments & activity ================= */
.comment-list { margin-bottom: 0.75rem; }

/* ================= Attachments ================= */
.attachments-card { margin-bottom: 1rem; }

.attachments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.attachments-header h3 { margin-bottom: 0; }

/* Badge used to mark features that are intentionally disabled for now */
.coming-soon-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: var(--color-primary-soft, #eef2ff);
    color: var(--color-primary);
    border: 1px dashed var(--color-primary);
    cursor: default;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--color-border);
}

.attachment-item:last-child { border-bottom: none; }

.attachment-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.attachment-info { flex: 1; min-width: 0; }

.attachment-name {
    font-weight: 500;
    color: var(--color-primary);
    word-break: break-all;
}

.attachment-name:hover { text-decoration: underline; }

.attachment-meta {
    font-size: 0.75rem;
    color: var(--color-text-light);
}

.comment-empty {
    color: var(--color-text-light);
    font-size: 0.85rem;
    padding: 0.75rem 0;
}

.comment-item {
    display: flex;
    gap: 0.6rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--color-border);
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-secondary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.comment-content { flex: 1; }

.comment-meta {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    margin-bottom: 0.2rem;
}

.comment-author { font-weight: 600; font-size: 0.85rem; }
.comment-time { color: var(--color-text-light); font-size: 0.72rem; }
.comment-text { font-size: 0.9rem; margin-bottom: 0.3rem; }

.comment-reply-btn {
    font-size: 0.78rem;
    color: var(--color-primary);
    font-weight: 500;
}

.comment-reply-form { margin-top: 0.5rem; }

.comment-form {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.comment-input {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    min-height: 48px;
    resize: vertical;
    font-family: inherit;
}

.activity-timeline {
    position: relative;
    padding-left: 1.25rem;
}

.activity-timeline::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--color-border);
}

.activity-item {
    position: relative;
    padding: 0.5rem 0;
}

.activity-dot {
    position: absolute;
    left: -1.25rem;
    top: 0.85rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-primary);
    border: 2px solid var(--color-surface);
}

.activity-text { font-size: 0.88rem; }
.activity-time { font-size: 0.72rem; color: var(--color-text-light); }

/* ================= Reports ================= */
.export-actions {
    display: flex;
    gap: 0.5rem;
}

.report-list { display: flex; flex-direction: column; gap: 0.75rem; }

.report-item {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.9rem 1rem;
}

.report-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.4rem;
    gap: 0.5rem;
}

.report-date {
    color: var(--color-text-light);
    font-size: 0.8rem;
}

.report-summary { font-size: 0.9rem; margin-bottom: 0.3rem; }
.report-line { font-size: 0.82rem; color: var(--color-text-light); }

/* Generated-report history */
.history-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.history-toolbar h3 { margin: 0; }
.saved-report-item { display: flex; flex-direction: column; gap: 0.35rem; }
.report-item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.4rem;
}
.history-view-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

/* Custom date-range report */
.custom-report-filters {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.cr-label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: var(--color-text-light);
}
.cr-label input[type="date"] {
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    font-size: 0.9rem;
}
.report-range-banner {
    background: var(--color-primary);
    color: #fff;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 0.9rem;
}
.report-notes {
    width: 100%;
    min-height: 120px;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    resize: vertical;
}
/* Standalone (full-width) trend + notes cards between charts and tables */
.cr-trend-card { margin-bottom: 1rem; }
.cr-notes-card { margin-bottom: 1.25rem; }

/* ================= Settings ================= */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ================= Notifications ================= */
.notif-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    background: var(--color-danger);
    color: white;
    border-radius: 999px;
    font-size: 0.65rem;
    padding: 1px 5px;
    min-width: 16px;
    text-align: center;
}

.notification-dropdown {
    position: fixed;
    width: 340px;
    max-height: 420px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 400;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
}

.notif-unread {
    font-size: 0.75rem;
    color: var(--color-primary);
    font-weight: 600;
}

.notification-list {
    overflow-y: auto;
    flex: 1;
}

.notification-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
}

.notification-item:hover { background: var(--color-bg); }
.notification-item.unread { background: #eef2ff; }

.notification-message { font-size: 0.85rem; }
.notification-time { font-size: 0.72rem; color: var(--color-text-light); margin-top: 0.2rem; }
.notification-empty { padding: 1.5rem; text-align: center; color: var(--color-text-light); }

.notification-footer {
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--color-border);
    text-align: center;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

/* ================= Notifications page ================= */
.notif-summary {
    font-size: 0.85rem;
    color: var(--color-text-light);
    font-weight: 500;
}

.notification-page-items {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.notification-page-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.9rem 1rem;
    cursor: pointer;
    transition: box-shadow var(--transition), transform var(--transition);
}

.notification-page-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.notification-page-item.unread {
    background: #eef2ff;
    border-left: 4px solid var(--color-primary);
}

.notification-type-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.notification-page-body {
    flex: 1;
    min-width: 0;
}

.notification-page-message {
    font-size: 0.92rem;
    margin-bottom: 0.35rem;
}

.notification-page-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.78rem;
    color: var(--color-text-light);
}

.notif-type-task { background: #e0f2fe; color: #0369a1; }
.notif-type-comment { background: #ede9fe; color: #6d28d9; }
.notif-type-reminder { background: #fef3c7; color: #92400e; }
.notif-type-info { background: #f1f5f9; color: #475569; }
.notif-type-system { background: #f1f5f9; color: #475569; }

/* ================= Role badges ================= */
.role-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
    text-transform: capitalize;
}

.role-admin { background: #fee2e2; color: #991b1b; }
.role-manager { background: #fef9c3; color: #854d0e; }
.role-trainer { background: #ede9fe; color: #6d28d9; }
.role-employee { background: #dcfce7; color: #166534; }
.role-freelance { background: #fef3c7; color: #a16207; }

.approval-pending { background: #fef9c3; color: #854d0e; }
.approval-approved { background: #dcfce7; color: #166534; }
.approval-rejected { background: #fee2e2; color: #991b1b; }

/* ================= Loading & empty states ================= */
.page-container {
    width: 100%;
    min-height: 50vh;
}

.page-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.loading-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    color: var(--color-text-light);
}

.loading-text { font-size: 0.85rem; }

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2.5rem 1rem;
    gap: 0.4rem;
}

.empty-icon { font-size: 2rem; }
.empty-title { font-weight: 600; color: var(--color-text); }
.empty-subtitle { color: var(--color-text-light); font-size: 0.85rem; }

/* ================= Buttons (additional) ================= */
.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Modal body lock */
body.modal-open {
    overflow: hidden;
}

/* ================= Print / PDF export ================= */
.print-area {
    display: none;
}

@media print {
    body * {
        visibility: hidden !important;
    }
    #printArea,
    #printArea * {
        visibility: visible !important;
    }
    #printArea {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 24px;
        display: block !important;
    }
    .print-header {
        margin-bottom: 16px;
        border-bottom: 2px solid var(--color-primary);
        padding-bottom: 12px;
    }
    .print-brand {
        color: var(--color-primary);
        font-weight: 700;
        font-size: 0.8rem;
        text-transform: uppercase;
        letter-spacing: 0.06em;
    }
    .print-header h1 {
        font-size: 1.5rem;
        margin: 4px 0;
        color: var(--color-text);
    }
    .print-header p {
        color: var(--color-text-light);
        margin: 0;
        font-size: 0.85rem;
    }
    .print-table {
        width: 100%;
        border-collapse: collapse;
        margin-top: 12px;
    }
    .print-table th,
    .print-table td {
        border: 1px solid #cbd5e1;
        padding: 6px 8px;
        font-size: 11px;
        text-align: left;
        vertical-align: top;
        color: #1e293b;
    }
    .print-table th {
        background: #f1f5f9;
        font-weight: 600;
    }
    .print-table tr {
        page-break-inside: avoid;
    }
    .print-chart {
        width: 100%;
        max-width: 560px;
        margin: 10px auto;
        display: block;
        page-break-inside: avoid;
    }
    .print-chart-block {
        margin: 14px 0;
        page-break-inside: avoid;
    }
    .print-chart-block h3 {
        font-size: 13px;
        margin: 0 0 6px;
        color: #1e293b;
    }
    .print-chart-block .chart-legend,
    .print-chart-block .print-legend {
        display: flex;
        flex-wrap: wrap;
        gap: 6px 14px;
        justify-content: center;
        margin-top: 8px;
        font-size: 11px;
        color: #334155;
    }
    .print-chart-block .legend-item {
        display: inline-flex;
        align-items: center;
        gap: 5px;
    }
    .print-chart-block .legend-dot {
        width: 10px;
        height: 10px;
        border-radius: 50%;
        display: inline-block;
    }
    .print-user {
        margin: 12px 0 4px;
        padding: 8px 10px;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 6px;
    }
    .print-user-name { font-size: 13px; font-weight: 700; color: #1e293b; }
    .print-user-meta { font-size: 11px; color: #334155; }
    .print-user-email { font-size: 11px; color: #64748b; }
    .print-kpis {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin: 12px 0;
    }
    .print-kpi {
        flex: 1 1 15%;
        min-width: 90px;
        border: 1px solid #e2e8f0;
        border-radius: 6px;
        padding: 8px;
        text-align: center;
        background: #f8fafc;
        page-break-inside: avoid;
    }
    .print-kpi-label {
        display: block;
        font-size: 10px;
        color: #64748b;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }
    .print-kpi-value {
        display: block;
        font-size: 18px;
        font-weight: 700;
        color: #1e293b;
    }
}

/* ================= Phase 16-19: Task enhancements ================= */

/* Task card badges & meta */
.badge-subtask {
    background: #eef2ff;
    color: #4338ca;
}
.badge-blocked {
    background: #fef2f2;
    color: #b91c1c;
}
.task-card-top { align-items: center; }
.task-select {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--color-text-light);
    user-select: none;
}
.task-select.checked { color: var(--color-primary); }
.task-hours {
    font-size: 0.75rem;
    color: var(--color-text-light);
}

/* Bulk actions bar */
.bulk-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    background: var(--color-primary-soft, #eef2ff);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-md);
    padding: 0.6rem 0.9rem;
    margin-bottom: 1rem;
}
.bulk-bar.hidden { display: none; }
.bulk-count {
    font-weight: 600;
    color: var(--color-primary);
}

/* Kanban drag & drop */
.task-card.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}
.kanban-column-body.drag-over {
    background: rgba(79, 70, 229, 0.08);
    outline: 2px dashed var(--color-primary);
    outline-offset: -2px;
    border-radius: var(--radius-md);
}

/* Checklist */
.task-detail-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}
.checklist-card, .dependencies-card, .timelog-card { margin-bottom: 0; }
.panel-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.panel-card-header h3 { margin-bottom: 0; }
.checklist-summary {
    font-size: 0.75rem;
    color: var(--color-text-light);
    font-weight: 500;
    margin-left: 0.4rem;
}
.checklist-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--color-border);
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item.done .checklist-title {
    text-decoration: line-through;
    color: var(--color-text-light);
}
.checklist-toggle {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}
.checklist-toggle input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}
.checklist-toggle .checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--color-border);
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), border-color var(--transition);
    cursor: pointer;
}
.checklist-toggle input:checked + .checkmark {
    background: var(--color-primary);
    border-color: var(--color-primary);
}
.checklist-toggle input:checked + .checkmark::after {
    content: '✓';
    color: #fff;
    font-size: 0.7rem;
}
.checklist-title { flex: 1; font-size: 0.9rem; }

/* Dependencies */
.dep-group { margin-bottom: 0.9rem; }
.dep-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-light);
    margin-bottom: 0.35rem;
}
.dep-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
}
.dep-link {
    color: var(--color-primary);
    font-weight: 500;
    font-size: 0.9rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dep-link:hover { text-decoration: underline; }
.modal-hint {
    color: var(--color-text-light);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

/* Time log */
.timelog-list { margin-bottom: 0.5rem; }
.timelog-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.88rem;
}
.timelog-row:last-child { border-bottom: none; }
.timelog-date { color: var(--color-text-light); width: 90px; flex-shrink: 0; }
.timelog-hours { font-weight: 600; color: var(--color-primary); width: 50px; flex-shrink: 0; }
.timelog-desc { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timelog-user { color: var(--color-text-light); font-size: 0.8rem; }
.timelog-total {
    font-size: 0.85rem;
    color: var(--color-text-light);
    padding-top: 0.4rem;
    border-top: 1px dashed var(--color-border);
}

/* @mention picker */
.comment-form { position: relative; }
.mention-dropdown {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 0;
    min-width: 240px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 300;
    max-height: 220px;
    overflow-y: auto;
    padding: 0.25rem;
}
.mention-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.88rem;
}
.mention-option:hover { background: var(--color-bg); }
.mention-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}
.mention-name { flex: 1; }
.mention-option small { color: var(--color-text-light); font-size: 0.72rem; }

/* Announcements */
.announcements { margin-bottom: 1rem; }
.announcement-banner {
    display: flex;
    gap: 0.75rem;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    border: 1px solid #c7d2fe;
    border-radius: var(--radius-md);
    padding: 0.9rem 1rem;
    margin-bottom: 0.6rem;
}
.announcement-icon { font-size: 1.3rem; flex-shrink: 0; }
.announcement-body { flex: 1; }
.announcement-title { font-weight: 600; }
.announcement-message { font-size: 0.88rem; color: var(--color-text-light); margin-top: 0.15rem; }
.announcement-meta { font-size: 0.75rem; color: var(--color-text-light); margin-top: 0.2rem; }

/* Dashboard activity feed */
.dashboard-activity-feed .activity-row.clickable {
    cursor: pointer;
}
.dashboard-activity-feed .activity-row.clickable:hover {
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    padding-left: 0.3rem;
}

/* ================= Phase 18: Admin page ================= */
.tab-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid var(--color-border);
}
.tab-btn {
    padding: 0.6rem 1rem;
    font-weight: 500;
    color: var(--color-text-light);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color var(--transition), border-color var(--transition);
}
.tab-btn.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.admin-two-col {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 1rem;
    align-items: start;
}

.announcement-item {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.9rem 1rem;
    margin-bottom: 0.6rem;
    background: var(--color-surface);
}
.announcement-item-title { font-weight: 600; }
.announcement-item-message { font-size: 0.88rem; color: var(--color-text-light); margin-top: 0.2rem; }
.announcement-item-meta { font-size: 0.75rem; color: var(--color-text-light); margin: 0.3rem 0 0.5rem; }

.data-export-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.table-responsive {
    overflow-x: auto;
    margin-top: 0.75rem;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.data-table th, .data-table td {
    text-align: left;
    padding: 0.55rem 0.7rem;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}
.data-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-light);
}
.td-muted { color: var(--color-text-light); white-space: nowrap; }

.badge-action-created { background: #ecfdf5; color: #047857; }
.badge-action-updated { background: #eef2ff; color: #4338ca; }
.badge-action-deleted { background: #fef2f2; color: #b91c1c; }
.badge-action-commented { background: #f0f9ff; color: #0369a1; }
.badge-action-uploaded { background: #fdf4ff; color: #a21caf; }
.badge-role-admin { background: #fee2e2; color: #b91c1c; }
.badge-role-manager { background: #fef3c7; color: #b45309; }
.badge-role-trainer { background: #ede9fe; color: #6d28d9; }
.badge-role-employee { background: #e2e8f0; color: #334155; }
.badge-role-freelance { background: #fef3c7; color: #a16207; }

.badge-status-draft { background: #f1f5f9; color: #475569; }
.badge-status-active { background: #e0f2fe; color: #0369a1; }
.badge-status-completed { background: #dcfce7; color: #15803d; }
.badge-status-scheduled { background: #f1f5f9; color: #475569; }
.badge-status-confirmed { background: #e0f2fe; color: #0369a1; }
.badge-status-cancelled { background: #fee2e2; color: #b91c1c; }

.import-preview {
    font-size: 0.85rem;
    margin-top: 0.75rem;
    color: var(--color-text-light);
}
.import-preview.success { color: var(--color-success); font-weight: 600; }
.import-preview.error { color: var(--color-danger); font-weight: 600; }

/* ================= Phase 17: Timesheet ================= */
.ts-week-label {
    font-weight: 600;
    color: var(--color-text);
    min-width: 160px;
    text-align: center;
}
.ts-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--color-text-light);
    cursor: pointer;
}
.timesheet-table td, .timesheet-table th { text-align: center; }
.timesheet-table td:first-child, .timesheet-table th:first-child { text-align: left; }
.ts-has-hours {
    background: #eef2ff;
    color: #4338ca;
    font-weight: 600;
}
.ts-total {
    font-weight: 700;
    color: var(--color-primary);
}

/* ================= Training Programs ================= */
.program-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.program-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    transition: box-shadow var(--transition), transform var(--transition);
}

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

.program-card-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.program-task-count {
    font-size: 0.78rem;
    color: var(--color-text-light);
}

.program-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.program-card-desc {
    color: var(--color-text-light);
    font-size: 0.82rem;
    margin-bottom: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.program-card-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.82rem;
    margin-bottom: 0.6rem;
}

.program-meta-label {
    color: var(--color-text-light);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.program-card-dates {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-bottom: 0.6rem;
}

.program-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

/* Task picker (multi-select) inside the program modal */
.task-picker {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.35rem;
}

.task-picker-empty {
    color: var(--color-text-light);
    font-size: 0.85rem;
    padding: 0.5rem 0;
}

.task-picker-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.88rem;
}

.task-picker-item:hover { background: var(--color-bg); }

.task-picker-item input {
    flex-shrink: 0;
}

.task-picker-status {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--color-text-light);
}

/* Program view modal */
.program-view-status { margin-bottom: 0.6rem; }
.program-view-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.88rem;
    margin-bottom: 0.75rem;
}
.program-view-desc {
    color: var(--color-text-light);
    font-size: 0.9rem;
    margin-bottom: 0.9rem;
}
.program-view-empty {
    color: var(--color-text-light);
    font-size: 0.85rem;
    padding: 0.5rem 0;
}
.program-view h4 { margin-bottom: 0.5rem; }

/* ================= KPI Module (new) ================= */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.kpi-module-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    transition: box-shadow var(--transition), transform var(--transition);
}
.kpi-module-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-module-card.kpi-module-cancelled { opacity: 0.78; }
.kpi-module-top { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.kpi-module-title { font-size: 1.05rem; font-weight: 600; margin: 0; }
.kpi-module-desc { color: var(--color-text-light); font-size: 0.85rem; margin: 0; }
.kpi-module-values { display: flex; align-items: baseline; gap: 0.35rem; }
.kpi-module-current { font-size: 1.6rem; font-weight: 700; }
.kpi-module-target { color: var(--color-text-light); font-size: 0.95rem; }
.kpi-module-meta {
    display: flex; flex-wrap: wrap; gap: 0.5rem 0.9rem;
    color: var(--color-text-light); font-size: 0.8rem;
}
.kpi-module-actions { display: flex; gap: 0.4rem; margin-top: 0.25rem; }

/* KPI rows on the project details page */
.kpi-inline-row {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.5rem 0; border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
}
.kpi-inline-row:last-child { border-bottom: none; }
.kpi-inline-name { font-weight: 500; flex: 1 1 auto; }
.kpi-inline-value { color: var(--color-text-light); font-size: 0.85rem; }

/* Social Media content rows on the project details page */
.project-sm-item {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.5rem 0; border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap; font-size: 0.85rem;
}
.project-sm-item:last-child { border-bottom: none; }
.project-sm-title { font-weight: 600; flex: 1 1 auto; }
.project-sm-date { color: var(--color-text-light); font-size: 0.78rem; }

/* Derived target status (Below Target / On Target / Target Achieved) */
.badge.target-status.target-below-target { background: #fee2e2; color: #b91c1c; }
.badge.target-status.target-on-target { background: #fef3c7; color: #92400e; }
.badge.target-status.target-achieved { background: #dcfce7; color: #15803d; }

/* Clickable KPI card */
.kpi-module-clickable { cursor: pointer; }
.kpi-module-open-hint { margin-left: auto; font-size: 0.72rem; color: var(--color-text-light); }

/* ================= Dashboard – KPI Performance section ================= */
/* Shown at the top of the dashboard / employee dashboard (before the
   Projects & tasks stat tiles). */
.dash-kpi-panel { margin: 1rem 0 1.25rem; }
.panel-card-link {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
}
.panel-card-link:hover { text-decoration: underline; }
.dash-kpi-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.dash-kpi-stat {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.9rem;
    text-align: center;
}
.dash-kpi-stat-value { font-size: 1.45rem; font-weight: 700; line-height: 1.15; }
.dash-kpi-stat-label { font-size: 0.75rem; color: var(--color-text-light); margin-top: 0.15rem; }
.dash-kpi-tone-achieved { color: #15803d; }
.dash-kpi-tone-ontarget { color: #92400e; }
.dash-kpi-tone-below { color: #b91c1c; }
.dash-kpi-list { display: flex; flex-direction: column; }
.dash-kpi-row {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.65rem 0.6rem;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}
.dash-kpi-row:last-child { border-bottom: none; }
.dash-kpi-row:hover,
.dash-kpi-row:focus-visible { background: var(--color-bg); outline: none; }
.dash-kpi-row-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.dash-kpi-name {
    font-weight: 600;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dash-kpi-bar { display: flex; align-items: center; gap: 0.6rem; }
.dash-kpi-bar .progress-track { flex: 1; }
.dash-kpi-pct {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-light);
    min-width: 2.6rem;
    text-align: right;
}
.dash-kpi-fill.fill-achieved { background: #10b981; }
.dash-kpi-fill.fill-ontarget { background: #f59e0b; }
.dash-kpi-fill.fill-below { background: #ef4444; }
.dash-kpi-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    font-size: 0.78rem;
    color: var(--color-text-light);
}

/* Milestone editor rows (in the KPI modal) */
.ms-row {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    margin-bottom: 0.4rem;
}
.ms-row .ms-row-title { flex: 2 1 auto; }
.ms-row .ms-row-target { flex: 1 1 90px; max-width: 110px; }
.ms-row .ms-row-date { flex: 1 1 140px; max-width: 150px; }
.ms-row-remove { flex-shrink: 0; }

/* ================= KPI detail page ================= */
.kpi-detail-header {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}
.kpi-milestone {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--color-border);
}
.kpi-milestone:last-child { border-bottom: none; }
.kpi-milestone.done .kpi-milestone-title { text-decoration: line-through; color: var(--color-text-light); }
.kpi-milestone-info { flex: 1 1 auto; }
.kpi-milestone-title { font-weight: 500; font-size: 0.92rem; }
.kpi-milestone-meta { font-size: 0.75rem; color: var(--color-text-light); margin-top: 0.15rem; }
.kpi-linked-project {
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
}
.kpi-linked-project:last-child { border-bottom: none; }
.kpi-linked-project:hover { background: var(--color-bg); }
.kpi-linked-project-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.35rem;
}
.kpi-linked-project-name { flex: 1 1 auto; font-weight: 600; }
.kpi-linked-project-stats { font-size: 0.8rem; color: var(--color-text-light); margin-top: 0.35rem; }

/* ================= Project picker (scrollable list) ================= */
.project-picker {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.project-picker-search {
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--color-border);
    padding: 0.5rem 0.65rem;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 0.9rem;
    outline: none;
}
.project-picker-search:focus { box-shadow: inset 0 -2px 0 var(--color-primary); }
.project-picker-list {
    max-height: 200px;
    overflow-y: auto;
    background: var(--color-surface);
}
.project-picker-item {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.5rem 0.7rem; cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    /* Radio button sits BEFORE the project name, then the status badge on the right. */
}
.project-picker-item:last-child { border-bottom: none; }
.project-picker-item:hover { background: var(--color-bg); }
.project-picker-item.selected { background: color-mix(in srgb, var(--color-primary) 10%, transparent); }
.project-picker-item input[type="radio"] {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--color-primary);
    cursor: pointer;
}
.project-picker-name { flex: 1 1 auto; font-size: 0.9rem; font-weight: 500; }
.project-picker-status {
    flex-shrink: 0;
    font-size: 0.7rem;
    color: var(--color-text-light);
    background: var(--color-bg);
    padding: 2px 8px;
    border-radius: 999px;
}
.project-picker-empty { padding: 0.6rem; color: var(--color-text-light); font-size: 0.85rem; }

/* ================= Calendar: derived events + toggles ================= */
.calendar-filters {
    display: inline-flex; gap: 0.75rem; align-items: center;
    padding: 0.2rem 0.5rem; border: 1px solid var(--color-border);
    border-radius: var(--radius-sm); background: var(--color-surface);
    font-size: 0.8rem; white-space: nowrap;
}
.cal-toggle { display: inline-flex; align-items: center; gap: 0.25rem; cursor: pointer; }
.cal-toggle input { accent-color: var(--color-primary); }
.event-chip.event-derived { cursor: pointer; }
.event-chip.event-project { border-left-color: #6366f1; }
.event-chip.event-task { border-left-color: #0ea5e9; }
.event-chip.event-training { border-left-color: #10b981; }

/* ================= Social Media: linked project ================= */
.social-card-project { color: var(--color-text-light); font-size: 0.78rem; }

/* ================= About page ================= */
.about-hero {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.75rem;
}
.about-hero-mark {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}
.about-hero-body { flex: 1 1 auto; min-width: 0; }
.about-hero h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0.5rem 0 0.6rem;
}
.about-by { color: var(--color-text-light); font-weight: 600; font-size: 1.1rem; }
.about-hero-body p { color: var(--color-text); line-height: 1.65; }
.about-hero-note {
    margin-top: 0.75rem;
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--color-warning) 12%, transparent);
    border-left: 3px solid var(--color-warning);
    font-size: 0.9rem;
}
.about-internal-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-danger);
    background: color-mix(in srgb, var(--color-danger) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--color-danger) 30%, transparent);
    border-radius: 999px;
    padding: 0.2rem 0.7rem;
}

.about-section { margin-bottom: 1.75rem; }
.about-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.9rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--color-border);
}

/* Uses */
.about-uses {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.75rem;
}
.about-use {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 0.9rem 1rem;
    box-shadow: var(--shadow-sm);
}
.about-use-icon { font-size: 1.25rem; line-height: 1.4; flex-shrink: 0; }
.about-use-title { font-weight: 600; font-size: 0.92rem; }
.about-use-text { color: var(--color-text-light); font-size: 0.85rem; line-height: 1.55; margin-top: 0.15rem; }

/* Features */
.about-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}
.about-feature-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; }
.about-feature-head h3 { margin-bottom: 0; }
.about-feature-icon { font-size: 1.15rem; }
.about-feature-list { list-style: none; padding: 0; margin: 0; }
.about-feature-list li {
    position: relative;
    padding-left: 1.1rem;
    margin-bottom: 0.35rem;
    font-size: 0.87rem;
    line-height: 1.55;
    color: var(--color-text-light);
}
.about-feature-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--color-success);
    font-weight: 700;
}

/* FAQs */
.about-faqs { display: flex; flex-direction: column; gap: 0.5rem; }
.about-faq {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.about-faq summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    cursor: pointer;
    list-style: none;
    font-weight: 600;
    font-size: 0.92rem;
    transition: background var(--transition);
}
.about-faq summary::-webkit-details-marker { display: none; }
.about-faq summary:hover { background: var(--color-bg); }
.about-faq-chevron {
    flex-shrink: 0;
    color: var(--color-text-light);
    font-size: 1.2rem;
    line-height: 1;
    transition: transform var(--transition);
}
.about-faq[open] .about-faq-chevron { transform: rotate(90deg); }
.about-faq[open] summary { border-bottom: 1px solid var(--color-border); }
.about-faq-a {
    padding: 0.85rem 1rem;
    font-size: 0.88rem;
    line-height: 1.65;
    color: var(--color-text-light);
}

/* Dedication */
.about-dedication {
    margin: 2rem 0 1.5rem;
    padding: 1.5rem;
    text-align: center;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--color-primary) 10%, transparent),
        color-mix(in srgb, var(--color-secondary) 10%, transparent));
    border: 1px solid color-mix(in srgb, var(--color-primary) 22%, transparent);
}
.about-dedication-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--color-primary);
    margin-bottom: 0.6rem;
}
.about-dedication-text {
    font-size: 1.02rem;
    line-height: 1.7;
    max-width: 46rem;
    margin: 0 auto;
}
.about-dedication-sub {
    margin-top: 0.6rem;
    font-size: 0.9rem;
    font-style: italic;
    color: var(--color-text-light);
}

/* Footer credit */
.about-footer {
    text-align: center;
    padding: 1.25rem 0 0.5rem;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-light);
}
.about-footer-line { font-size: 0.82rem; font-weight: 600; }
.about-heart { color: var(--color-danger); }
.about-footer-copy { font-size: 0.75rem; opacity: 0.85; margin-top: 0.15rem; }

@media (max-width: 640px) {
    .about-hero { flex-direction: column; gap: 1rem; }
    .about-hero-mark { width: 52px; height: 52px; font-size: 1.6rem; }
}

/* ================= Multi-select (search + dropdown + tags) ================= */
.ms {
    position: relative;
    width: 100%;
}
.ms-control {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem;
    min-height: 40px;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    cursor: text;
}
.ms-control:focus-within { border-color: var(--color-primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 20%, transparent); }
.ms-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.ms-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: color-mix(in srgb, var(--color-primary) 14%, transparent);
    color: var(--color-text);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
}
.ms-tag-x {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    padding: 0;
}
.ms-tag-x:hover { color: var(--color-danger); }
.ms-search {
    flex: 1 1 120px;
    min-width: 80px;
    border: none;
    outline: none;
    background: transparent;
    color: var(--color-text);
    font-size: 0.9rem;
    padding: 0.2rem;
}
.ms-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 120;
    max-height: 220px;
    overflow-y: auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}
.ms-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.7rem;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.9rem;
}
.ms-option:last-child { border-bottom: none; }
.ms-option:hover { background: var(--color-bg); }
.ms-option.selected { background: color-mix(in srgb, var(--color-primary) 10%, transparent); }
.ms-option.disabled { opacity: 0.55; cursor: not-allowed; }
.ms-option input[type="checkbox"] { width: 15px; height: 15px; flex-shrink: 0; accent-color: var(--color-primary); }
.ms-option-label { flex: 1 1 auto; }
.ms-option-hint { font-size: 0.72rem; color: var(--color-text-light); }
.ms-empty, .ss-empty { padding: 0.6rem; color: var(--color-text-light); font-size: 0.85rem; text-align: center; }

/* ================= Searchable single-select (combobox) ================= */
.ss {
    position: relative;
    width: 100%;
}
.ss-display {
    width: 100%;
    min-height: 40px;
    text-align: left;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.9rem;
    cursor: pointer;
}
.ss-display::after {
    content: '▾';
    float: right;
    color: var(--color-text-light);
}
.ss-display.placeholder { color: var(--color-text-light); }
.ss-display:hover { border-color: var(--color-primary); }
.ss-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 120;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
.ss-search {
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--color-border);
    padding: 0.5rem 0.7rem;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 0.9rem;
    outline: none;
}
.ss-search:focus { box-shadow: inset 0 -2px 0 var(--color-primary); }
.ss-options { max-height: 200px; overflow-y: auto; }
.ss-option {
    padding: 0.5rem 0.7rem;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--color-border);
}
.ss-option:last-child { border-bottom: none; }
.ss-option:hover { background: var(--color-bg); }
.ss-option.selected { background: color-mix(in srgb, var(--color-primary) 12%, transparent); font-weight: 500; }

/* =====================================================================
 * Mobile responsiveness hardening (2026-09-14)
 * ---------------------------------------------------------------------
 * Root-cause fixes so that long user content can never force the page
 * wider than the viewport. These rules only take effect when space is
 * tight, so the desktop layout is unchanged. Deliberately NO global
 * `overflow-x: hidden` — every fix removes the actual cause.
 * ===================================================================== */

/* 1. Let the layout chain shrink to the viewport width. Without this a
      single wide child (a table, a <select>, nowrap text) stretches
      .main-wrapper and the whole document scrolls horizontally. */
.main-wrapper,
.content,
.page-container,
.sidebar {
    min-width: 0;
}

/* 2. Grid/flex children default to min-width:auto, which lets any wide
      child force its grid track (and the page) open. */
.dashboard-grid > *,
.insights-row > *,
.kpi-grid > *,
.project-grid > *,
.team-grid > *,
.settings-grid > *,
.form-row > *,
.task-detail-grid > *,
.task-detail-grid-2 > *,
.admin-two-col > *,
.chart-card,
.panel-card,
.task-card,
.insight-card,
.filter-bar > * {
    min-width: 0;
}

/* 3. User-controlled text must wrap/break instead of pushing the layout
      open (nowrap text contributes its full width to the parent's
      min-content size). Short static labels keep their nowrap rules. */
h1, h2, h3, h4,
.page-subtitle,
.task-card-title,
.task-card-desc,
.task-card-by,
.task-assignee,
.task-detail-title,
.task-detail-desc,
.project-card-name,
.project-card-desc,
.insight-card,
.announcement-title,
.announcement-message,
.announcement-meta,
.report-summary,
.form-hint,
.day-item-title,
.comment-body,
.notif-message,
.team-name,
.kpi-module-name,
.kpi-linked-project-name,
.day-stat-label,
.access-feature-label {
    overflow-wrap: anywhere;
}

.dash-kpi-name,
.timelog-desc,
.td-muted,
.dep-link {
    white-space: normal;
    overflow-wrap: anywhere;
}

/* 4. A <select> is as wide as its longest option — that alone can stretch
      a filter bar (and the page) past the viewport. */
.filter-select,
.filter-search {
    min-width: 0;
    max-width: 100%;
}

.filter-search {
    flex: 1 1 160px;
}

select,
input,
textarea {
    max-width: 100%;
}

/* 5. Wide tables scroll inside their own container instead of widening
      the page (the page itself must stay within the viewport). */
.table-responsive,
.access-table-wrap,
.access-user-body {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
}

/* 6. Header: actions/avatar stay pinned right and can't shrink away;
      long names ellipsize instead of breaking the row. */
.header {
    min-width: 0;
}

.header-search {
    min-width: 0;
}

.header-actions {
    margin-left: auto;
    flex-shrink: 0;
}

.sidebar-toggle,
.icon-btn,
.profile-avatar,
.profile-img,
.role-badge {
    flex-shrink: 0;
}

.profile-dropdown {
    min-width: 0;
}

.profile-name {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 7. The sidebar scrolls internally on short viewports. */
.sidebar {
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* 8. Modals never exceed the viewport and scroll internally. */
.modal {
    width: min(100% - 1.5rem, 600px);
    max-width: none;
    max-height: calc(100dvh - 1.5rem);
}

@supports not (height: 100dvh) {
    .modal { max-height: calc(100vh - 1.5rem); }
}

.modal-body {
    overflow-wrap: anywhere;
}

/* 9. Charts always fit their card. */
.chart-card canvas {
    max-width: 100%;
}

/* 10. Tab bars wrap instead of overflowing the viewport. */
.tab-bar {
    flex-wrap: wrap;
    row-gap: 0.25rem;
}

