/* ═══════════ 📅 Timeline Thành Viên (Gantt ngang) ═══════════ */
.tl-page { display: flex; flex-direction: column; gap: 14px; animation: tlFade .35s ease; }
@keyframes tlFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Toolbar */
.tl-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px;
    background: linear-gradient(135deg, rgba(245,158,11,.07), rgba(124,58,237,.05) 60%, rgba(13,17,26,.9));
    backdrop-filter: blur(10px);
}
.tl-month-nav { display: flex; align-items: center; gap: 8px; }
.tl-month-label { display: flex; align-items: baseline; gap: 6px; min-width: 128px; justify-content: center; }
.tl-month-main { font-size: 20px; font-weight: 800; letter-spacing: -.02em;
    background: linear-gradient(90deg, #fbbf24, #f97316); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tl-month-year { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.tl-icon-btn, .tl-today-btn {
    height: 32px; border-radius: 9px; border: 1px solid var(--border); background: rgba(255,255,255,.03);
    color: var(--text-primary); cursor: pointer; transition: var(--transition); font-family: inherit;
}
.tl-icon-btn { width: 32px; font-size: 18px; line-height: 1; }
.tl-today-btn { padding: 0 12px; font-size: 12px; font-weight: 600; color: var(--accent-light); border-color: rgba(245,158,11,.3); }
.tl-icon-btn:hover, .tl-today-btn:hover { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.45); transform: translateY(-1px); }

.tl-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tl-seg { display: inline-flex; padding: 3px; border-radius: 10px; background: rgba(255,255,255,.04); border: 1px solid var(--border); }
.tl-seg-btn { border: 0; background: transparent; color: var(--text-secondary); font: 600 12px Inter, sans-serif;
    padding: 6px 12px; border-radius: 7px; cursor: pointer; transition: var(--transition); }
.tl-seg-btn:hover { color: var(--text-primary); }
.tl-seg-btn.active { background: linear-gradient(135deg, var(--accent), #ea580c); color: #fff; box-shadow: 0 2px 10px rgba(245,158,11,.35); }
.tl-select, .tl-search {
    height: 34px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-input);
    color: var(--text-primary); font: 500 12px Inter, sans-serif; padding: 0 10px; outline: none; transition: var(--transition);
}
.tl-search { width: 200px; }
.tl-select:focus, .tl-search:focus { border-color: rgba(245,158,11,.55); box-shadow: 0 0 0 3px var(--accent-glow); }

/* Stats */
.tl-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tl-stat { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px;
    border: 1px solid var(--border); background: var(--bg-card); transition: var(--transition); }
.tl-stat:hover { transform: translateY(-2px); background: var(--bg-card-hover); }
.tl-stat-icon { width: 34px; height: 34px; display: grid; place-items: center; font-size: 16px; border-radius: 10px; background: rgba(255,255,255,.05); }
.tl-stat-val { font-size: 20px; font-weight: 800; line-height: 1.1; }
.tl-stat-label { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.tl-stat.is-app .tl-stat-icon { background: rgba(245,158,11,.15); }
.tl-stat.is-req .tl-stat-icon { background: rgba(20,184,166,.15); }
.tl-stat.is-active .tl-stat-icon { background: rgba(59,130,246,.15); }
.tl-stat.is-danger { border-color: rgba(239,68,68,.35); }
.tl-stat.is-danger .tl-stat-val { color: #f87171; }

/* Member chips */
.tl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tl-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px;
    border: 1px solid var(--border); background: rgba(255,255,255,.03); color: var(--text-secondary);
    font: 600 12px Inter, sans-serif; cursor: pointer; transition: var(--transition); }
.tl-chip:first-child { padding-left: 10px; }
.tl-chip:hover { color: var(--text-primary); border-color: rgba(255,255,255,.18); }
.tl-chip.active { color: #fff; border-color: rgba(245,158,11,.6); background: rgba(245,158,11,.14); box-shadow: 0 0 0 1px rgba(245,158,11,.2) inset; }
.tl-chip-avatar { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; color: #fff; font-weight: 800; }
.tl-chip-count { font-size: 10px; padding: 1px 6px; border-radius: 999px; background: rgba(255,255,255,.08); color: var(--text-muted); }

/* Board */
.tl-board { border: 1px solid var(--border); border-radius: 14px; background: var(--bg-card); overflow: hidden; position: relative; transition: opacity .2s; }
.tl-board.tl-loading { opacity: .5; pointer-events: none; }
.tl-scroll { overflow: auto; max-height: calc(100vh - 360px); min-height: 280px; }
.tl-inner { position: relative; }

.tl-head { display: flex; position: sticky; top: 0; z-index: 6; background: #0b0f18; border-bottom: 1px solid var(--border); }
.tl-corner { width: var(--name); min-width: var(--name); position: sticky; left: 0; z-index: 7; background: #0b0f18;
    display: flex; align-items: center; padding: 0 14px; font-size: 11px; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .06em; border-right: 1px solid var(--border); }
.tl-day { width: var(--cw); min-width: var(--cw); display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 7px 0; border-right: 1px solid rgba(255,255,255,.035); }
.tl-day-num { font-size: 12px; font-weight: 700; color: var(--text-primary); }
.tl-day-wd { font-size: 9px; color: var(--text-muted); font-weight: 600; }
.tl-day.weekend .tl-day-num, .tl-day.weekend .tl-day-wd { color: #f87171; opacity: .8; }
.tl-day.today { background: linear-gradient(180deg, rgba(245,158,11,.25), rgba(245,158,11,.05)); }
.tl-day.today .tl-day-num { color: #fbbf24; }

.tl-body { position: relative; }
.tl-grid-bg { position: absolute; inset: 0 0 0 var(--name); display: flex; pointer-events: none; }
.tl-col { width: var(--cw); min-width: var(--cw); border-right: 1px solid rgba(255,255,255,.035); }
.tl-col.weekend { background: repeating-linear-gradient(135deg, rgba(255,255,255,.018) 0 6px, transparent 6px 12px); }
.tl-col.today { background: rgba(245,158,11,.05); }
.tl-now { position: absolute; top: 0; bottom: 0; width: 2px; background: linear-gradient(180deg, #fbbf24, rgba(249,115,22,.2));
    z-index: 4; pointer-events: none; box-shadow: 0 0 10px rgba(251,191,36,.6); }
.tl-now-label { position: absolute; top: 2px; left: 4px; font-size: 9px; font-weight: 700; color: #fbbf24; white-space: nowrap;
    background: rgba(8,12,20,.85); padding: 1px 5px; border-radius: 4px; }

.tl-row { display: flex; position: relative; border-bottom: 1px solid rgba(255,255,255,.04); transition: background .2s; }
.tl-row.odd { background: rgba(255,255,255,.012); }
.tl-row:hover { background: rgba(245,158,11,.035); }
.tl-name { width: var(--name); min-width: var(--name); position: sticky; left: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
    padding: 0 12px; background: #0c1019; border-right: 1px solid var(--border); }
.tl-row:hover .tl-name { background: #11161f; }
.tl-avatar { width: 30px; height: 30px; min-width: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.tl-name-text { min-width: 0; }
.tl-name-main { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-name-sub { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-lane { position: relative; flex: 1; }

/* Bars */
.tl-bar { position: absolute; height: 21px; border-radius: 6px; display: flex; align-items: center; gap: 4px; padding: 0 7px;
    font-size: 11px; font-weight: 600; color: #fff; cursor: pointer; overflow: hidden; white-space: nowrap; z-index: 2;
    box-shadow: 0 2px 6px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.18);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s; animation: tlGrow .45s cubic-bezier(.2,.8,.2,1) both; transform-origin: left center; }
@keyframes tlGrow { from { transform: scaleX(.2); opacity: 0; } to { transform: scaleX(1); opacity: 1; } }
.tl-bar:hover, .tl-bar:focus-visible { transform: translateY(-1px) scale(1.02); z-index: 3; filter: brightness(1.12);
    box-shadow: 0 6px 16px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.35) inset; outline: none; }
.tl-bar-icon { font-size: 10px; opacity: .9; }
.tl-bar-text { overflow: hidden; text-overflow: ellipsis; }

.team-thesun { background: linear-gradient(135deg, #f59e0b, #ea580c); }
.team-istar { background: linear-gradient(135deg, #8b5cf6, #4f46e5); }
.kind-req { background: linear-gradient(135deg, #14b8a6, #0e7490); }
.kind-req.cat-done { background: linear-gradient(135deg, rgba(16,185,129,.55), rgba(5,150,105,.45)); color: #d1fae5; }
.tl-bar.cat-done.team-thesun, .tl-bar.cat-done.team-istar { filter: saturate(.75); }
.tl-bar.cat-overdue, .tl-swatch.cat-overdue { box-shadow: 0 0 0 2px #ef4444 inset, 0 0 12px rgba(239,68,68,.45); }
.tl-swatch.cat-overdue { background: #1a0f12; }
.tl-bar.live::after, .tl-swatch.live { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.22) 0 5px, transparent 5px 10px); }
.tl-bar.live::after { content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 28px;
    background-size: 14px 14px; animation: tlStripe 1s linear infinite; mask-image: linear-gradient(90deg, transparent, #000); -webkit-mask-image: linear-gradient(90deg, transparent, #000); }
.tl-swatch.live { background-color: #334155; }
@keyframes tlStripe { from { background-position: 0 0; } to { background-position: 14px 0; } }
.tl-bar.clip-l { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 2px dashed rgba(255,255,255,.55); }
.tl-bar.clip-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }

/* Legend */
.tl-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; font-size: 11px; color: var(--text-secondary); padding: 2px 4px; }
.tl-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.tl-swatch { width: 22px; height: 10px; border-radius: 3px; display: inline-block; }
.tl-legend-hint { margin-left: auto; color: var(--text-muted); }

/* Tooltip / popover */
.tl-tip { position: fixed; z-index: 2000; width: 300px; max-width: calc(100vw - 16px); padding: 12px 14px; border-radius: 12px;
    background: rgba(13,17,26,.97); border: 1px solid rgba(245,158,11,.35); box-shadow: 0 18px 48px rgba(0,0,0,.6);
    backdrop-filter: blur(12px); color: var(--text-primary); font-size: 12px; pointer-events: none;
    opacity: 0; transform: translateY(4px) scale(.98); transition: opacity .12s, transform .12s; }
.tl-tip.show { opacity: 1; transform: none; }
.tl-tip.pinned { pointer-events: auto; border-color: rgba(245,158,11,.7); }
.tl-tip-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.tl-tip-badge { flex-shrink: 0; font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 5px; letter-spacing: .03em; }
.b-app { background: rgba(245,158,11,.18); color: #fbbf24; }
.b-req { background: rgba(20,184,166,.18); color: #5eead4; }
.tl-tip-title { font-weight: 700; font-size: 13px; line-height: 1.3; flex: 1; word-break: break-word; }
.tl-tip-close { background: none; border: 0; color: var(--text-muted); cursor: pointer; font-size: 13px; }
.tl-tip-close:hover { color: #fff; }
.tl-tip-cat { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-bottom: 8px; background: rgba(255,255,255,.06); }
.tl-tip-cat.cat-active { color: #93c5fd; background: rgba(59,130,246,.15); }
.tl-tip-cat.cat-done { color: #6ee7b7; background: rgba(16,185,129,.15); }
.tl-tip-cat.cat-overdue { color: #fca5a5; background: rgba(239,68,68,.18); }
.tl-tip-row { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px dashed rgba(255,255,255,.05); }
.tl-tip-k { color: var(--text-muted); white-space: nowrap; }
.tl-tip-v { text-align: right; font-weight: 600; word-break: break-word; }
.tl-tip-desc { margin-top: 8px; color: var(--text-secondary); font-size: 11px; line-height: 1.45; max-height: 80px; overflow: auto; }
.tl-tip-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tl-link { font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 7px; text-decoration: none; color: #fff;
    background: rgba(255,255,255,.07); border: 1px solid var(--border); transition: var(--transition); }
.tl-link:hover { background: rgba(245,158,11,.2); border-color: rgba(245,158,11,.5); }

.tl-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 60px 20px; color: var(--text-secondary); font-size: 13px; text-align: center; }
.tl-empty-icon { font-size: 34px; }

@media (max-width: 900px) {
    .tl-toolbar { flex-direction: column; align-items: stretch; }
    .tl-search { flex: 1; width: auto; }
    .tl-legend-hint { margin-left: 0; width: 100%; }
}

/* Căn chuẩn header lịch với lưới & thanh bar */
.tl-head, .tl-grid-bg { width: 100%; }
.tl-corner, .tl-name { flex: 0 0 var(--name); }
.tl-day, .tl-col { flex: 0 0 var(--cw); box-sizing: border-box; }
.tl-head .tl-day:last-child, .tl-grid-bg .tl-col:last-child { border-right: 0; }
