/* =====================================================================
   Teambereich (teambereich.html). Baut auf portal.css und events.css auf.
   ===================================================================== */
.tb-page .s-main { max-width: 1440px; }
.tb-hero { grid-template-columns: minmax(0, 1fr) auto; }
.tb-hero .p-kicker { display: flex; align-items: center; gap: 8px; }
.tb-teamsel { font: 700 12px var(--f-ui); padding: 2px 6px; border-radius: 8px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2); text-transform: none; letter-spacing: 0; }
.tb-hero-act { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.tb-wrap { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; align-items: start; }
.tb-side { position: sticky; top: 84px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; max-height: calc(100vh - 100px); overflow: auto; padding: 0 2px 4px 0; min-width: 0; }
.tb-side > * { min-width: 0; }
.tb-trk-h { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; margin: 10px 4px 2px; }
.tb-trks { display: grid; gap: 4px; }
.tb-trk {
  appearance: none; text-align: left; display: grid; gap: 1px; padding: 9px 12px; border-radius: 12px; cursor: pointer; width: 100%; box-sizing: border-box; min-width: 0;
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--k, var(--line-2)); color: var(--text); font: inherit;
}
.tb-trk:hover { border-color: var(--line-2); }
.tb-trk.on { background: color-mix(in srgb, var(--k, var(--team)) 14%, var(--panel-2)); border-color: var(--k, var(--team)); }
.tb-trk-n { font-weight: 700; font-size: 14px; line-height: 1.25; }
.tb-trk small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-trk small b { color: var(--text); }
.tb-all { --k: var(--team); }
.tb-none { padding: 4px 6px; margin: 0; overflow-wrap: anywhere; }
.tb-newtrk { display: flex; gap: 6px; margin-top: 6px; }
.tb-newtrk input { flex: 1 1 auto; min-width: 0; width: auto; }
.tb-newtrk .btn { flex: 0 0 auto; }
.tb-usage { padding: 8px 4px 0; }
.tb-main { min-width: 0; }

/* Alle Strecken */
.tb-tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.tb-tcard {
  appearance: none; text-align: left; display: grid; gap: 6px; padding: 14px 16px; border-radius: 16px; cursor: pointer; font: inherit; color: var(--text);
  background: linear-gradient(140deg, color-mix(in srgb, var(--k) 12%, var(--panel-2)), var(--panel-2) 60%); border: 1px solid var(--line); border-top: 3px solid var(--k);
  transition: transform .15s, border-color .15s;
}
.tb-tcard:hover { transform: translateY(-1px); border-color: var(--line-2); }
.tb-tcard > b { font-size: 16.5px; line-height: 1.2; }
.tb-tbest i { font-style: normal; font-weight: 700; color: var(--purple); }
.tb-tbest small { color: var(--muted); }
.tb-tstats { display: flex; flex-wrap: wrap; gap: 4px; }
.tb-tstats span { font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--panel-3); color: var(--muted); }
.tb-feed { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
.tb-feed li { display: block; padding: 7px 10px; border-radius: 10px; background: var(--panel-2); line-height: 1.4; }
.tb-feed small { display: block; color: var(--dim, var(--muted)); font-size: 11.5px; }
.tb-fk { display: inline-block; font: 700 10.5px/1.6 var(--f-ui); text-transform: uppercase; letter-spacing: .05em; padding: 0 7px; border-radius: 999px; margin-right: 6px; background: var(--panel-3); color: var(--muted); }
.tb-fk.t { color: var(--purple); } .tb-fk.s { color: var(--team); } .tb-fk.m { color: var(--orange, #ff9f0a); } .tb-fk.n { color: var(--green); }

/* Überblick */
.tb-ocar { border-top: 3px solid var(--c); }
.tb-ocar h2 { display: flex; align-items: center; gap: 8px; }
.tb-podium { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.tb-podium li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto 70px; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--panel-2); }
.tb-podium li:first-child { background: color-mix(in srgb, var(--purple) 12%, var(--panel-2)); }
.tb-podium i { font-style: normal; font-weight: 700; }
.tb-podium li:first-child i { color: var(--purple); }
.tb-podium small { color: var(--muted); text-align: right; }
.tb-pos { font: 700 13px var(--f-mono); color: var(--muted); text-align: center; }
.tb-notes, .tb-sheet-prev .tb-notes { white-space: pre-wrap; font-size: 13.5px; line-height: 1.5; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); max-height: 320px; overflow: auto; }

/* Zeiten */
.tb-filt select { padding: 4px 8px; }
.tb-mini { padding: 2px 4px; font-size: 12px; max-width: 160px; }
.tb-x { padding: 2px 9px !important; min-height: 0 !important; }
.tb-alltimes td { white-space: nowrap; }

/* Telemetrie */
.tb-tel tr.is-a td:nth-child(3) { box-shadow: inset 3px 0 0 var(--team); }
.tb-tel tr.is-b td:nth-child(3) { box-shadow: inset 3px 0 0 var(--orange, #ff9f0a); }
.tb-tel input[type=radio] { accent-color: var(--team); }
.tb-tel td:nth-child(2) input { accent-color: var(--orange, #ff9f0a); }
.tb-cmp { margin-top: 14px; display: grid; gap: 10px; }
.tb-cmp-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 14.5px; }
.tb-lg { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; font: 700 11px var(--f-mono); color: #001; background: var(--team); }
.tb-lg.b { background: var(--orange, #ff9f0a); }
.tb-chart { position: relative; height: 360px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.tb-chart canvas { width: 100%; height: 100%; display: block; cursor: crosshair; }
.tb-hover { position: absolute; top: 8px; padding: 7px 10px; border-radius: 10px; background: var(--panel-3); border: 1px solid var(--line-2); font-size: 12px; line-height: 1.5; pointer-events: none; white-space: nowrap; }
.tb-stiles { margin: 0; }
.slow { color: var(--err, var(--red)); }
.fast { color: var(--green); }
.tb-laps { max-height: 220px; overflow: auto; }
.tb-saved { display: grid; gap: 6px; margin-top: 8px; }
.tb-saved > div { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--panel-2); font-size: 13px; }
.tb-saved .btn { margin-left: auto; }

/* Streckenmappe */
.tb-page textarea[data-sheet] { min-height: 420px; font: 14px/1.55 var(--f-ui); }
.tb-fform { margin-top: 12px; }

/* Dialog: aus Event übernehmen */
.tb-dlg { width: min(640px, calc(100% - 24px)); border: 1px solid var(--line-2); border-radius: 18px; padding: 0; background: var(--panel); color: var(--text); }
.tb-dlg::backdrop { background: rgba(0, 0, 0, .6); }
.tb-dlg-in { display: grid; gap: 12px; padding: 18px 20px; }
.tb-dlg label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.tb-dlg .ev-chk { display: inline-flex; }

@media (max-width: 980px) {
  .tb-wrap { grid-template-columns: 1fr; }
  .tb-side { position: static; max-height: none; grid-template-columns: 1fr; }
  .tb-trks { grid-auto-flow: column; grid-auto-columns: minmax(180px, 1fr); overflow-x: auto; padding-bottom: 4px; }
  .tb-hero { grid-template-columns: 1fr; }
  .tb-hero-act { justify-content: flex-start; }
}
@media (max-width: 640px) {
  .tb-chart { height: 300px; }
  .tb-podium li { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .tb-podium small { display: none; }
}
.tb-gap { display: block; font-size: 11.5px; }

/* ---------------------------------------------------------------- mehr Breite: kleinere Ränder, schmalere Streckenleiste */
body.tb-page .s-main { max-width: 1920px; padding: 22px 18px 48px; }
@media (min-width: 981px) { .tb-wrap { grid-template-columns: 220px minmax(0, 1fr); gap: 14px; } }
.tb-hero { padding: 18px 22px; margin-bottom: 12px; }
.tb-setups { min-width: 0; }
.tb-setups .ev-agenda { max-width: none; }
.tb-tab-up { color: var(--team) !important; }
.tb-tab-up[aria-selected="true"] { color: var(--text) !important; }

/* Reiter „Setup hochladen“: Formular links, Vorschau der Änderungen rechts */
.tb-up { display: grid; grid-template-columns: minmax(340px, 0.9fr) minmax(0, 1.3fr); gap: 14px; align-items: start; }
.tb-drop { padding: 44px 16px !important; font-size: 15px; }
.tb-prev { min-width: 0; }
.tb-prev .adm-table-wrap { max-height: 70vh; overflow: auto; }
.tb-up code { font-size: 12px; overflow-wrap: anywhere; }
@media (max-width: 1100px) { .tb-up { grid-template-columns: 1fr; } }
@media (max-width: 640px) { body.tb-page .s-main { padding: 14px 10px 32px; } }

/* Auto-Auswahl: Liste aller LMU-Autos (mit Saison/Evo) und frei änderbarer Name */
.tb-carpick { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; grid-column: 1 / -1; }
.tb-carpick label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.tb-carpick select, .tb-carpick input { width: 100%; min-width: 0; }
@media (max-width: 640px) { .tb-carpick { grid-template-columns: 1fr; } }
