:root {
  --bg: #0f1419;
  --panel: #1a2332;
  --panel2: #243044;
  --border: #2d3a4f;
  --text: #e7ecf3;
  --muted: #8b9bb4;
  --amber: #f0a500;
  --green: #3dd68c;
  --red: #f07178;
  --blue: #5b9fd4;
  --mono: "SF Mono", "Consolas", monospace;
  --sans: "Segoe UI", system-ui, sans-serif;

  /* Modular Team Builder Mapped Retro System */
  --term-green: var(--green);
  --term-amber: var(--amber);
  --term-dim: var(--muted);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { font-weight: 700; letter-spacing: 0.02em; }
.brand span { color: var(--amber); }
.topbar-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.status {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0.35rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: #121820;
}
.tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
}
.tab-btn:hover {
  color: var(--text);
  background: var(--panel2);
}
.tab-btn.active {
  color: var(--text);
  border-color: var(--border);
  background: var(--panel2);
  box-shadow: inset 0 -2px 0 var(--amber);
}
main {
  padding: 1rem 1.25rem 2.5rem;
  max-width: min(98vw, 1800px);
  margin: 0 auto;
  width: 100%;
}
.panel { display: none; }
.panel.active { display: block; }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.section-title {
  font-weight: 700;
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem 1rem;
}
label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
}
input, select, button {
  font: inherit;
}
input[type="number"],
input[type="time"],
input[type="date"],
input[type="text"],
select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.4rem 0.55rem;
}
input:focus,
select:focus {
  outline: 1px solid var(--amber);
}
.btn {
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn-amber {
  background: #3a2e10;
  border-color: #6b5210;
  color: var(--amber);
}
.btn-amber:hover { background: #4a3a14; }
.btn-red {
  background: #3a1a1c;
  border-color: #6b2a2e;
  color: var(--red);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.data-table th,
.data-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.4rem 0.5rem;
  text-align: left;
}
.data-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
}
.data-table input { width: 4.5rem; }
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.pill {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.75rem;
}
.badge {
  display: inline-block;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
}
.badge-open { background: #1e3a2f; color: var(--green); }
.badge-am { background: #1e2f4a; color: var(--blue); }
.badge-pm { background: #3a2e10; color: var(--amber); }
.badge-close { background: #3a1a2e; color: #e89; }
.badge-4x10 { background: #2a1e3a; color: #c9a0ff; }
.cell-rdo {
  color: var(--muted);
  opacity: 0.7;
}
.cell-work {
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.78rem;
}
.cov-bars {
  display: grid;
  gap: 0.35rem;
}
.cov-row {
  display: grid;
  grid-template-columns: 4.5rem 1fr 2.5rem;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.78rem;
}
.cov-track {
  height: 14px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: row;
}
.cov-fill-m {
  height: 100%;
  background: #4a90d9;
  min-width: 0;
}
.cov-fill-f {
  height: 100%;
  background: #e891b8;
  min-width: 0;
}
.sex-m { color: #7eb6ef; }
.sex-f { color: #f0a0c8; }
.sex-legend span {
  margin-right: 0.75rem;
  font-size: 0.78rem;
}
.sex-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 0.25rem;
  vertical-align: middle;
}
.sex-legend .sw-m { background: #4a90d9; }
.sex-legend .sw-f { background: #e891b8; }
.muted {
  color: var(--muted);
  font-size: 0.8rem;
}
.alert {
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  margin: 0.35rem 0;
  font-size: 0.85rem;
}
.alert-ok {
  background: #14301f;
  border: 1px solid #2a5a3c;
  color: var(--green);
}
.alert-warn {
  background: #3a2e10;
  border: 1px solid #6b5210;
  color: var(--amber);
}
.alert-error {
  background: #3a1a1c;
  border: 1px solid #6b2a2e;
  color: var(--red);
}
.toolbar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.lines-scroll { overflow-x: auto; }
.cov-matrix th,
.cov-matrix td {
  text-align: center;
  font-family: var(--mono);
  font-size: 0.78rem;
}
.cov-matrix th:first-child,
.cov-matrix td:first-child {
  text-align: left;
  font-family: var(--sans);
}
.cov-matrix td.hc-0 {
  color: var(--muted);
  opacity: 0.5;
}
.cov-matrix td.hc-low { color: var(--amber); }
.cov-matrix td.hc-ok { color: var(--green); }
.cov-matrix td.hc-high {
  color: var(--blue);
  font-weight: 700;
}
.cov-matrix tr:hover td {
  background: var(--panel2);
}
.rdo-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.2rem;
}
.rdo-chk {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  font-size: 0.65rem;
  color: var(--muted);
  cursor: pointer;
  margin: 0;
}
.rdo-chk input {
  margin: 0;
  width: auto;
}
.rdo-chk span { line-height: 1; }

/* Airport Config Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 100;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
  color: var(--text);
}
.modal-content {
  background-color: var(--panel);
  margin: 5% auto;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 720px;
  max-width: 95vw;
  position: relative;
  resize: both;
  overflow: auto;
  min-width: 320px;
  min-height: 250px;
}
.modal-close {
  color: var(--muted);
  position: absolute;
  top: 10px;
  right: 20px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}
.modal-close:hover { color: var(--red); }
.modal-header {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.modal-title { margin: 0; }
.modal-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.modal-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 0.6rem 1rem;
  cursor: pointer;
  font: inherit;
  border-radius: 6px 6px 0 0;
  position: relative;
  bottom: -1px;
}
.modal-tab-btn:hover { background: var(--panel2); }
.modal-tab-btn.active {
  color: var(--text);
  background: var(--panel2);
  border-color: var(--border);
  border-bottom-color: var(--panel2);
  box-shadow: inset 0 2px 0 var(--amber);
}
.modal-panel { display: none; }
.modal-panel.active { display: block; }
.config-section {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.config-section-title {
  font-weight: 600;
  margin: 0 0 1rem;
  font-size: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.item-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.item-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
}
.item-row .item-name { flex-grow: 1; }
.item-row .item-name input { width: 10rem; }
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem 1rem;
}
.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem 1rem;
}
.sub-item {
  padding-left: 1.5rem;
  margin-top: 0.5rem;
  border-left: 2px solid var(--border);
}
/* ===== Team forming ===== */
.team-pool {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.team-role-group {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  overflow: hidden;
}
.team-role-title {
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.4rem 0.75rem;
  background: var(--panel2);
  border-bottom: 1px solid var(--border);
}
.team-role-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem;
  min-height: 2.5rem;
}
.team-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.4rem 0.6rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: grab;
}
.team-line:active { cursor: grabbing; }
.team-line-code { font-weight: 700; font-family: var(--mono); }
.team-line .badge { font-size: 0.68rem; }
.team-boards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.team-board {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  min-height: 8rem;
}
.team-board-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel2);
  border-radius: 10px 10px 0 0;
}
.team-name-input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  font: inherit;
  font-weight: 700;
}
.team-board-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem;
  min-height: 4rem;
  flex: 1;
}
.team-board-list .team-line { background: var(--bg); }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.75rem; }
.sortable-ghost { opacity: 0.4; }
.sortable-chosen { box-shadow: 0 0 0 2px var(--amber); }
.sortable-drag { opacity: 0.9; }
.cov-matrix td.hc-closed {
  color: var(--muted);
  opacity: 0.35;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 4px,
    rgba(255,255,255,0.03) 4px,
    rgba(255,255,255,0.03) 8px
  );
}
/* ========== Touch-friendly enhancements ========== */
html {
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}
.btn,
.tab-btn,
.modal-tab-btn {
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(240, 165, 0, 0.25);
}
.btn-sm {
  min-height: 2.25rem;
  min-width: 2.25rem;
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
}
.tab-btn {
  padding: 0.65rem 1.1rem;
}
input[type="number"],
input[type="time"],
input[type="date"],
input[type="text"],
select {
  min-height: 2.5rem;
  font-size: 1rem;
  padding: 0.4rem 0.55rem;
}
.rdo-chk {
  min-width: 2rem;
  min-height: 2.5rem;
  padding: 0.2rem;
  justify-content: center;
}
.rdo-chk input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  min-width: 1.25rem;
  min-height: 1.25rem;
  margin: 0;
  cursor: pointer;
}
.lines-scroll {
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: min(78vh, 900px);
  overscroll-behavior: contain;
  width: 100%;
}
.lines-scroll-wide {
  max-height: min(80vh, 960px);
}
.lines-editable {
  min-width: 1100px;
  width: max-content;
  max-width: none;
}
.lines-editable th,
.lines-editable td {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  padding: 0.4rem 0.5rem;
}
.lines-editable .line-edit {
  max-width: none;
  min-width: 5.5rem;
}
.lines-editable .line-code-input {
  min-width: 6.5rem;
  max-width: 10rem;
}
.cov-matrix {
  min-width: 640px;
}
.cov-matrix th,
.cov-matrix td {
  padding: 0.55rem 0.45rem;
  font-size: 0.85rem;
  min-width: 3.25rem;
}
.cov-matrix th:first-child,
.cov-matrix td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--panel);
  min-width: 4.25rem;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.25);
}
.cov-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--panel2);
}
.cov-matrix thead th:first-child {
  z-index: 4;
  left: 0;
}
.btn:active,
.tab-btn:active {
  filter: brightness(1.15);
  transform: scale(0.98);
}
.cov-matrix tr:active td {
  background: var(--panel2);
}
.team-line {
  min-height: 2.75rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.team-pool-list,
.team-board-list {
  min-height: 4.5rem;
  padding: 0.65rem;
}
.modal-close {
  min-width: 2.75rem;
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  top: 8px;
  right: 8px;
  padding: 0.35rem;
  border-radius: 8px;
}
.modal-close:active {
  background: rgba(240, 113, 120, 0.2);
  color: var(--red);
}
.toolbar {
  gap: 0.5rem;
  flex-wrap: wrap;
}
.topbar {
  flex-wrap: wrap;
  gap: 0.65rem;
}
.topbar-actions {
  gap: 0.4rem;
}
@media (max-width: 900px) {
  .grid-2,
  .grid-4 {
    grid-template-columns: 1fr 1fr;
  }
  .topbar {
    padding: 0.65rem 0.85rem;
  }
  .tabs {
    padding: 0.4rem 0.75rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }
  .tab-btn {
    flex-shrink: 0;
  }
  .panel {
    padding: 0.75rem;
  }
  .modal-content {
    width: 96%;
    margin: 3% auto;
    max-height: 92vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .data-table {
    font-size: 0.9rem;
  }
  .data-table input[type="time"],
  .data-table input[type="number"],
  .data-table input[type="text"] {
    min-width: 4.5rem;
    width: auto;
  }
}
@media (max-width: 560px) {
  .grid-2,
  .grid-4 {
    grid-template-columns: 1fr;
  }
  .brand {
    font-size: 0.95rem;
  }
  .btn,
  .tab-btn {
    padding: 0.55rem 0.75rem;
  }
  .cov-matrix th,
  .cov-matrix td {
    padding: 0.45rem 0.3rem;
    font-size: 0.8rem;
    min-width: 2.75rem;
  }
}
.team-line-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  min-height: 2.5rem;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
}
.team-line-check input[type="checkbox"] {
  width: 1.35rem;
  height: 1.35rem;
  min-width: 1.35rem;
  min-height: 1.35rem;
  margin: 0;
  cursor: pointer;
}
.team-assign-bar {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.5rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border);
}
.team-assign-bar select {
  min-width: 8rem;
}
.team-line {
  cursor: default;
}
.team-line .team-line-check + .team-line-code {
  font-weight: 700;
}
.lines-editable .line-edit {
  min-height: 2.25rem;
  font-size: 0.85rem;
  width: auto;
  min-width: 5.5rem;
}
.lines-editable .line-code-input {
  min-width: 6.5rem;
  max-width: 12rem;
}
.lines-editable td {
  vertical-align: middle;
}
.lines-group-row td {
  background: var(--panel2);
  color: var(--amber);
  font-size: 0.85rem;
  padding: 0.45rem 0.6rem;
  border-top: 2px solid var(--border);
}
.cell-toggle {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  min-width: 3.5rem;
}
.cell-toggle:active {
  filter: brightness(1.25);
  outline: 2px solid var(--amber);
}
.line-rdo-cell {
  white-space: nowrap;
  font-size: 0.8rem;
}
#lines-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
#lines-toolbar select {
  min-height: 2.4rem;
}
.team-drag-handle {
  cursor: grab;
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: -0.15em;
  padding: 0.25rem 0.35rem;
  user-select: none;
  -webkit-user-select: none;
  flex-shrink: 0;
  touch-action: none;
}
.team-drag-handle:active {
  cursor: grabbing;
  color: var(--amber);
}
.team-board-list[data-empty="1"] {
  min-height: 4.5rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  margin: 0.35rem;
}
.team-board-list[data-empty="1"]::before {
  content: "Drop lines here";
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1rem;
  text-align: center;
  pointer-events: none;
}
.team-role-list {
  min-height: 2.5rem;
}
.sortable-ghost {
  opacity: 0.4;
}
.sortable-chosen {
  box-shadow: 0 0 0 2px var(--amber);
}
.sortable-drag {
  opacity: 0.95;
}
.follow-me-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  margin: 0;
  white-space: nowrap;
}
.follow-me-label input {
  width: 1.2rem;
  height: 1.2rem;
  min-width: 1.2rem;
  min-height: 1.2rem;
}
.team-follow-docks {
  display: none;
  pointer-events: none;
}
.team-follow-docks.is-active {
  display: block;
}
.team-float-panel {
  position: fixed;
  z-index: 50;
  pointer-events: auto;
  margin: 0;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  border: 1px solid var(--amber);
  display: flex;
  flex-direction: column;
  min-width: 14rem;
  min-height: 8rem;
  resize: both;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--panel);
}
.team-float-panel.is-dragging {
  opacity: 0.92;
  cursor: grabbing;
}
.float-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  background: var(--panel2);
  border-bottom: 1px solid var(--border);
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
}
.float-panel-head:active {
  cursor: grabbing;
}
.float-panel-hint {
  font-size: 0.7rem;
}
.team-stats-dock {
  min-width: 18rem;
  width: 24rem;
  height: 22rem;
  max-width: 95vw;
  max-height: 85vh;
}
.team-boards-dock {
  min-width: 22rem;
  width: 32rem;
  height: 28rem;
  max-width: 95vw;
  max-height: 85vh;
}
.team-float-panel {
  resize: both !important;
  overflow: auto !important;
}
.team-boards-follow {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1;
  overflow: auto;
}
.team-arch-bar {
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
}
.team-arch-bar label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
}
.team-stat-summary {
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}
.team-stat-bar {
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  border: 1px solid var(--border);
  margin-top: 0.4rem;
  overflow: hidden;
}
.team-stat-bar-fill {
  height: 100%;
  background: var(--amber);
  transition: width 0.2s ease;
}
.team-stat-block {
  font-size: 0.82rem;
  margin-bottom: 0.65rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.team-stat-roles {
  margin-top: 0.3rem;
  padding-left: 0.25rem;
}
.team-stat-role {
  color: var(--muted);
  line-height: 1.45;
}
.team-stat-teams {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.team-stat-team-line {
  font-size: 0.78rem;
  line-height: 1.35;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow-x: auto;
}
.team-follow-badge {
  color: var(--amber);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}
.team-counts-header {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  max-width: 100%;
}
.team-count-total {
  font-weight: 700;
  color: var(--amber);
}
.team-count-chip {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  white-space: nowrap;
}
.follow-me-team {
  font-size: 0.8rem;
}
.team-line-cols {
  display: grid;
  grid-template-columns: 1.4rem 2.6rem 1.6rem 5.5rem minmax(4rem, 1fr) 2.4rem 1.8rem;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.68rem;
  border-bottom: 1px solid var(--border);
}
.team-line-compact {
  display: grid;
  grid-template-columns: 1.4rem 2.6rem 1.6rem 5.5rem minmax(4rem, 1fr) 2.4rem 1.8rem;
  gap: 0.25rem;
  align-items: center;
  padding: 0.3rem 0.5rem;
  font-size: 0.78rem;
  min-height: 2.1rem;
}
.team-line-compact .tl-role {
  font-weight: 700;
}
.team-line-compact .btn-sm {
  padding: 0.15rem 0.35rem;
  min-height: 1.5rem;
  min-width: 1.5rem;
}
body.team-follow-active #tab-teams {
}
.cell-function-duty {
  font-weight: 600;
}
.cell-function-duty.cell-bag {
  background: #f4b4b4 !important;
  color: #111 !important;
  box-shadow: inset 0 0 0 1px #c07070;
}
.cell-function-duty.cell-dfo {
  background: #ffc000 !important;
  color: #111 !important;
  box-shadow: inset 0 0 0 1px #c49200;
}
.rpt-role {
  white-space: nowrap;
  font-size: 0.75rem;
  margin-right: 0.25rem;
}
.rpt-table td {
  vertical-align: top;
  font-size: 0.78rem;
}
.rpt-role {
  display: block;
  white-space: nowrap;
  font-size: 0.72rem;
  line-height: 1.25;
}
.rpt-role-lbl {
  display: inline-block;
  min-width: 2.4rem;
  color: var(--muted);
  font-weight: 600;
}
.rpt-table td {
  vertical-align: top;
  font-size: 0.78rem;
  min-width: 5.5rem;
}
.rpt-table th {
  white-space: nowrap;
}
.team-phase-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.instructions-container {
  max-height: 70vh;
  overflow-y: auto;
  background-color: var(--bg);
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: 6px;
  line-height: 1.5;
}
.instructions-container pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.85rem;
}
