/* Dashboard-only visual polish.
   Preserves the original dashboard markup, card order, charts, filters and behavior. */

/* Status changes morph the arcs without fading or bouncing the entire card. */
.modern-dashboard [data-dashboard-panel="gender"].is-panel-refreshing,
.modern-dashboard [data-dashboard-panel="appointments"].is-panel-refreshing {
    opacity: 1;
    filter: none;
}
.modern-dashboard [data-gender-panel] .is-animating :is(.gender-pie-svg, .gender-donut-total) {
    animation: none !important;
    transform: none !important;
}
.modern-dashboard [data-gender-panel] .is-animating .gender-slice {
    transform: none !important;
    filter: none !important;
    transition: none;
    pointer-events: none;
}
.modern-dashboard [data-gender-panel] :is(.gender-stat strong, .gender-stat small, .gender-donut-total) {
    font-variant-numeric: tabular-nums;
}

/* Coordinated dashboard entrance sequence. Backwards fill hides each item only
   during its delay, while allowing the existing hover transforms after entry. */
/* Year changes use the same value-only morph as Gender Distribution. */
.modern-dashboard .appointments-card.appointments-chart-animating :is(.new-hired-plot, .month-labels span) {
    animation: none !important;
    transform: none !important;
}
.modern-dashboard .appointments-card.appointments-chart-animating .month-bar .bar {
    transition: none !important;
    transform: none !important;
    filter: none !important;
}

.modern-dashboard .summary-card,
.modern-dashboard .dashboard-card {
    animation: dashboard-item-enter 540ms cubic-bezier(.22, .8, .24, 1) backwards;
}

/* Server-backed dropdowns replace only one card. Keep that card shell fixed and
   let dashboard.js animate the refreshed chart content inside it. */
.modern-dashboard .dashboard-card.dashboard-panel-partial-replacement {
    animation: none;
}

.modern-dashboard .summary-card:nth-child(1) { animation-delay: 40ms; }
.modern-dashboard .summary-card:nth-child(2) { animation-delay: 85ms; }
.modern-dashboard .summary-card:nth-child(3) { animation-delay: 130ms; }
.modern-dashboard .summary-card:nth-child(4) { animation-delay: 175ms; }
.modern-dashboard .summary-card:nth-child(5) { animation-delay: 220ms; }
.modern-dashboard .summary-card:nth-child(6) { animation-delay: 265ms; }
.modern-dashboard .summary-card:nth-child(7) { animation-delay: 310ms; }
.modern-dashboard .summary-card:nth-child(8) { animation-delay: 355ms; }

.modern-dashboard .dashboard-priority-grid .dashboard-card:nth-of-type(1) { animation-delay: 300ms; }
.modern-dashboard .dashboard-priority-grid .dashboard-card:nth-of-type(2) { animation-delay: 360ms; }
.modern-dashboard .dashboard-activity-grid .dashboard-card:nth-of-type(1) { animation-delay: 420ms; }
.modern-dashboard .dashboard-activity-grid .dashboard-card:nth-of-type(2) { animation-delay: 480ms; }
.modern-dashboard .dashboard-lower-grid .dashboard-card:nth-of-type(1) { animation-delay: 540ms; }
.modern-dashboard .dashboard-lower-grid .dashboard-card:nth-of-type(2) { animation-delay: 600ms; }

.modern-dashboard .dashboard-card:not(.dashboard-panel-partial-replacement) .month-bar .bar {
    transform-origin: center bottom;
    animation: dashboard-bar-rise 720ms cubic-bezier(.22, .8, .24, 1) 650ms backwards;
}

.modern-dashboard .month-bar:nth-child(2n) .bar { animation-delay: 690ms; }
.modern-dashboard .month-bar:nth-child(3n) .bar { animation-delay: 730ms; }

.modern-dashboard .dashboard-card:not(.dashboard-panel-partial-replacement) .gender-pie-svg {
    transform-origin: center;
    animation: dashboard-chart-enter 680ms cubic-bezier(.22, .8, .24, 1) 620ms backwards;
}

.modern-dashboard :is(.modern-task-item, .employee-request-row, .dashboard-table tbody tr) {
    animation: dashboard-row-enter 420ms ease-out backwards;
}

.modern-dashboard :is(.modern-task-item, .employee-request-row, .dashboard-table tbody tr):nth-child(1) { animation-delay: 520ms; }
.modern-dashboard :is(.modern-task-item, .employee-request-row, .dashboard-table tbody tr):nth-child(2) { animation-delay: 565ms; }
.modern-dashboard :is(.modern-task-item, .employee-request-row, .dashboard-table tbody tr):nth-child(3) { animation-delay: 610ms; }
.modern-dashboard :is(.modern-task-item, .employee-request-row, .dashboard-table tbody tr):nth-child(4) { animation-delay: 655ms; }
.modern-dashboard :is(.modern-task-item, .employee-request-row, .dashboard-table tbody tr):nth-child(5) { animation-delay: 700ms; }

@keyframes dashboard-item-enter {
    from { transform: translateY(14px) scale(.985); }
    to { transform: translateY(0) scale(1); }
}

@keyframes dashboard-row-enter {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes dashboard-bar-rise {
    from { opacity: .25; transform: scaleY(.08); }
    to { opacity: 1; transform: scaleY(1); }
}

@keyframes dashboard-chart-enter {
    from { opacity: 0; transform: scale(.88) rotate(-4deg); }
    to { opacity: 1; transform: scale(1) rotate(0); }
}

@media (prefers-reduced-motion: reduce) {
    .modern-dashboard .summary-card,
    .modern-dashboard .dashboard-card,
    .modern-dashboard .month-bar .bar,
    .modern-dashboard .gender-pie-svg,
    .modern-dashboard :is(.modern-task-item, .employee-request-row, .dashboard-table tbody tr) {
        animation: none !important;
    }
}

.modern-dashboard {
    --dash-surface: #ffffff;
    --dash-panel: #f8fafc;
    --dash-border: #e2e8f0;
    --dash-text: #1e293b;
    --dash-muted: #64748b;
    --dash-primary: #0F766E;
    --dash-primary-dark: #0b716c;
    --dash-soft: #eaf8f7;
    gap: 1rem;
}

.modern-dashboard .summary-grid { gap: .7rem; }

.modern-dashboard .summary-card,
.modern-dashboard .dashboard-card {
    border: 1px solid var(--dash-border);
    border-radius: 15px;
    background: var(--dash-surface);
    box-shadow: 0 4px 14px rgba(15, 23, 42, .055);
}

.modern-dashboard .summary-card {
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.modern-dashboard .summary-card:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--summary-color, var(--dash-primary)) 34%, var(--dash-border));
    box-shadow: 0 9px 22px rgba(15, 23, 42, .08);
}

.modern-dashboard .summary-total {
    background: linear-gradient(145deg, #12847d, #0d706b);
    border-color: transparent;
    box-shadow: 0 8px 20px rgba(13, 112, 107, .2);
}

.modern-dashboard .summary-cos {
    background: #f7faff;
    border-color: #cbdcff;
}

.modern-dashboard .summary-label {
    font-size: .72rem;
    letter-spacing: .015em;
}

.modern-dashboard .summary-card strong {
    font-size: 1.58rem;
    line-height: 1.05;
}

.modern-dashboard .dashboard-card { padding: 1rem; }

.modern-dashboard .card-header {
    margin: 0 0 .9rem;
    padding: .72rem .85rem;
    border-bottom: 1px solid var(--dash-border);
    border-radius: 11px 11px 0 0;
    background: #f8fafc;
}

.modern-dashboard .card-header h2 {
    color: var(--dash-text);
    font-size: .94rem;
    font-weight: 700;
}

.modern-dashboard .card-header p {
    margin-top: .16rem;
    color: var(--dash-muted);
    font-size: .72rem;
}

.modern-dashboard .modern-task-item,
.modern-dashboard .gender-stat,
.modern-dashboard .history-item,
.modern-dashboard .recent-leave-table {
    border-color: var(--dash-border);
    background: #fbfdff;
}

.modern-dashboard .modern-task-item:hover {
    border-color: #b9ddda;
    background: #f7fcfc;
}

.modern-dashboard .task-view-button,
.modern-dashboard .task-done-button,
.modern-dashboard .dashboard-filter-menu summary,
.modern-dashboard .dashboard-filter-option {
    min-height: auto;
    border-radius: 9px;
}

.modern-dashboard .task-view-button {
    color: #334155;
    border-color: var(--dash-border);
    background: #fff;
}

.modern-dashboard .task-done-button {
    border-color: var(--dash-primary-dark);
    background: var(--dash-primary-dark);
}

.modern-dashboard .dashboard-filter-menu summary {
    border-color: var(--dash-border);
    background: #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .05);
}

.modern-dashboard .dashboard-filter-panel {
    border-color: var(--dash-border);
    border-radius: 11px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, .14);
}

.modern-dashboard .dashboard-filter-option:hover,
.modern-dashboard .dashboard-filter-option.is-selected {
    color: var(--dash-primary-dark);
    background: var(--dash-soft);
}

.modern-dashboard .gender-pie-svg {
    filter: drop-shadow(0 8px 14px rgba(15, 23, 42, .08));
}

.modern-dashboard .new-hired-plot,
.modern-dashboard .recent-leave-table {
    border-radius: 11px;
}

@media (max-width: 900px) {
    .modern-dashboard .summary-grid { gap: .6rem; }
    .modern-dashboard .dashboard-card { padding: .85rem; }
    .modern-dashboard .card-header { padding: .68rem .72rem; }
}

@media (max-width: 640px) {
    .modern-dashboard .summary-card,
    .modern-dashboard .dashboard-card { border-radius: 13px; }
    .modern-dashboard .summary-card strong { font-size: 1.45rem; }
    .modern-dashboard .summary-card:hover { transform: none; }
}

/* Dashboard filter floating labels: centered on the top border */
.modern-dashboard .gender-filter-menu summary::before,
.modern-dashboard .year-filter-menu summary::before {
    top: .08rem;
    transform: translateY(-50%);
    padding: 0 .32rem;
    border-radius: 999px;
    background: #ffffff;
    line-height: 1.1;
}

/* Match the lower dashboard row to the Original Appointments / Recently Filed Leave proportions */
.modern-dashboard .dashboard-lower-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr);
    align-items: stretch;
}

.modern-dashboard .records-card,
.modern-dashboard .history-card {
    min-height: 390px;
}

@media (max-width: 900px) {
    .modern-dashboard .dashboard-lower-grid {
        grid-template-columns: 1fr;
    }
}
