/* ============================================================
   ADS styles - Leave: merged leave.css (calendar widget, forms, exceptions, HR overview, push banner)
   Split out of the former monolithic style.css WITHOUT code changes.
   Files are linked in numeric order (see Core/templates/_styles.html) so
   the cascade is identical to the old single file.
   ============================================================ */

/* =================================================================
   BEGIN merged module: leave.css
   ================================================================= */

/* ============================================================
   ADS Leave Management module - additive styles
   Appended to style.css (or linked separately, see leave_INTEGRATION.md).
   Reuses the existing :root variables and .ts-btn / .ts-badge /
   .modal / .page-screen component classes already defined in
   style.css - nothing here overrides or duplicates them.
   ============================================================ */

/* ---- Dashboard calendar widget ---- */
.lv-cal-widget {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    padding: 16px;
    margin-bottom: 16px;
}

.lv-cal-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.lv-cal-widget-header h4 {
    margin: 0;
    font-size: 14px;
    color: var(--gray-900);
    font-weight: 600;
}

.lv-cal-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lv-cal-nav button {
    background: var(--gray-100);
    border: none;
    border-radius: 6px;
    width: 26px;
    height: 26px;
    cursor: pointer;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    justify-content: center;
}
.lv-cal-nav button:hover { background: var(--green-lite); color: var(--green-dark); }

.lv-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.lv-cal-dow {
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    padding-bottom: 4px;
}

.lv-cal-day {
    position: relative;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    border: 1.5px solid var(--gray-200);
    background: var(--white);
    color: var(--text);
    transition: transform .08s ease;
}
.lv-cal-day:hover { transform: scale(1.06); box-shadow: var(--shadow-sm); }
.lv-cal-day.lv-cal-blank { visibility: hidden; cursor: default; }
.lv-cal-day.lv-cal-outlined-today { border: 2px solid var(--blue); font-weight: 700; }

.lv-cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
    font-size: 11px;
    color: var(--gray-600);
}
.lv-cal-legend-item { display: flex; align-items: center; gap: 5px; }
.lv-cal-legend-dot { width: 10px; height: 10px; border-radius: 3px; border: 1px solid var(--gray-200); display: inline-block; }

/* ---- Leave application form ---- */
.lv-form-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.lv-form-field { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 4px; }
.lv-form-field label { font-size: 12px; font-weight: 600; color: var(--gray-700); }
.lv-type-toggle { display: flex; gap: 8px; margin-bottom: 14px; }
.lv-type-toggle button {
    flex: 1; padding: 10px; border-radius: 8px; border: 1.5px solid var(--gray-200);
    background: var(--gray-50); color: var(--gray-700); font-weight: 600; cursor: pointer;
}
.lv-type-toggle button.active { background: var(--green-lite); border-color: var(--green); color: var(--green-dark); }
.lv-hours-preview {
    background: var(--green-lite); border: 1px solid var(--green-mid); border-radius: 8px;
    padding: 8px 12px; font-size: 12px; color: var(--green-dark); font-weight: 600;
}

/* ---- Requests list / approvals ---- */
.lv-req-card {
    display: flex; align-items: center; justify-content: space-between;
    border: 1px solid var(--gray-200); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px;
    background: var(--white);
}
.lv-req-main { display: flex; flex-direction: column; gap: 3px; }
.lv-req-date { font-weight: 600; color: var(--gray-900); font-size: 13px; }
.lv-req-meta { font-size: 12px; color: var(--gray-600); }
.lv-req-actions { display: flex; gap: 8px; }

.lv-badge { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: capitalize; }
.lv-badge-pending   { background: #fff7ed; color: #ea580c; }
.lv-badge-approved  { background: var(--green-lite); color: var(--green-dark); }
.lv-badge-rejected  { background: #f3f4f6; color: #6b7280; }
.lv-badge-cancelled { background: #f3f4f6; color: #9ca3af; }

/* ---- Super Admin config cards ---- */
.lv-admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: 16px; }
.lv-color-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--gray-100); }
.lv-color-row input[type=color] { width: 40px; height: 28px; border: none; border-radius: 6px; cursor: pointer; background: none; }

/* ---- Delivery Manager: Exceptions Summary card ----
   Lives beside the calendar (reparented into dash-top-right by
   loadDashboardExceptions() in script.js), so it gets its own roomy
   horizontal layout rather than reusing the narrow lv-balance-* tiles
   built for a 300px sidebar column. */
.dm-exc-card {
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow: visible;
}
.dm-exc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    row-gap: 4px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-100, #f3f4f6);
}
.dm-exc-header-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 7px;
}
.dm-exc-header-title i { color: #d97706; }
.dm-exc-header-hint {
    font-size: 11px;
    color: var(--gray-400);
    display: flex;
    align-items: center;
    gap: 5px;
}
.dm-exc-stats {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}
.dm-exc-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 1 200px;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--gray-lite, #f9fafb);
    border: 1px solid var(--gray-100, #f3f4f6);
    position: relative;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}
.dm-exc-stat:hover,
.dm-exc-stat.dm-exc-active {
    background: #fff7ed;
    border-color: #fed7aa;
}
.dm-exc-stat-highlight:hover,
.dm-exc-stat-highlight.dm-exc-active {
    background: #ecfdf5;
    border-color: #a7f3d0;
}
.dm-exc-stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #fef3c7;
    color: #d97706;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.dm-exc-stat-highlight .dm-exc-stat-icon { background: #dcfce7; color: #16a34a; }
.dm-exc-stat-body { min-width: 0; }
.dm-exc-stat-value { font-size: 20px; font-weight: 800; color: var(--gray-900); line-height: 1.1; }
.dm-exc-stat-highlight .dm-exc-stat-value { color: #16a34a; }
.dm-exc-stat-label { font-size: 11px; font-weight: 600; color: var(--gray-500); margin-top: 2px; }

/* ---- Delivery Manager: exceptions summary hover/click detail popup ----
   Pure :hover for mouse users, PLUS a JS-toggled .dm-exc-active class
   (see script.js) so it also works on touch/tablet devices where CSS
   :hover never fires at all. overflow:visible is asserted explicitly
   up the ancestor chain so the popup is never silently clipped. */
.dm-exc-stat-hoverable { overflow: visible; }
.dm-exc-hover-detail {
    display: none;
    position: absolute;
    z-index: 4000;
    top: 100%;
    left: 0;
    margin-top: 10px;
    width: 300px;
    max-height: 320px;
    overflow-y: auto;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
    padding: 0;
    text-align: left;
    pointer-events: none;
    cursor: default;
}
.dm-exc-stat-hoverable:hover .dm-exc-hover-detail,
.dm-exc-stat-hoverable.dm-exc-active .dm-exc-hover-detail {
    display: block;
    pointer-events: auto;
}
.dm-exc-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-700);
    padding: 10px 14px;
    border-bottom: 1px solid var(--gray-100);
    position: sticky;
    top: 0;
    background: var(--white);
    border-radius: 12px 12px 0 0;
}
.dm-exc-popup-count {
    background: var(--gray-100, #f3f4f6);
    color: var(--gray-600);
    font-size: 11px;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 999px;
}
.dm-exc-popup-list { padding: 6px 8px; }
.dm-exc-popup-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 6px;
    border-radius: 8px;
    flex-wrap: wrap;
}
.dm-exc-popup-row:hover { background: var(--gray-lite, #f9fafb); }
.dm-exc-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #eef2ff;
    color: #4338ca;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dm-exc-popup-name { font-size: 12px; font-weight: 600; color: var(--gray-800); flex: 1 1 auto; min-width: 0; }
.dm-exc-popup-badges { display: flex; gap: 5px; flex-wrap: wrap; }
.dm-exc-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 999px;
    white-space: nowrap;
}
.dm-badge-timesheet { background: #fef3c7; color: #b45309; }
.dm-badge-leave { background: #dcfce7; color: #15803d; }
.dm-badge-other { background: var(--gray-100, #f3f4f6); color: var(--gray-600); }
.dm-exc-hover-empty {
    font-size: 12px;
    color: var(--gray-400);
    padding: 16px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.dm-exc-hover-empty i { color: #16a34a; }

@media (max-width: 900px) {
    .dm-exc-stats { flex-direction: column; }
    .dm-exc-stat { flex: 1 1 auto; }
    .dm-exc-hover-detail { left: auto; right: 0; width: min(300px, 90vw); }
}

.lv-balance-stats, .lv-balance-card, .dash-leave-row, .page-body { overflow: visible; }

/* ---- Push-notification "Enable" banner (gesture-triggered permission ask) ---- */
.ads-push-banner {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 92vw;
    background: var(--gray-900, #111827);
    color: #fff;
    border-radius: 10px;
    padding: 10px 12px 10px 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    font-size: 13px;
}
.ads-push-banner i { color: #facc15; }
.ads-push-banner.ads-push-banner-warn { background: #7c2d12; }
.ads-push-banner.ads-push-banner-warn i { color: #fdba74; }
.ads-push-banner span { flex: 1; min-width: 160px; }
.ads-push-banner .ts-btn { white-space: nowrap; }
.ads-push-banner-dismiss {
    background: none; border: none; color: #9ca3af; font-size: 18px; line-height: 1;
    cursor: pointer; padding: 0 2px;
}
.ads-push-banner-dismiss:hover { color: #fff; }
@media (max-width: 640px) {
    .ads-push-banner { flex-wrap: wrap; bottom: 10px; }
}

/* ---- HR Overview card ---- */
#hr-overview-month { max-width: 160px; }

/* ---- Missing timesheet popup ---- */
.lv-missing-ts-modal .modal-content { max-width: 420px; }
.lv-missing-ts-icon { font-size: 34px; color: #f97316; text-align: center; margin-bottom: 10px; }

@media (max-width: 640px) {
    .lv-cal-widget { padding: 12px; }
    .lv-req-card { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* ---- Multi-assignee (Edit Ticket, PM / Team Leads only) ---- */
/* Gives the assignee <select> enough visible rows once JS flips it to
   multiple="true" via .lv-multi-assignee, so several names can be seen
   and ctrl/cmd-clicked at once instead of being hidden in a 1-row box. */
select#assigneeSelect.lv-multi-assignee {
    height: auto;
    min-height: 92px;
}

/* =================================================================
   END merged module: leave.css
   ================================================================= */


/* ============================================================
   Leave Workflow Setup - Bento tiles for Holiday Master and
   Calendar Color Configuration. Pure presentation: element ids,
   endpoints and behaviour are unchanged. Uses the --bento-* tokens
   from 15-core-bento.css (same radii / line / tint / shadow).
   ============================================================ */

/* ---------- Holiday Master ---------- */
.hm-card h4,
.cc-card h4 { display: flex; align-items: center; gap: 10px; margin: 0; }
.hm-card h4 i,
.cc-card h4 i {
    width: 30px; height: 30px; display: inline-grid; place-items: center;
    border-radius: var(--bento-r-sm, 10px); background: var(--green-lite); color: var(--green-dark); font-size: 13px;
}
.hm-head, .cc-head {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 10px 16px; margin-bottom: 16px;
}
.hm-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.hm-stat {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
    border-radius: 9999px; border: 1px solid var(--bento-line, rgba(15,23,42,.07));
    background: #fff; font-size: 12.5px; color: var(--gray-600);
}
.hm-stat b { color: var(--gray-900); font-weight: 700; }
.hm-stat-holiday { background: var(--green-lite); border-color: var(--green-mid); color: var(--green-dark); }
.hm-stat-holiday b { color: var(--green-dark); }
.hm-stat-restricted { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.hm-stat-restricted b { color: #92400e; }

.bento-grid.hm-grid { align-items: start; }
.hm-tile {
    padding: 18px; border-radius: var(--bento-r-md, 14px);
    border: 1px solid var(--bento-line, rgba(15,23,42,.07));
    background: rgba(255,255,255,.62);
}
.hm-tile-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--gray-900); margin-bottom: 14px; }
.hm-tile-title i { color: var(--green-dark); }
.hm-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.hm-field label { font-size: 12.5px; font-weight: 600; color: var(--gray-600); }
.hm-field .ts-input, .hm-field .ts-select { width: 100%; box-sizing: border-box; }
.hm-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

.hm-list-tile { padding: 14px; max-height: 620px; overflow-y: auto; }
.hm-list { display: flex; flex-direction: column; gap: 18px; }
.hm-month-head {
    display: flex; align-items: center; gap: 8px; margin: 0 2px 8px;
    font-size: 12.5px; font-weight: 700; color: var(--gray-600); letter-spacing: .2px;
}
.hm-month-head em {
    font-style: normal; font-weight: 600; font-size: 11px; padding: 1px 8px;
    border-radius: 9999px; background: var(--gray-100, #f3f4f6); color: var(--gray-600);
}
.hm-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.hm-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    background: #fff; border: 1px solid var(--bento-line, rgba(15,23,42,.07));
    border-radius: var(--bento-r-md, 14px); transition: border-color .15s ease, box-shadow .15s ease;
}
.hm-item:hover { border-color: var(--green-mid); box-shadow: 0 6px 16px -10px rgba(15,23,42,.25); }
.hm-date {
    flex: none; width: 48px; padding: 6px 0; text-align: center; line-height: 1.1;
    border-radius: var(--bento-r-sm, 10px); background: var(--green-lite); color: var(--green-dark);
}
.hm-date b { display: block; font-size: 18px; font-weight: 800; }
.hm-date span { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.hm-item-restricted .hm-date { background: #fffbeb; color: #92400e; }
.hm-info { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.hm-name { max-width: 100%; font-size: 13.5px; font-weight: 600; color: var(--gray-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-badge { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 9999px; }
.hm-badge-holiday { background: var(--green-lite); color: var(--green-dark); }
.hm-badge-restricted { background: #fef3c7; color: #92400e; }
.hm-item-actions { flex: none; display: flex; gap: 4px; }
.hm-icon-btn {
    width: 30px; height: 30px; display: inline-grid; place-items: center; cursor: pointer;
    border: 1px solid transparent; border-radius: var(--bento-r-sm, 10px);
    background: transparent; color: var(--gray-600); font-size: 12px;
    transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.hm-icon-btn:hover { background: var(--green-lite); color: var(--green-dark); border-color: var(--green-mid); }
.hm-icon-btn-danger:hover { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.hm-empty { padding: 36px 12px; text-align: center; color: var(--gray-600); }
.hm-empty i { font-size: 26px; color: var(--gray-400, #9ca3af); margin-bottom: 10px; }
.hm-empty small { display: block; margin-top: 4px; color: var(--gray-400, #9ca3af); }

/* ---------- Calendar Color Configuration ---------- */
.cc-hint { font-size: 12.5px; color: var(--gray-600); }
.bento-grid.cc-grid { align-items: start; }
.cc-tile {
    padding: 16px; border-radius: var(--bento-r-md, 14px);
    border: 1px solid var(--bento-line, rgba(15,23,42,.07));
    background: rgba(255,255,255,.62);
}
.cc-tile-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--gray-900); margin-bottom: 12px; }
.cc-tile-title i { color: var(--green-dark); }
.cc-rows { display: flex; flex-direction: column; gap: 10px; }
.cc-row {
    display: flex; align-items: center; gap: 12px; padding: 8px 10px;
    background: #fff; border: 1px solid var(--bento-line, rgba(15,23,42,.07));
    border-radius: var(--bento-r-md, 14px);
}
/* The swatch IS the colour preview. A real <input type="color"> sits invisibly on top of it,
   so clicking the swatch opens the picker and the saved value still comes from that input. */
.cc-swatch {
    position: relative; flex: none; width: 56px; height: 44px; cursor: pointer; overflow: hidden;
    display: grid; place-items: center; border-radius: var(--bento-r-sm, 10px);
    box-shadow: inset 0 0 0 1px rgba(15,23,42,.18);
    transition: transform .1s ease, box-shadow .15s ease;
}
.cc-swatch:hover { transform: scale(1.04); }
.cc-swatch:focus-within { box-shadow: inset 0 0 0 1px rgba(15,23,42,.18), var(--bento-focus, 0 0 0 3px rgba(14,161,111,.22)); }
.cc-swatch-sample { font-size: 14px; font-weight: 700; pointer-events: none; }
.cc-swatch input[type="color"] {
    position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0;
    opacity: 0; cursor: pointer; border: 0;
}
.cc-meta { flex: 1; min-width: 0; }
.cc-name { font-size: 13.5px; font-weight: 600; color: var(--gray-900); }
.cc-sub { font-size: 12px; color: var(--gray-600); margin-top: 1px; }
.cc-hex {
    flex: none; padding: 3px 8px; border-radius: 8px; font-size: 11.5px; letter-spacing: .3px;
    background: var(--gray-100, #f3f4f6); color: var(--gray-700, #374151);
}
.cc-footer { margin-top: 16px; }
