/* ===== Timeline tài xế (gọn: tài xế – phòng – giờ đi/về) ===== */
.tl { --label: 210px; --row: 62px; position: relative; user-select: none; border-radius: 18px; overflow: hidden;
  border: 1px solid var(--line); background: rgba(0, 12, 35, .22); }
.tl-head { display: grid; grid-template-columns: var(--label) 1fr; height: 40px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .05); }
.tl-corner { display: flex; align-items: center; gap: 8px; padding: 0 16px; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border-right: 1px solid var(--line); }
.tl-scale { position: relative; }
.tl-scale span { position: absolute; top: 50%; transform: translate(-50%, -50%); font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-scale span:first-child { transform: translate(4px, -50%); }
.tl-scale .now-pill { position: absolute; top: 50%; transform: translate(-50%, -50%); z-index: 2; background: var(--vtb-red); color: #fff; font-size: 11.5px; font-weight: 800; padding: 2px 7px; border-radius: 7px; font-variant-numeric: tabular-nums; box-shadow: 0 0 10px rgba(227, 24, 55, .6); }

.tl-body { position: relative; }
.tl-grid { position: absolute; top: 0; bottom: 0; left: var(--label); right: 0; pointer-events: none; z-index: 0; }
.tl-grid i { position: absolute; top: 0; bottom: 0; border-left: 1px solid rgba(255, 255, 255, .07); }
.tl-grid i.odd { background: rgba(255, 255, 255, .025); }
.tl-now { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--vtb-red); box-shadow: 0 0 8px rgba(227, 24, 55, .8); z-index: 6; }

.tl-row { position: relative; z-index: 1; display: grid; grid-template-columns: var(--label) 1fr; min-height: var(--row); border-top: 1px solid var(--line); transition: background .15s; }
.tl-grid + .tl-row { border-top: 0; }
.tl-row:hover { background: rgba(255, 255, 255, .025); }
.tl-row.drop { background: rgba(90, 170, 255, .16); }
.tl-label { display: flex; align-items: center; gap: 12px; padding: 0 14px; border-right: 1px solid var(--line); background: rgba(255, 255, 255, .035); min-width: 0; }
.tl-label .avatar { width: 38px; height: 38px; font-size: 16px; }
.tl-name { min-width: 0; }
.tl-name b { display: block; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-name small { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.tl-row.taxi .tl-label { background: rgba(255, 211, 77, .07); }
.tl-row.unassigned .tl-label { background: rgba(255, 90, 82, .09); }
.lead-star { color: #ffd76a; font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.run { background: var(--warn); box-shadow: 0 0 8px var(--warn); animation: blink 1.2s ease-in-out infinite; }
.dot.busy { background: var(--info); }
.dot.free { background: var(--ok); }
@keyframes blink { 50% { opacity: .35; } }

.tl-track { position: relative; min-height: var(--row); }

/* Khối chuyến */
.tl-block { --h: 210; position: absolute; top: 10px; bottom: 10px; min-width: 10px; padding: 0 10px 0 9px; border-radius: 10px;
  display: flex; flex-direction: column; justify-content: center; gap: 1px; overflow: hidden; cursor: pointer; color: #fff;
  background: linear-gradient(180deg, hsl(var(--h) 72% 54%), hsl(var(--h) 70% 44%));
  border: 1px solid hsl(var(--h) 85% 70% / .55); border-left: 4px solid hsl(var(--h) 95% 78%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 3px 8px rgba(0, 0, 0, .28);
  transition: transform .12s, box-shadow .12s, opacity .15s; }
.tl-block:hover { transform: translateY(-1px); z-index: 4; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 8px 18px rgba(0, 0, 0, .38); }
.tb-dept { display: flex; align-items: center; gap: 4px; font-size: 13.5px; font-weight: 800; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.15; }
.tb-dept .ic { flex: none; }
.tb-dept em { font-style: normal; font-size: 10px; font-weight: 800; padding: 1px 4px; border-radius: 4px; background: rgba(0, 0, 0, .3); }
.tb-time { font-size: 12px; font-weight: 600; opacity: .95; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.15; }
.tl-block.sm { padding: 0 6px 0 6px; }
.tl-block.xs { padding: 0 3px; align-items: center; border-left-width: 3px; }
.tl-block.xs .tb-dept { font-size: 10.5px; }
.tl-block.xs .tb-time { display: none; }

.tl-block.st-started { box-shadow: 0 0 0 2px var(--warn), 0 0 16px rgba(255, 181, 71, .55); animation: runglow 1.6s ease-in-out infinite; }
.tl-block.st-done { opacity: .45; filter: saturate(.5); }
.tl-block.st-done:hover { opacity: .85; }
.tl-block.backup { background: hsl(var(--h) 70% 50% / .14); border: 1.5px dashed hsl(var(--h) 85% 72%); border-left-width: 1.5px; color: hsl(var(--h) 95% 86%); box-shadow: none; }
.tl-block.backup.going { background: linear-gradient(180deg, hsl(var(--h) 72% 54%), hsl(var(--h) 70% 44%)); border-style: solid; color: #fff; }
.tl-block.conflict { box-shadow: 0 0 0 2px var(--danger), 0 0 14px rgba(255, 90, 82, .55); }
.tl-block.soft { outline: 2px dashed var(--warn); outline-offset: 1px; }
.tl-block.dim { opacity: .25; }
.tl-block.mine { box-shadow: 0 0 0 2px #fff, 0 6px 16px rgba(0, 0, 0, .35); z-index: 3; }
@keyframes runglow { 50% { box-shadow: 0 0 0 2px rgba(255, 181, 71, .45), 0 0 6px rgba(255, 181, 71, .2); } }

.mk { font-style: normal; display: inline-grid; place-items: center; }
.tl-block .mk { position: absolute; top: 3px; right: 3px; }
.mk-conf { width: 16px; height: 16px; border-radius: 50%; background: var(--danger); color: #fff; font-size: 11px; font-weight: 900; box-shadow: 0 0 0 2px rgba(0, 0, 0, .2); }
.mk-pend { width: 9px; height: 9px; border-radius: 50%; background: var(--purple); box-shadow: 0 0 0 2px rgba(255, 255, 255, .7); }
.tl-block .mk-conf + .mk-pend { right: 22px; top: 6px; }

.tl-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.tl-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tl-legend .mk { position: static; }
.lg-bk { display: inline-block; width: 22px; height: 12px; border-radius: 4px; border: 1.5px dashed var(--muted); }

@media (max-width: 900px) { .tl { --label: 150px; } .tl-label .avatar { display: none; } }

/* ----- Giao diện sáng ----- */
:root[data-theme="light"] .tl { background: rgba(255, 255, 255, .55); }
:root[data-theme="light"] .tl-head { background: rgba(255, 255, 255, .7); }
:root[data-theme="light"] .tl-grid i { border-left-color: rgba(11, 37, 69, .08); }
:root[data-theme="light"] .tl-grid i.odd { background: rgba(11, 37, 69, .025); }
:root[data-theme="light"] .tl-label { background: rgba(255, 255, 255, .6); }
:root[data-theme="light"] .tl-row:hover { background: rgba(10, 95, 208, .03); }
:root[data-theme="light"] .tl-row.taxi .tl-label { background: rgba(255, 200, 40, .12); }
:root[data-theme="light"] .tl-row.unassigned .tl-label { background: rgba(220, 50, 40, .08); }
:root[data-theme="light"] .lead-star { color: #c99400; }
:root[data-theme="light"] .tl-block { background: linear-gradient(180deg, hsl(var(--h) 68% 52%), hsl(var(--h) 66% 43%)); border-left-color: hsl(var(--h) 80% 32%); box-shadow: 0 2px 6px rgba(20, 60, 120, .18); }
:root[data-theme="light"] .tl-block.backup { background: hsl(var(--h) 70% 55% / .1); border-color: hsl(var(--h) 60% 45%); color: hsl(var(--h) 70% 28%); box-shadow: none; }
:root[data-theme="light"] .tl-block.backup.going { background: linear-gradient(180deg, hsl(var(--h) 68% 52%), hsl(var(--h) 66% 43%)); color: #fff; }
:root[data-theme="light"] .tl-block.st-done { opacity: .4; }
:root[data-theme="light"] .tl-block.mine { box-shadow: 0 0 0 2px #0b2545, 0 6px 14px rgba(20, 60, 120, .25); }
:root[data-theme="light"] .tl-block.st-started { box-shadow: 0 0 0 2px #e69500, 0 0 14px rgba(230, 149, 0, .45); }
:root[data-theme="light"] .tb-dept em { background: rgba(0, 0, 0, .18); }
