/* =====================================================================
   Timeline view (/timeline, timeline.php) — added 2026-11-07.
   One CSS grid: col 1 = sticky country column (110px), then one column per
   day. Row 1 = ISO week labels, row 2 = weekday + day number, then one row
   per lane per country. Column backgrounds (.tl-col) span every row and are
   first in markup so they paint behind headers and bars.
   ===================================================================== */
:root {
  --tl-red: #ff3b3b;
  --tl-accent: var(--c-appt, #2f80ed);
}

.tl-chip-count { color: var(--muted); font-size: 11px; font-weight: 600; }

.tl-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius, 16px);
  background: var(--panel);
}
.tl-grid { display: grid; position: relative; }

.tl-col { grid-row: 1 / -1; }
.tl-weekend { background: rgba(255, 255, 255, .055); }
.tl-monday { border-left: 1px solid var(--line); }

.tl-corner {
  grid-column: 1;
  position: sticky; left: 0; z-index: 5;
  background: var(--panel);
  border-right: 1px solid var(--line);
}
.tl-corner-label {
  display: flex; align-items: flex-end;
  padding: 0 8px 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.tl-wk {
  grid-row: 1; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  color: var(--muted);
  white-space: nowrap; overflow: hidden;
}
.tl-wk-current {
  color: var(--tl-accent);
  background: rgba(47, 128, 237, .14);
  box-shadow: inset 0 -2px 0 var(--tl-accent);
}

.tl-day {
  grid-row: 2; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 10px; line-height: 1.2; color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.tl-day b { font-size: 13px; color: var(--text-soft); }
.tl-day-today, .tl-day-today b { color: var(--tl-red); }

.tl-today-line {
  grid-row: 3 / -1; z-index: 2;
  justify-self: center;
  width: 2px; background: var(--tl-red);
  pointer-events: none;
}

.tl-rowsep {
  grid-column: 2 / -1; z-index: 1;
  border-top: 1px solid var(--line-2);
  pointer-events: none;
}

.tl-country {
  grid-column: 1;
  position: sticky; left: 0; z-index: 4;
  display: flex; align-items: center; gap: 4px;
  padding: 0 5px 0 6px;
  background: var(--panel);
  border-top: 1px solid var(--line-2);
  border-right: 1px solid var(--line);
  font-size: 12px; font-weight: 600; color: var(--text);
  min-width: 0;
}
.tl-country img { width: 18px; height: auto; border-radius: 2px; flex: none; box-shadow: 0 0 0 1px rgba(255, 255, 255, .18); }
.tl-country-name { min-width: 0; font-size: 10.5px; line-height: 1.1; letter-spacing: -.01em; overflow-wrap: break-word; }
.tl-country-count {
  margin-left: auto; flex: none;
  font-size: 10px; font-weight: 700; color: var(--muted);
  background: rgba(255, 255, 255, .08);
  border-radius: 999px; padding: 1px 5px;
}

.tl-bar {
  z-index: 3;
  align-self: center;
  display: flex; align-items: center; gap: 4px;
  min-width: 0; height: 22px;
  margin: 0 2px; padding: 0 6px;
  border: 0; border-radius: 6px;
  background: var(--bar, #9aa6b7);
  color: #fff;
  font-family: inherit; font-size: 11px; font-weight: 700; line-height: 22px;
  text-align: left; white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
  overflow: hidden; cursor: pointer;
  transition: filter .12s, box-shadow .12s;
}
.tl-bar:hover { filter: brightness(1.12); }
.tl-bar:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.tl-bar.tl-cont-prev { margin-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.tl-bar.tl-cont-next { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.tl-bar-txt { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tl-arrow { flex: none; font-size: 10px; opacity: .9; }
.tl-arrow-next { margin-left: auto; }
.tl-check {
  display: none; flex: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; color: #0d7a4f;
  font-size: 10px; line-height: 14px; text-align: center; font-weight: 900;
  text-shadow: none;
}
.tl-bar.in-plan .tl-check { display: inline-block; }
.tl-bar.tl-clash { box-shadow: 0 0 0 2px var(--tl-red), 0 0 10px rgba(255, 59, 59, .5); }
.tl-bar.tl-selected { box-shadow: 0 0 0 2px #fff; }
.tl-bar.tl-clash.tl-selected { box-shadow: 0 0 0 2px var(--tl-red), 0 0 0 4px #fff; }

.tl-empty {
  grid-column: 2 / -1; z-index: 3;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-weight: 600; font-size: 14px;
}

.tl-clash-banner {
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 1px solid var(--tl-red);
  border-radius: var(--radius-sm, 10px);
  background: rgba(255, 59, 59, .13);
  color: #ffd9d9;
  font-weight: 700; font-size: 14px;
}
.tl-clash-banner[hidden], .tl-detail[hidden] { display: none; }
.tl-clash-line + .tl-clash-line { margin-top: 4px; }
.tl-clash-line::before { content: '⚠ '; color: var(--tl-red); }

.tl-detail {
  position: relative;
  margin: 16px 0 8px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius, 16px);
  background: var(--panel-2);
}
.tl-detail-close {
  position: absolute; top: 10px; right: 12px;
  border: 0; background: none; color: var(--muted);
  font-size: 22px; line-height: 1; cursor: pointer;
}
.tl-detail-close:hover { color: var(--text); }
.tl-detail-name { margin: 0 28px 8px 0; font-size: 18px; }
.tl-detail-row { color: var(--text-soft); font-size: 14px; margin-top: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tl-detail-flag { width: 18px; height: auto; border-radius: 2px; }
.tl-detail-meta { margin-top: 8px; }
.tl-detail-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .08); border: 1px solid var(--line);
  font-size: 12px; font-weight: 600;
}
.tl-detail-actions { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.tl-plan-btn {
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .1);
  color: var(--text); font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.tl-plan-btn:hover { background: rgba(255, 255, 255, .16); }
.tl-plan-btn.in-plan { background: rgba(52, 211, 153, .18); border-color: rgba(52, 211, 153, .6); color: #b9f5dc; }
.tl-detail-link { font-size: 13px; font-weight: 600; color: var(--text-soft); }
.tl-detail-link:hover { color: var(--text); }

/* Mobile (<768px): the grid's inline min-width (110px + 30px/day) exceeds the
   viewport, so .tl-scroll scrolls horizontally; .tl-country / .tl-corner are
   position:sticky left:0, so the country column stays put. No other mobile
   changes for now. */
