/* R17 HR & payroll – TL – time & leave (prefix tm-: tl- is the existing timeline). Every class of this file starts with "tm-". Owned by that slice only. */

/* ---------- shared bits */
.tm-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 32px 16px; text-align: center; color: var(--muted); }
.tm-empty h2 { margin: 0; font-size: 17px; color: var(--text); }
.tm-empty p { margin: 0; max-width: 600px; }
.tm-empty svg { color: var(--primary); }
.tm-banner { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--blue-bg); color: var(--blue-fg); margin-bottom: 12px; }
.tm-banner.warn { background: var(--amber-bg); color: var(--amber-fg); }
.tm-banner.bad { background: var(--red-bg); color: var(--red-fg); }
.tm-banner.good { background: var(--green-bg); color: var(--green-fg); }
.tm-banner > .grow { flex: 1 1 260px; }
.tm-pad { padding: 12px 16px; }
.tm-note { margin: 4px 0 8px; font-size: 12px; color: var(--muted); }
.tm-notes { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.tm-notes li { font-size: 13px; padding: 6px 10px; border-radius: var(--radius-sm); }
.tm-notes .green { background: var(--green-bg); color: var(--green-fg); }
.tm-notes .amber { background: var(--amber-bg); color: var(--amber-fg); }
.tm-notes .red { background: var(--red-bg); color: var(--red-fg); }
.tm-notes .blue { background: var(--blue-bg); color: var(--blue-fg); }
.tm-notes .gray { background: var(--gray-bg); color: var(--gray-fg); }
.tm-name { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tm-name .muted { font-size: 12px; }
.tm-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tm-nowrap { white-space: nowrap; }
.tm-dialog-body { max-height: min(70vh, 760px); overflow-y: auto; padding-inline-end: 4px; }
.tm-section { margin: 14px 0 6px; font-size: 13px; font-weight: 600; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.tm-row-tools { display: flex; gap: 4px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.tm-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--sw, var(--series-1)); margin-inline-end: 6px;
    vertical-align: middle; border: 1px solid var(--border); }
.tm-days { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.tm-span-2 { grid-column: span 2; }
.tm-span-all { grid-column: 1 / -1; }
.tm-inline { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tm-cell-input { width: 100%; min-width: 92px; padding: 4px 6px; font: inherit; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text); }
.tm-cell-input:disabled { background: transparent; border-color: transparent; color: var(--text); }
.tm-cell-input.narrow { min-width: 70px; }
tr.tm-dirty > td { background: var(--amber-bg); }
tr.tm-locked > td { opacity: .75; }

/* KPIs that filter a list */
.tm-kpi { text-align: start; cursor: pointer; font: inherit; color: inherit; border: 1px solid var(--border); }
.tm-kpi.on { border-color: var(--primary); box-shadow: inset 0 -3px 0 var(--primary); }
.tm-kpi-bad .kpi-value { color: var(--red-fg); }
.tm-kpi-warn .kpi-value { color: var(--amber-fg); }
a.tm-kpi { text-decoration: none; }
.kpis.tm-kpis5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .kpis.tm-kpis5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .kpis.tm-kpis5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* facts (definition lists) */
.tm-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 16px; margin: 0; }
.tm-facts > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tm-facts dt { font-size: 12px; color: var(--muted); }
.tm-facts dd { margin: 0; overflow-wrap: anywhere; }

/* quote panel of a leave / encashment */
.tm-quote { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-top: 10px; background: var(--surface); }
.tm-quote-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.tm-quote-figs > div { display: flex; flex-direction: column; gap: 2px; }
.tm-quote-figs span { font-size: 12px; color: var(--muted); }
.tm-quote-figs strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.tm-quote-figs strong.neg { color: var(--red-fg); }

/* approval steps & timeline */
.tm-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tm-steps li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--row-line); }
.tm-steps li:last-child { border-bottom: 0; }
.tm-steps .grow { flex: 1 1 180px; min-width: 0; }
.tm-step-no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--gray-bg); color: var(--gray-fg); font-size: 12px; font-weight: 600; }
.tm-timeline { list-style: none; margin: 0; padding: 0; }
.tm-timeline li { display: grid; grid-template-columns: 130px 1fr; gap: 2px 10px; padding: 6px 0; border-bottom: 1px solid var(--row-line); font-size: 13px; }
.tm-timeline li:last-child { border-bottom: 0; }
.tm-timeline time { color: var(--muted); font-size: 12px; }

/* roster grid & leave calendar: first column sticks while the days scroll */
.tm-grid-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.tm-grid { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 12px; }
.tm-grid th, .tm-grid td { border-bottom: 1px solid var(--row-line); border-inline-end: 1px solid var(--row-line); padding: 0; text-align: center; }
.tm-grid thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; font-weight: 600; padding: 6px 2px; min-width: 42px; }
.tm-grid thead th small { display: block; font-weight: 400; color: var(--muted); }
.tm-grid th.tm-off-day { background: var(--gray-bg); }
.tm-grid th.tm-hol-day { background: var(--amber-bg); color: var(--amber-fg); }
.tm-grid th.tm-today { box-shadow: inset 0 -3px 0 var(--primary); }
.tm-grid .tm-emp { position: sticky; inset-inline-start: 0; z-index: 1; background: var(--surface); text-align: start; padding: 6px 10px; min-width: 190px; max-width: 240px; }
.tm-grid thead .tm-emp { z-index: 3; }
.tm-grid .tm-emp label { display: flex; gap: 6px; align-items: flex-start; cursor: pointer; }
.tm-cell { appearance: none; border: 0; width: 100%; min-width: 42px; height: 34px; font: inherit; font-size: 11px; font-weight: 600; cursor: pointer;
    background: transparent; color: var(--text); padding: 0 2px; position: relative; }
.tm-cell:disabled { cursor: default; }
.tm-cell:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.tm-cell.shift { background: color-mix(in srgb, var(--sw, var(--series-1)) 22%, transparent); }
.tm-cell.off { background: var(--gray-bg); color: var(--gray-fg); font-weight: 400; }
.tm-cell.leave { background: var(--blue-bg); color: var(--blue-fg); }
.tm-cell.hol { background: var(--amber-bg); color: var(--amber-fg); }
.tm-cell.planned::after { content: ""; position: absolute; top: 3px; inset-inline-end: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--primary); }
.tm-cell.changed { outline: 2px dashed var(--primary); outline-offset: -3px; }
.tm-brush { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0 10px; }
.tm-brush button { appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 4px 10px;
    font: inherit; font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.tm-brush button[aria-pressed="true"] { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); font-weight: 600; }
.tm-cal-bar { display: block; height: 22px; margin: 4px 0; border-radius: 4px; background: var(--sw, var(--series-1)); opacity: .85; }
.tm-cal-bar.pending { opacity: .45; background-image: repeating-linear-gradient(45deg, transparent 0 4px, rgba(255, 255, 255, .45) 4px 8px); }
.tm-cal-bar.half { height: 11px; margin-top: 9px; }

/* import preview */
.tm-raw { font-family: var(--mono); font-size: 11px; color: var(--muted); max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-key { font-family: var(--mono); font-size: 13px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--gray-bg); color: var(--text);
    overflow-wrap: anywhere; user-select: all; }
.tm-code { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; background: var(--gray-bg); padding: 10px 12px; border-radius: var(--radius-sm);
    overflow-x: auto; margin: 6px 0; }

/* bands editor */
.tm-bands { display: flex; flex-direction: column; gap: 6px; }
.tm-band { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; }

@media (max-width: 640px) {
    .tm-span-2 { grid-column: auto; }
    .tm-timeline li { grid-template-columns: 1fr; }
    .tm-grid .tm-emp { min-width: 130px; max-width: 150px; }
    .tm-band { grid-template-columns: 1fr 1fr auto; }
}
