/* ==========================================================================
   UHC Dashboard — UI Refresh
   Loaded AFTER style.css / responisve.css so these rules win.
   Goal: modernize spacing, depth, typography and add the hierarchical
   (org reporting-line) report styling used by the Team view.
   ========================================================================== */

:root {
    --uhc-navy: #122b40;
    --uhc-navy-2: #0d2233;
    --uhc-primary: #115480;
    --uhc-primary-600: #0e466b;
    --uhc-primary-100: #e3eef6;
    --uhc-accent: #2d8cff;
    --uhc-ink: #16263a;
    --uhc-muted: #64748b;
    --uhc-line: #e6edf3;
    --uhc-surface: #ffffff;
    --uhc-bg: #f4f7fb;
    --uhc-ok: #15803d;
    --uhc-ok-bg: #dcfce7;
    --uhc-warn: #b45309;
    --uhc-warn-bg: #fef3c7;
    --uhc-bad: #b91c1c;
    --uhc-bad-bg: #fee2e2;
    --uhc-radius: 14px;
    --uhc-radius-sm: 10px;
    --uhc-shadow-sm: 0 1px 2px rgba(16, 38, 58, .06), 0 1px 3px rgba(16, 38, 58, .05);
    --uhc-shadow-md: 0 6px 20px -6px rgba(16, 38, 58, .18), 0 2px 6px rgba(16, 38, 58, .06);
}

body { background-color: var(--uhc-bg); color: var(--uhc-ink); -webkit-font-smoothing: antialiased; }

/* ---------- Header ---------- */
header { box-shadow: 0 1px 0 var(--uhc-line), 0 4px 16px -10px rgba(16,38,58,.25); }
.custom-btn {
    height: 40px; border-radius: 10px; font-weight: 500;
    border: 1px solid var(--uhc-line); background: #fff; transition: all .18s ease;
}
.custom-btn:hover { background: var(--uhc-primary); border-color: var(--uhc-primary); box-shadow: var(--uhc-shadow-sm); }
.dropdown-menu.shadow-sm { border-radius: 12px; border: 1px solid var(--uhc-line); box-shadow: var(--uhc-shadow-md) !important; padding: 6px; }
.dropdown-menu .dropdown-item { border-radius: 8px; font-size: 14px; padding: 8px 12px; }
.dropdown-menu .dropdown-item:hover { background: var(--uhc-primary-100); color: var(--uhc-primary-600); }

/* ---------- Top navigation (sidebar converted to a horizontal bar) ---------- */
.main-wrapper { flex-direction: column; flex-wrap: nowrap; }
.main-left {
    width: 100% !important; height: auto !important; flex: 0 0 auto;
    position: sticky; top: 91px; z-index: 60;
    padding: 0 !important; border: none !important; overflow: visible !important;
    background: linear-gradient(90deg, var(--uhc-navy) 0%, var(--uhc-navy-2) 100%);
    box-shadow: 0 2px 12px -5px rgba(16, 38, 58, .45);
}
.main-left-group { display: flex; align-items: center; width: 100%; }
.main-left-group h2 { display: none !important; }
.nav-bar-list {
    display: flex !important; flex-wrap: wrap; align-items: center; gap: 4px;
    padding: 8px 20px; width: 100%; margin: 0;
}
.nav-bar-list li { margin: 0 !important; }
.nav-link {
    width: auto !important; border-radius: 10px; padding: 9px 14px; gap: 9px; font-weight: 500;
    color: #b7c6d3; transition: all .16s ease; white-space: nowrap;
}
.nav-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-link.active { background: var(--uhc-primary); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.nav-link.active svg { stroke: #fff; }

/* right pane now spans full width under the top nav */
.main-right { width: 100% !important; padding-left: 0 !important; }

/* footer only appears on the Admin page */
body:not(.admin-page) footer { display: none !important; }

@media (max-width: 640px) {
    .nav-bar-list { padding: 6px 12px; gap: 2px; }
    .nav-link { padding: 8px 10px; font-size: 14px; }
}

/* ---------- Headings ---------- */
.main-heading h1 { font-weight: 700; font-size: 28px; letter-spacing: -.01em; }
.main-heading p { color: var(--uhc-muted); }

/* ---------- Team heading with inline filter toolbar ---------- */
.team-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px 18px; margin-bottom: 16px; }
.team-heading .th-titles h1 { margin: 0; font-weight: 700; font-size: 26px; letter-spacing: -.01em; }
.team-heading .th-titles p { margin: 2px 0 0; color: var(--uhc-muted); font-size: 14px; }
.team-filter-inline { flex: 1 1 560px; min-width: 0; }
.team-filter-inline .team-form-row { justify-content: flex-end; align-items: center; gap: 8px 10px; }

/* ---------- Team summary strip ---------- */
.team-summary { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 4px; }
.ts-chip { flex: 1 1 120px; background: var(--uhc-surface); border: 1px solid var(--uhc-line); border-radius: 12px; padding: 12px 14px; box-shadow: var(--uhc-shadow-sm); position: relative; overflow: hidden; }
.ts-chip::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(180deg, var(--uhc-primary), var(--uhc-accent)); }
.ts-v { font-size: 20px; font-weight: 800; color: var(--uhc-ink); line-height: 1; }
.ts-l { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--uhc-muted); margin-top: 5px; }
.ts-health { flex: 1 1 300px; display: flex; flex-direction: column; justify-content: center; }
.ts-health::before { display: none; }
.ts-health .ts-l { margin-top: 0; }

/* ---------- Filter bar (consolidated single-line toolbar) ---------- */
.team-filter-cover {
    background: var(--uhc-surface); border: 1px solid var(--uhc-line);
    border-radius: var(--uhc-radius); padding: 12px 14px; box-shadow: var(--uhc-shadow-sm);
    margin-bottom: 8px;
}
.team-form-row { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; }
.day-filter-col { flex: 0 0 auto; }
.role-filter-col { flex: 0 0 150px; }
.employee-search-col { flex: 0 1 170px; min-width: 140px; }
.custom-range-col { flex: 0 0 auto; display: flex; }
.department-filter-col { display: none !important; }          /* empty in source data */

/* consistent control height */
.filter-toggle, .form-search, .team-custom-range, .btn-export-custom { height: 40px; }
.filter-toggle { border-radius: 10px; border: 1px solid var(--uhc-line); }
.filter-toggle:hover { border-color: var(--uhc-primary); }
.form-search { border-radius: 10px; }

/* day presets as a connected segmented control */
.day-filter-list ul { display: inline-flex; align-items: center; gap: 2px; background: #eef2f6; border: 1px solid var(--uhc-line); border-radius: 11px; padding: 3px; }
.day-btn { border: none; background: transparent; color: var(--uhc-muted); font-weight: 600; font-size: 13px; height: 30px; padding: 0 12px; border-radius: 8px; transition: all .14s ease; }
.day-btn:hover { color: var(--uhc-primary); background: rgba(255,255,255,.6); }
.day-btn.active { background: #fff; color: var(--uhc-primary-600); box-shadow: 0 1px 2px rgba(16,38,58,.12); }

/* custom date range as one grouped pill: [ from – to | Apply | x ] */
.team-custom-range { display: inline-flex; align-items: center; gap: 4px; background: #fff; border: 1px solid var(--uhc-line); border-radius: 11px; padding: 3px 4px 3px 8px; }
.team-custom-range .tcr-label { display: none; }
.team-custom-range .tcr-sep { color: var(--uhc-muted); padding: 0 2px; }
.team-custom-range input[type=date] { width: 116px; height: 30px; border: none; background: transparent; font-size: 13px; color: var(--uhc-ink); outline: none; }
.team-custom-range #team-range-apply { background: var(--uhc-primary); color: #fff; border: none; font-weight: 600; height: 30px; padding: 0 14px; border-radius: 8px; cursor: pointer; }
.team-custom-range #team-range-apply:hover { background: var(--uhc-primary-600); }
.team-custom-range #team-range-clear { background: transparent; border: none; color: var(--uhc-muted); width: 26px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 17px; line-height: 1; }
.team-custom-range #team-range-clear:hover { color: var(--uhc-bad); background: var(--uhc-bad-bg); }
/* Export sits just outside the range pill */
.team-custom-range .btn-export-custom { height: 34px; padding: 0 16px; border-radius: 10px; margin-left: 6px; }

/* dashboard date toolbar lives on the heading line */
#dash-toolbar-host { display: flex; }
#dash-toolbar-host .dash-toolbar { background: none; border: none; box-shadow: none; padding: 0; gap: 10px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.main-heading { row-gap: 10px; }

/* ==========================================================================
   HIERARCHICAL ORG REPORT  (Team view)
   ========================================================================== */
.org-report { display: flex; flex-direction: column; gap: 16px; margin-top: 18px; }

/* a manager + their reports */
.org-group {
    background: var(--uhc-surface);
    border: 1px solid var(--uhc-line);
    border-radius: var(--uhc-radius);
    box-shadow: var(--uhc-shadow-sm);
    overflow: hidden;
}
.org-group.depth-0 { border-left: 4px solid var(--uhc-primary); }
.org-group.depth-1 { border-left: 4px solid var(--uhc-accent); }
.org-group.depth-2 { border-left: 4px solid #9ca3af; }

/* group header (clickable) */
.org-group-head {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 18px; cursor: pointer; user-select: none;
    background: linear-gradient(180deg, #fbfdff 0%, #f6f9fc 100%);
    border-bottom: 1px solid var(--uhc-line);
    transition: background .15s ease;
}
.org-group-head:hover { background: #eef4f9; }
.og-toggle {
    flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px;
    display: grid; place-items: center; background: #fff; border: 1px solid var(--uhc-line);
    color: var(--uhc-muted); transition: transform .18s ease;
    font-size: 13px; line-height: 1;
}
.org-group.collapsed .og-toggle { transform: rotate(-90deg); }
.org-group.collapsed .org-group-body { display: none; }

.og-avatar {
    flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px;
    display: grid; place-items: center; font-weight: 700; font-size: 15px; color: #fff;
    background: linear-gradient(135deg, var(--uhc-primary), var(--uhc-accent));
    letter-spacing: .02em;
}
.og-identity { flex: 1 1 auto; min-width: 0; }
.og-identity .og-name { font-weight: 700; font-size: 15px; color: var(--uhc-ink); }
.og-identity .og-role {
    display: inline-block; margin-top: 2px; font-size: 11px; font-weight: 600;
    letter-spacing: .04em; text-transform: uppercase; color: var(--uhc-primary-600);
    background: var(--uhc-primary-100); padding: 2px 8px; border-radius: 6px;
}
.og-count { font-size: 12px; color: var(--uhc-muted); margin-left: 8px; font-weight: 500; }

/* rollup chips in the header */
.og-rollup { display: flex; gap: 18px; flex: 0 0 auto; flex-wrap: wrap; }
.roll-chip { text-align: right; min-width: 64px; }
.roll-chip .rc-val { font-weight: 700; font-size: 15px; color: var(--uhc-ink); line-height: 1.1; }
.roll-chip .rc-lbl { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--uhc-muted); }

/* group body holds nested members / sub-groups */
.org-group-body { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.org-members { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }

/* ---------- Employee card (refined) ---------- */
.employee-card, .emp-card {
    background: #fff; border: 1px solid var(--uhc-line); border-radius: var(--uhc-radius-sm);
    padding: 16px; transition: all .18s ease;
}
.employee-card:hover, .emp-card:hover {
    border-color: var(--uhc-primary); box-shadow: var(--uhc-shadow-md); transform: translateY(-1px);
}
.emp-card .emp-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.emp-card .emp-mini-avatar {
    width: 36px; height: 36px; border-radius: 9px; flex: 0 0 auto;
    display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff;
    background: linear-gradient(135deg, #5b7488, #2f4a5e);
}
.emp-card .emp-name { font-weight: 600; font-size: 15px; color: var(--uhc-ink); line-height: 1.2; }
.emp-card .emp-role { font-size: 12px; color: var(--uhc-muted); }

.emp-status {
    font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
    background: var(--uhc-primary-100); color: var(--uhc-primary-600); white-space: nowrap;
}
.emp-status.present, .emp-status.active { background: var(--uhc-ok-bg); color: var(--uhc-ok); }
.emp-status.on-leave, .emp-status.holiday { background: var(--uhc-warn-bg); color: var(--uhc-warn); }
.emp-status.absent { background: var(--uhc-bad-bg); color: var(--uhc-bad); }

/* efficiency bar */
.eff-row { margin-bottom: 12px; }
.eff-head { display: flex; justify-content: space-between; font-size: 11px; color: var(--uhc-muted); margin-bottom: 5px; }
.eff-head b { color: var(--uhc-ink); font-size: 12px; }
.eff-bar { height: 7px; border-radius: 999px; background: #eef2f6; overflow: hidden; }
.eff-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--uhc-primary), var(--uhc-accent)); }
.eff-bar-fill.low { background: linear-gradient(90deg, #d97706, #f59e0b); }
.eff-bar-fill.bad { background: linear-gradient(90deg, #dc2626, #ef4444); }

.emp-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.stat-item { background: #f7fafc; border: 1px solid var(--uhc-line); border-radius: 9px; padding: 9px 10px; display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: 10px; letter-spacing: .04em; text-transform: uppercase; color: var(--uhc-muted); }
.stat-value { font-size: 14px; font-weight: 700; color: var(--uhc-ink); }

/* states */
.hier-loading, .hier-empty { text-align: center; padding: 48px 16px; color: var(--uhc-muted); }
.hier-empty svg { opacity: .4; margin-bottom: 8px; }

/* responsive */
@media (max-width: 900px) {
    .og-rollup { width: 100%; justify-content: flex-start; margin-top: 8px; }
    .org-group-head { flex-wrap: wrap; }
}

/* ==========================================================================
   ROW-BASED TEAM TABLE + DRILL-DOWN  (new admin view)
   ========================================================================== */
.org-head {
    display: flex; align-items: center; gap: 14px; margin: 18px 0 6px;
}
.org-title { font-size: 19px; font-weight: 700; color: var(--uhc-ink); margin: 0; }
.org-sub { font-size: 13px; color: var(--uhc-muted); margin: 2px 0 0; }
.org-back {
    border: 1px solid var(--uhc-line); background: #fff; color: var(--uhc-primary-600);
    font-weight: 600; font-size: 13px; padding: 8px 14px; border-radius: 10px; cursor: pointer;
    transition: all .15s ease; white-space: nowrap;
}
.org-back:hover { background: var(--uhc-primary); color: #fff; border-color: var(--uhc-primary); }

.team-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.btn-export-custom {
    display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
    background: var(--uhc-primary); color: #fff; border: none; font-weight: 600; font-size: 14px;
    padding: 10px 16px; border-radius: 10px; box-shadow: var(--uhc-shadow-sm); transition: all .15s ease;
}
.btn-export-custom:hover { background: var(--uhc-primary-600); box-shadow: var(--uhc-shadow-md); }

.org-table-wrap {
    border: 1px solid var(--uhc-line); border-radius: var(--uhc-radius); overflow: auto;
    background: #fff; box-shadow: var(--uhc-shadow-sm); margin-bottom: 18px;
}
.org-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 920px; }
.org-table thead th {
    position: sticky; top: 0; z-index: 2;
    background: var(--uhc-navy); color: #dce6ee; font-weight: 600; font-size: 11px;
    letter-spacing: .05em; text-transform: uppercase; text-align: right;
    padding: 11px 14px; white-space: nowrap;
}
.org-table thead th.td-name, .org-table thead th.td-role { text-align: left; }
.org-table tbody td { padding: 0 14px; height: 46px; border-bottom: 1px solid var(--uhc-line); vertical-align: middle; }
.org-table tbody tr:last-child td { border-bottom: none; }
.td-name { text-align: left; font-weight: 500; color: var(--uhc-ink); white-space: nowrap; }
.td-role { text-align: left; color: var(--uhc-muted); font-size: 12.5px; white-space: nowrap; }
.td-num, .td-time, .td-eff { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* row variants */
.row-ceo td { background: #eef4f9; }
.row-ceo .td-name .rname, .row-manager .td-name .rname { font-weight: 700; }
.row-manager td { background: #fafcfe; }
.row-manager[data-drill] { cursor: pointer; }
.row-manager[data-drill]:hover td, .row-ceo[data-drill]:hover td { background: var(--uhc-primary-100); }
.row-member:nth-of-type(even) td { background: #fbfcfe; }
.row-member:hover td { background: var(--uhc-primary-100) !important; }
.org-table tbody tr { transition: background .12s ease; }

.row-count {
    display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 700;
    color: var(--uhc-primary-600); background: var(--uhc-primary-100);
    padding: 1px 8px; border-radius: 999px;
}
.drill-chevron { margin-left: 8px; color: var(--uhc-primary); font-weight: 700; font-size: 16px; }
.rname-link { cursor: pointer; }
.rname-link:hover { color: var(--uhc-primary); text-decoration: underline; text-underline-offset: 2px; }

/* status + efficiency cells */
.td-status { display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: #eef2f6; color: var(--uhc-muted); }
.td-status.present { background: var(--uhc-ok-bg); color: var(--uhc-ok); }
.td-status.on-leave, .td-status.holiday { background: var(--uhc-warn-bg); color: var(--uhc-warn); }
.td-status.absent { background: var(--uhc-bad-bg); color: var(--uhc-bad); }
.td-eff { min-width: 90px; }
.td-eff .eff-num { font-weight: 700; }
.eff-mini { display: inline-block; width: 46px; height: 6px; border-radius: 999px; background: #eef2f6; margin-left: 8px; vertical-align: middle; overflow: hidden; }
.eff-mini-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--uhc-primary), var(--uhc-accent)); }
.eff-mini-fill.low { background: linear-gradient(90deg, #d97706, #f59e0b); }
.eff-mini-fill.bad { background: linear-gradient(90deg, #dc2626, #ef4444); }

/* ==========================================================================
   CUSTOM EXPORT MODAL
   ========================================================================== */
.export-overlay {
    position: fixed; inset: 0; z-index: 1000; display: none;
    background: rgba(16, 38, 58, .45); backdrop-filter: blur(2px);
    align-items: center; justify-content: center; padding: 20px;
}
.export-overlay.open { display: flex; }
.export-modal {
    background: #fff; width: 100%; max-width: 560px; border-radius: 16px;
    box-shadow: 0 24px 60px -12px rgba(16, 38, 58, .4); overflow: hidden;
    animation: expIn .16s ease;
}
@keyframes expIn { from { transform: translateY(8px); opacity: .6; } to { transform: none; opacity: 1; } }
.export-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--uhc-line);
    background: linear-gradient(180deg, #fbfdff, #f6f9fc);
}
.export-modal-head h3 { margin: 0; font-size: 17px; font-weight: 700; color: var(--uhc-ink); }
.export-x { border: none; background: none; font-size: 24px; line-height: 1; color: var(--uhc-muted); cursor: pointer; }
.export-x:hover { color: var(--uhc-ink); }
.export-modal-body { padding: 18px 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.export-field { display: flex; flex-direction: column; gap: 6px; }
.export-field-wide { grid-column: 1 / -1; }
.export-field > label { font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--uhc-muted); }
.export-field select {
    border: 1px solid var(--uhc-line); border-radius: 10px; padding: 9px 12px; font-size: 14px;
    color: var(--uhc-ink); background: #fff; outline: none;
}
.export-field select:focus { border-color: var(--uhc-primary); box-shadow: 0 0 0 3px var(--uhc-primary-100); }
.export-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 14px; }
.exp-col { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--uhc-ink); cursor: pointer; }
.export-formats { display: flex; gap: 18px; }
.export-formats label { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.export-modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--uhc-line); }
.btn-ghost { background: #fff; border: 1px solid var(--uhc-line); color: var(--uhc-ink); font-weight: 600; padding: 9px 16px; border-radius: 10px; cursor: pointer; }
.btn-ghost:hover { background: #f4f7fb; }
.btn-solid { background: var(--uhc-primary); border: none; color: #fff; font-weight: 600; padding: 9px 18px; border-radius: 10px; cursor: pointer; box-shadow: var(--uhc-shadow-sm); }
.btn-solid:hover { background: var(--uhc-primary-600); }

@media (max-width: 560px) {
    .export-modal-body { grid-template-columns: 1fr; }
    .export-cols { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================================================
   EXECUTIVE ANALYTICS DASHBOARD (index.html)
   ========================================================================== */
/* hide the legacy single-employee views — replaced by analytics */
#employee-grid-view, #employee-detail-view, #back-btn-container, #grid-date-container { display: none !important; }

#analytics-dashboard { display: flex; flex-direction: column; gap: 16px; }

.dash-toolbar {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
    background: var(--uhc-surface); border: 1px solid var(--uhc-line); border-radius: var(--uhc-radius);
    padding: 12px 14px; box-shadow: var(--uhc-shadow-sm);
}
.dash-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.dash-presets button {
    border: 1px solid var(--uhc-line); background: #fff; color: var(--uhc-muted);
    font-weight: 600; font-size: 13px; padding: 7px 14px; border-radius: 999px; cursor: pointer; transition: all .15s ease;
}
.dash-presets button:hover { color: var(--uhc-primary); border-color: var(--uhc-primary); }
.dash-presets button.active { background: var(--uhc-primary); color: #fff; border-color: var(--uhc-primary); }
.dash-range { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--uhc-muted); }
.dash-range input { width: 104px; box-sizing: border-box; border: 1px solid var(--uhc-line); border-radius: 8px; padding: 5px 8px; font-size: 12px; color: var(--uhc-ink); }
.dash-range #dash-apply { background: var(--uhc-primary); color: #fff; border: none; font-weight: 600; padding: 6px 13px; border-radius: 8px; font-size: 12px; cursor: pointer; }
.dash-range #dash-apply:hover { background: var(--uhc-primary-600); }
.dash-freshness { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11px; color: var(--uhc-muted); width: 100%; margin-top: 4px; }
.dash-freshness .df-lbl { font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.dash-freshness .df-item { padding: 2px 7px; border-radius: 999px; border: 1px solid var(--uhc-line); }
.dash-freshness .df-ok { color: #1d7a4d; border-color: #b7e6c4; background: #f0faf3; }
.dash-freshness .df-warn { color: #b26a00; border-color: #f0d9a8; background: #fff8ec; }
.dash-freshness .df-stale { color: #b3261e; border-color: #f1c4c0; background: #fdf1f0; }

/* KPI cards */
.dash-kpis { display: grid; grid-template-columns: 1.7fr repeat(6, 1fr); gap: 12px; }
/* Team-health composite card */
.kpi-health { display: flex; flex-direction: column; justify-content: center; }
.kpi-health::before { display: none; }
.health-bar { display: flex; height: 12px; border-radius: 7px; overflow: hidden; margin-bottom: 8px; background: #eef2f6; }
.health-bar span { display: block; height: 100%; }
.health-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--uhc-muted); }
.health-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.kpi-card { background: var(--uhc-surface); border: 1px solid var(--uhc-line); border-radius: var(--uhc-radius); padding: 16px; box-shadow: var(--uhc-shadow-sm); position: relative; overflow: hidden; }
.kpi-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--uhc-primary); }
.kpi-card.good::before { background: var(--uhc-ok); }
.kpi-card.warn::before { background: var(--uhc-warn); }
.kpi-val { font-size: 26px; font-weight: 800; color: var(--uhc-ink); letter-spacing: -.02em; line-height: 1; }
.kpi-lbl { font-size: 12px; font-weight: 600; color: var(--uhc-muted); margin-top: 6px; }
.kpi-sub { font-size: 11px; color: #9aa7b4; margin-top: 2px; }

.dash-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dash-3col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
/* individual score breakdown — everything in one line */
.bd-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.bd-card { border: 1px solid var(--uhc-line); border-radius: 10px; padding: 12px 14px; background: #f9fbfd; }
.bd-pct { font-size: 22px; font-weight: 800; color: var(--uhc-ink); line-height: 1; }
.bd-card.good .bd-pct { color: var(--uhc-ok); }
.bd-card.warn .bd-pct { color: var(--uhc-warn); }
.bd-card.bad .bd-pct { color: var(--uhc-bad); }
.bd-lbl { font-size: 11.5px; color: var(--uhc-muted); margin-top: 5px; line-height: 1.3; }
.bd-card.bonus { background: #f3f0fb; border-color: #d6c9ee; }
.bd-card.bonus .bd-pct { color: #6b4fae; }
.bd-card.total { background: var(--uhc-primary-100); border-color: var(--uhc-primary); }
.bd-card.total .bd-pct { color: var(--uhc-primary-600); }
@media (max-width: 1100px) { .bd-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .bd-grid { grid-template-columns: repeat(2, 1fr); } }

/* individual Performance card — big clickable score */
.kpi-health-ind { cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease; }
.kpi-health-ind:hover { border-color: var(--uhc-primary); box-shadow: var(--uhc-shadow-md); }
.kpi-score-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 4px 0 8px; }
.kpi-bigscore { font-size: 32px; font-weight: 800; line-height: 1; color: var(--uhc-ink); }
.kpi-bigscore.good { color: var(--uhc-ok); }
.kpi-bigscore.warn { color: var(--uhc-warn); }
.kpi-bigscore.bad { color: var(--uhc-bad); }
.kpi-view-hint { font-size: 11px; color: var(--uhc-primary); font-weight: 600; }

/* leader role — "My performance" block at top of dashboard */
.my-perf { margin-bottom: 18px; }
.my-perf-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.my-perf-head h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--uhc-ink); }
.my-perf-grid { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: stretch; }
.my-perf-bd { display: flex; align-items: center; }
.my-perf-bd .bd-grid { width: 100%; }
@media (max-width: 900px) { .my-perf-grid { grid-template-columns: 1fr; } }
.att-zero { color: var(--uhc-muted); }
/* metric calendars (Flowace / Zoom) — same box size as attendance, smaller font */
.cal-cell.cal-metric { background: #f5f9fc; border-color: #d8e6f0; }
.mc-rows { display: flex; flex-direction: column; gap: 0; margin-top: 2px; }
.mc-row { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font-size: 9.5px; line-height: 1.32; color: var(--uhc-ink); }
.mc-row i { font-style: normal; color: var(--uhc-muted); }
.mc-row b { font-weight: 700; }
.mc-row.mc-tot { margin-top: 1px; border-top: 1px solid #dce7f0; padding-top: 1px; }
.mc-row.mc-tot i, .mc-row.mc-tot b { color: var(--uhc-primary); }

/* On Leave & Away — show ~5 rows then scroll the rest */
.leave-scroll { max-height: 232px; overflow-y: auto; }
.leave-scroll table { width: 100%; }
.leave-scroll thead th { position: sticky; top: 0; background: #fff; z-index: 1; }

/* monthly attendance calendar (leader role) */
.cal-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-who { border: 1px solid var(--uhc-line); border-radius: 8px; padding: 7px 10px; font-size: 13px; font-weight: 600; color: var(--uhc-ink); background: #fff; min-width: 220px; max-width: 320px; }
.cal-who-label { font-size: 14px; font-weight: 700; color: var(--uhc-ink); padding: 6px 0; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-nav button { border: 1px solid var(--uhc-line); background: #fff; border-radius: 8px; width: 30px; height: 30px; font-size: 18px; line-height: 1; cursor: pointer; color: var(--uhc-ink); }
.cal-nav button:hover { border-color: var(--uhc-primary); color: var(--uhc-primary); }
.cal-month { font-size: 14px; font-weight: 700; color: var(--uhc-ink); min-width: 130px; text-align: center; }
.cal-legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-left: auto; font-size: 11.5px; color: var(--uhc-muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.lg-present { background: #b7e6a6; } .lg-absent { background: #ef5350; } .lg-leave { background: #a94464; } .lg-warn { background: #ffce4d; } .lg-hol { background: #3b2350; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { font-size: 11px; font-weight: 700; color: var(--uhc-muted); text-align: center; padding: 4px 0; letter-spacing: .04em; }
.cal-cell { min-height: 88px; border: 1px solid var(--uhc-line); border-radius: 8px; padding: 6px; background: #fff; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-cell.cal-empty { background: transparent; border: none; }
.cal-cell.cal-flag { background: #fff5ea; border-color: #f0c187; }
.cal-cell.cal-allgood { background: #f0faec; border-color: #cfe9c2; }
.cal-cell.cal-weekend { background: #f3ece0; border-color: #e3d7c1; }
/* individual day cells tinted by status */
.cal-cell.cal-c-present { background: #eefbe9; border-color: #cfe9c2; }
.cal-cell.cal-c-absent { background: #fdeceb; border-color: #f3bdbb; }
.cal-cell.cal-c-leave { background: #f9ecf1; border-color: #e6c2d2; }
.cal-cell.cal-c-half { background: #fff5e6; border-color: #f3dcb4; }
.cal-cell.cal-c-holiday { background: #efeaf4; border-color: #d6c9e6; }
.cal-cell.cal-c-present.cal-flag { background: #fff5ea; border-color: #f0c187; }
.cal-date { font-size: 12px; font-weight: 700; color: var(--uhc-ink); }
.cal-off { font-size: 11px; font-weight: 600; color: #8a774f; background: #e6d9bd; border-radius: 5px; padding: 2px 6px; align-self: flex-start; }
.cal-chips { display: flex; flex-direction: column; gap: 3px; }
.cal-chip { font-size: 10.5px; font-weight: 600; border-radius: 5px; padding: 2px 6px; color: #fff; align-self: flex-start; }
.cal-chip.bad { background: #ef5350; } .cal-chip.leave { background: #a94464; } .cal-chip.warn { background: #e9a100; } .cal-chip.hol { background: #3b2350; } .cal-chip.ok { background: #5cb85c; } .cal-chip.half { background: #f08a3c; }
.cal-status { font-size: 11px; font-weight: 600; border-radius: 5px; padding: 2px 6px; align-self: flex-start; }
.cal-status.present { background: #d7f3cb; color: #2c6e2c; } .cal-status.absent { background: #ef5350; color: #fff; } .cal-status.leave { background: #a94464; color: #fff; } .cal-status.half { background: #ffe0b2; color: #8a5a00; } .cal-status.holiday { background: #3b2350; color: #fff; } .cal-status.other { background: #eef2f6; color: var(--uhc-ink); }
.cal-clock { font-size: 10.5px; color: #8a6d00; background: #fff1bf; border-radius: 5px; padding: 1px 6px; align-self: flex-start; }
.cal-hrs { font-size: 10.5px; color: var(--uhc-muted); }
.cal-hrs.low { color: var(--uhc-bad); font-weight: 600; }
@media (max-width: 760px) { .cal-cell { min-height: 64px; } .cal-legend { margin-left: 0; } }

/* scrollable performer lists: ~5 rows visible, scroll for the rest */
.scroll-list { max-height: 322px; overflow-y: auto; }
.scroll-list::-webkit-scrollbar { width: 7px; }
.scroll-list::-webkit-scrollbar-thumb { background: #d7dee6; border-radius: 10px; }
@media (max-width: 980px) { .dash-3col { grid-template-columns: 1fr; } }
.dash-panel { background: var(--uhc-surface); border: 1px solid var(--uhc-line); border-radius: var(--uhc-radius); padding: 16px 18px; box-shadow: var(--uhc-shadow-sm); }
.dash-panel-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.dash-panel-head h3 { font-size: 15px; font-weight: 700; color: var(--uhc-ink); margin: 0; }
.dash-panel-sub { font-size: 11px; color: var(--uhc-muted); text-transform: uppercase; letter-spacing: .04em; }
.dash-empty { color: var(--uhc-muted); font-size: 13px; padding: 20px 4px; text-align: center; }

/* leaderboard rows */
.lead-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--uhc-line); }
.lead-row:last-child { border-bottom: none; }
.lead-rank { width: 20px; text-align: center; font-weight: 800; color: #c0cbd6; font-size: 14px; }
.lead-av { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #fff; background: linear-gradient(135deg, var(--uhc-primary), var(--uhc-accent)); flex: 0 0 auto; }
.lead-id { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.lead-name { font-weight: 600; font-size: 14px; color: var(--uhc-ink); }
.lead-role { font-size: 11.5px; color: var(--uhc-muted); }
.lead-metric { text-align: right; }
.lead-mval { font-weight: 800; font-size: 15px; }
.lead-mval.ok { color: var(--uhc-ok); }
.lead-mval.low { color: var(--uhc-warn); }
.lead-mval.bad { color: var(--uhc-bad); }
.lead-mlbl { display: block; font-size: 10.5px; color: var(--uhc-muted); }

/* team leaderboard table */
.dash-team-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dash-team-table th { text-align: right; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--uhc-muted); padding: 6px 8px; border-bottom: 1px solid var(--uhc-line); }
.dash-team-table th:first-child { text-align: left; }
.dash-team-table td { text-align: right; padding: 9px 8px; border-bottom: 1px solid var(--uhc-line); font-variant-numeric: tabular-nums; }
.dash-team-table td:first-child { text-align: left; }
.dash-team-table tr:last-child td { border-bottom: none; }
.ttname { font-weight: 600; color: var(--uhc-ink); }
.ttrole { display: block; font-size: 11px; font-weight: 400; color: var(--uhc-muted); }
.dash-team-table td.pos { color: var(--uhc-ok); font-weight: 700; }
.dash-team-table td.neg { color: var(--uhc-bad); font-weight: 700; }

/* attendance bars */
.att-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; cursor: help; position: relative; }
.att-row:hover .att-k { color: var(--uhc-primary); }
.att-pop {
    display: none; position: absolute; z-index: 30; top: 100%; left: 0; min-width: 200px; max-width: 280px;
    margin-top: 4px; background: var(--uhc-surface); border: 1px solid var(--uhc-line);
    border-radius: 10px; box-shadow: var(--uhc-shadow-md); padding: 10px 12px;
}
.att-row:hover .att-pop { display: block; }
.att-pop-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--uhc-muted); margin-bottom: 6px; }
.att-pop-list { font-size: 12.5px; color: var(--uhc-ink); line-height: 1.6; max-height: 168px; overflow-y: auto; }
/* individual attendance: under-8h days flagged red with a remark */
.att-flag td { background: var(--uhc-bad-bg) !important; }
.att-flag .hrs-low { color: var(--uhc-bad); font-weight: 700; }
.att-remark { color: var(--uhc-bad); font-weight: 600; font-size: 12px; white-space: nowrap; }
.att-warn { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--uhc-bad); color: #fff; font-size: 10px; font-weight: 700; font-style: normal; margin-right: 4px; vertical-align: middle; }
.att-ok { color: var(--uhc-ok); font-weight: 600; font-size: 12px; white-space: nowrap; }
.att-tick { font-style: normal; font-weight: 700; margin-right: 3px; }
.att-k { width: 78px; font-size: 13px; color: var(--uhc-ink); }
.att-bar { flex: 1 1 auto; height: 10px; border-radius: 999px; background: #eef2f6; overflow: hidden; }
.att-bar span { display: block; height: 100%; border-radius: 999px; }
.att-v { width: 28px; text-align: right; font-weight: 700; font-size: 13px; color: var(--uhc-ink); }

#dash-trend { max-height: 260px; }

@media (max-width: 1100px) { .dash-kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) { .dash-2col { grid-template-columns: 1fr; } .dash-kpis { grid-template-columns: repeat(2, 1fr); } }

/* clickable leaderboard / performer / member rows */
.lead-clickable { cursor: pointer; border-radius: 8px; transition: background .12s ease; }
.lead-clickable:hover { background: var(--uhc-primary-100); }
.dash-team-table tr.team-clickable { cursor: pointer; }
.dash-team-table tr.team-clickable:hover td { background: var(--uhc-primary-100); }
.org-table tr.member-clickable { cursor: pointer; }
.org-table tr.member-clickable:hover td { background: var(--uhc-primary-100); }
.org-table tr.member-clickable .drill-chevron { color: var(--uhc-muted); }

/* ==========================================================================
   DRILL-DOWN DETAIL MODAL (shared)
   ========================================================================== */
.detail-overlay {
    position: fixed; inset: 0; z-index: 1000; display: none;
    background: rgba(16, 38, 58, .45); backdrop-filter: blur(2px);
    align-items: center; justify-content: center; padding: 20px;
}
.detail-overlay.open { display: flex; }
.detail-card { background: #fff; width: 100%; max-width: 640px; border-radius: 16px; box-shadow: 0 24px 60px -12px rgba(16, 38, 58, .4); overflow: hidden; animation: expIn .16s ease; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--uhc-line); background: linear-gradient(180deg, #fbfdff, #f6f9fc); }
.detail-head h3 { margin: 0; font-size: 19px; font-weight: 800; color: var(--uhc-ink); }
.detail-head p { margin: 3px 0 0; font-size: 12.5px; color: var(--uhc-muted); }
.detail-x { border: none; background: none; font-size: 26px; line-height: 1; color: var(--uhc-muted); cursor: pointer; }
.detail-x:hover { color: var(--uhc-ink); }
.detail-body { padding: 18px 22px; max-height: 70vh; overflow: auto; }
.detail-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.dm { border: 1px solid var(--uhc-line); border-radius: 12px; padding: 14px; background: #f9fbfd; }
.dm-v { font-size: 19px; font-weight: 800; color: var(--uhc-ink); line-height: 1.1; }
.dm-l { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--uhc-muted); margin-top: 5px; }
.dm.good .dm-v { color: var(--uhc-ok); }
.dm.warn .dm-v { color: var(--uhc-warn); }
.dm.bad .dm-v { color: var(--uhc-bad); }
.ed-section { margin-bottom: 18px; }
.ed-section:last-child { margin-bottom: 0; }
.ed-sec-head { font-size: 12.5px; font-weight: 700; color: var(--uhc-primary-600); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--uhc-line); }
/* modal headline: score badge + reporting line */
.ed-headline { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0 0 12px; }
.ed-score { font-size: 13px; font-weight: 700; padding: 4px 12px; border-radius: 999px; background: var(--uhc-primary-100); color: var(--uhc-primary-600); }
.ed-score.good { background: var(--uhc-ok-bg); color: var(--uhc-ok); }
.ed-score.warn { background: var(--uhc-warn-bg); color: var(--uhc-warn); }
.ed-score.bad { background: var(--uhc-bad-bg); color: var(--uhc-bad); }
.ed-belong { font-size: 13px; color: var(--uhc-muted); }
/* inline date-range picker */
.ed-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; padding: 10px 12px; background: #f7fafc; border: 1px solid var(--uhc-line); border-radius: 10px; }
.ed-range-l { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--uhc-muted); }
.ed-range-sep { color: var(--uhc-muted); font-size: 13px; }
.ed-range input { width: 110px; box-sizing: border-box; border: 1px solid var(--uhc-line); border-radius: 8px; padding: 6px 9px; font-size: 12.5px; color: var(--uhc-ink); }
.ed-range #ed-apply { background: var(--uhc-primary); color: #fff; border: none; font-weight: 600; padding: 8px 16px; border-radius: 9px; cursor: pointer; }
.ed-range #ed-apply:hover { background: var(--uhc-primary-600); }
.ed-range #ed-apply:disabled { opacity: .6; cursor: default; }
/* criteria checklist (prorated points per criterion) */
.ed-crit-list { font-size: 13.5px; color: var(--uhc-ink); }
.ed-crit-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--uhc-line); }
.ed-crit-row:last-child { border-bottom: none; }
.ed-crit-pts { font-weight: 700; font-variant-numeric: tabular-nums; }
.ed-crit-pts.ok { color: var(--uhc-ok); }
.ed-crit-pts.partial { color: var(--uhc-warn); }
.ed-crit-pts.no { color: var(--uhc-bad); }
@media (max-width: 600px) { .detail-metrics { grid-template-columns: repeat(2, 1fr); } }
