/* ===== 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); }
.dot.busy { background: var(--info); }
.dot.free { background: var(--ok); }

.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 12px rgba(255, 181, 71, .5); }
.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; }

.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); }

/* Gia hạn chờ TCTH duyệt (sọc) / bị từ chối (đỏ nhạt) – nối tiếp phần theo lịch trong cùng khối */
.tl-block .tb-ext { position: absolute; top: 0; bottom: 0; right: 0; border-left: 2px dashed rgba(255,255,255,.85); pointer-events: none; z-index: 0; }
.tl-block .tb-ext.pending { background: repeating-linear-gradient(135deg, rgba(255,181,71,.55) 0 6px, rgba(255,181,71,.18) 6px 12px); }
.tl-block .tb-ext.rejected { background: rgba(255,90,82,.28); border-left-color: rgba(255,90,82,.9); }
.tl-block > span { position: relative; z-index: 1; }
.lg-ext { display: inline-block; width: 22px; height: 12px; border-radius: 4px; background: repeating-linear-gradient(135deg, rgba(255,181,71,.8) 0 4px, rgba(255,181,71,.25) 4px 8px); }
/* Lịch tài xế tự tạo – chờ duyệt */
.tl-block.ghost { background: transparent !important; border: 2px dashed var(--purple) !important; color: var(--text) !important; box-shadow: none !important; cursor: pointer; opacity: .85; }
/* Tài xế chưa xem thông báo (TCTH) */
.mk-ack { width: 15px; height: 15px; border-radius: 50%; background: #8a94a6; color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.7); }
.mk-ack.late { background: #ff9f43; }
.tl-block .mk-ack { top: auto; bottom: 3px; }

/* Nghỉ phép tài xế */
.tl-leave { position: absolute; top: 4px; bottom: 4px; border-radius: 8px; z-index: 0; overflow: hidden; display: flex; align-items: center; justify-content: center;
  background: repeating-linear-gradient(135deg, rgba(150,160,180,.32) 0 6px, rgba(150,160,180,.12) 6px 12px); border: 1px dashed rgba(170,180,200,.55); pointer-events: auto; }
.tl-leave span { font-size: 12px; font-weight: 700; letter-spacing: .3px; color: rgba(225,232,245,.85); white-space: nowrap; text-transform: uppercase; }
.dot.leave { background: #9aa6b8; }
.lg-leave { display: inline-block; width: 22px; height: 12px; border-radius: 4px; background: repeating-linear-gradient(135deg, rgba(150,160,180,.7) 0 4px, rgba(150,160,180,.2) 4px 8px); }
:root[data-theme="light"] .tl-leave { background: repeating-linear-gradient(135deg, rgba(90,100,120,.18) 0 6px, rgba(90,100,120,.06) 6px 12px); border-color: rgba(90,100,120,.4); }
:root[data-theme="light"] .tl-leave span { color: #4a5568; }

/* Đi chung xe: khung viền đứt bao cả nhóm, mỗi lịch một làn */
.tl-share { position: absolute; top: 3px; border: 1.5px dashed rgba(190, 215, 255, .75); border-radius: 12px; background: rgba(120, 170, 255, .07); z-index: 0; pointer-events: auto; }
.tl-share-lab { position: absolute; top: -9px; right: 8px; font-size: 10.5px; font-weight: 700; line-height: 16px; padding: 0 6px; border-radius: 8px; background: #1c3b6e; color: #dbe8ff; white-space: nowrap; }
.tl-block.lane { padding-top: 0; padding-bottom: 0; align-items: center; justify-content: flex-start; flex-direction: row; gap: 8px; border-radius: 7px; }
.tl-block.lane .tb-dept { font-size: 12px; }
.tl-block.lane .tb-time { font-size: 11px; }
.tl-block.lane .mk { top: 50%; transform: translateY(-50%); }
.lg-share { display: inline-block; width: 22px; height: 12px; border-radius: 4px; border: 1.5px dashed rgba(190, 215, 255, .8); }
:root[data-theme="light"] .tl-share { border-color: rgba(21, 96, 200, .55); background: rgba(21, 96, 200, .05); }
:root[data-theme="light"] .tl-share-lab { background: #1560c8; color: #fff; }
:root[data-theme="light"] .lg-share { border-color: rgba(21, 96, 200, .6); }

/* Trạng thái tài xế: mỗi tài xế 1 dòng (chấm – tên – tóm tắt thẳng hàng), bấm để xem các chuyến */
.ds-list { display: grid; gap: 6px; }
.ds-row { border-radius: 14px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); }
.ds-row > summary { list-style: none; display: grid; grid-template-columns: 10px 56px minmax(0, 1fr); align-items: center; column-gap: 10px; padding: 10px 12px; cursor: pointer; }
.ds-row > summary::-webkit-details-marker { display: none; }
.ds-row > summary .dot { width: 10px; height: 10px; }
.ds-row > summary b { font-size: 15px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-row > summary .ds-txt { font-size: 14px; color: var(--muted); line-height: 1.35; }
.ds-row[open] > summary { border-bottom: 1px solid var(--line); }
.ds-trips { display: grid; gap: 4px; padding: 8px 12px 10px 32px; font-size: 13.5px; }
.ds-trip { cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-trip:hover b { text-decoration: underline; }
.ds-leg { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.ds-leg span { display: inline-flex; align-items: center; gap: 6px; }
.ds-leg .dot { display: inline-block; }
:root[data-theme="light"] .ds-row { background: rgba(255, 255, 255, .7); border-color: rgba(11, 37, 69, .1); }
/* Icon tài xế trên timeline: màu theo trạng thái (cùng màu với chấm ở "Trạng thái tài xế") */
.tl-label .avatar.st-run { background: linear-gradient(145deg, #ffc35c, #e48a12); }
.tl-label .avatar.st-busy { background: linear-gradient(145deg, #5ab4ff, #1560c8); }
.tl-label .avatar.st-free { background: linear-gradient(145deg, #4fd88e, #12a058); }
.tl-label .avatar.st-leave { background: linear-gradient(145deg, #b8c2d1, #8692a6); }
@media (max-width: 760px) {
  .ds-row > summary { grid-template-columns: 10px 48px minmax(0, 1fr); column-gap: 8px; padding: 8px 10px; }
  .ds-row > summary b { font-size: 14.5px; }
  .ds-row > summary .ds-txt { font-size: 13px; }
  .ds-trips { padding: 6px 10px 8px 28px; font-size: 13px; }
  .ds-leg .faint { display: none; }
  /* Timeline: icon (chữ cái đầu, màu theo trạng thái) canh giữa, tên canh giữa ngay dưới */
  .tl-row .tl-label { flex-direction: column; justify-content: center; align-items: center; gap: 2px; padding: 4px 2px; text-align: center; }
  .tl-row .tl-label .avatar { display: grid; width: 28px; height: 28px; font-size: 13px; }
  .tl-name { width: 100%; min-width: 0; }
  .tl-name b { display: block; font-size: 12px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tl-name b .lead-star { font-size: 10px; }
  .tl-name small { display: none !important; }
  .tl-corner { padding: 0 6px; gap: 4px; font-size: 11px; white-space: nowrap; }
  .tl-corner svg { display: none; }
  .card-head .date-nav { gap: 6px; min-width: 0; max-width: 100%; }
  .card-head .date-nav .dlabel { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .card-head .date-nav .btn { flex: none; padding: 0 10px; }
}
/* Làn đi chung: chữ giờ không bị che chân số */
.tl-block.lane .tb-dept, .tl-block.lane .tb-time { line-height: 1.35; }
