/* No dark frame around the page: the page grey (what the content box used to show, 60 % white over
   the dark grey) fills the whole window */
html, body { background-color: #b1b1b1; }
/* One corner radius for the floating cards and bars of the map (menu bar, device card, playback menu
   and progress bar), also for the menu bar of the other pages */
:root { --tt-card-radius: 12px; }

body {
  min-height: 100vh;
  padding: 0;
  font-size: 20px;
}

a {
  color: gray !important;
}

a:hover {
  color: Gray !important;
  cursor: pointer !important;
}

.pointer {
  cursor: pointer !important;
}

.btn {
    width: 300;
}

.active {
    color: #cc3a0c !important;
}

.selected {
  background-color: #999999 !important;
}

.accordion {
  background-color: gray;
}

.btn-primary {
  background-color: #cc3a0c !important;
  border-color: LightGray !important;
  color: White !important;
}
.btn-primary:hover,
.btn-primary:active,
.btn-primary:visited,
.btn-primary:focus {
  background-color: Gray !important;
  border-color: Gray !important;
}

.bg-dark {
  background-color: rgba(60, 60, 60, 1);
}

img.resize {
  height: auto;
  width: auto;
  max-width: 30px;
  max-height: 30px;
}

.padding {
  padding-right: 2vh !important;
}

.nav-item {
  align-self: end;
}

.header {
  text-decoration: underline;
}

article,
aside,
footer,
header,
hgroup,
nav,
section {
  display: block;
}

.link {
  display: inline-grid;
}

/* The map fills the window (the page's script sets the exact height); the tables are below it */
#map {
  height: 100vh;
  height: 100dvh;
}
article.text:has(#map) { padding: 0 0 2vh; }
article.text:has(#map) .row ~ .row { padding-left: 2vh; padding-right: 2vh; } /* the tables keep their room */

article.text {
  color: black;
  font-weight: bold;
  padding: 2vh;
  background-color: transparent;
}

.right {
  direction: rtl;
  unicode-bidi: bidi-override;
  text-align: left;
}

.semi-transparent {
  background-color: rgba(100, 100, 100, 0.2);
}

.hidden {
  display: none;
}

.left {
  text-align: right;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  /* display: none; <- Crashes Chrome on hover */
  -webkit-appearance: none;
  margin: 0; /* <-- Apparently some margin are still there even though it's hidden */
}

label,
.padding-left {
  padding-left: 2vh !important;
  white-space: nowrap;
}

.indent {
  padding-left: 3vh !important;
}

.track {
  clear: both;
  margin-bottom: 1em;
  padding: 5px 0;
  border-bottom: 1px solid #e4e6e8;
}

.center {
  text-align: center;
  line-height: 4em;
}

.padding-top {
  padding-top: 1rem;
}

input[type="checkbox"] {
  transform: scale(2, 2);
  accent-color: #2b3a4a; /* ticked: the dark blue of the table headers */
}

/* A compact tick-box drawn by the page (Devices: first column and "All"; Tracks: Signal), not the site-wide scale(2):
   1rem, rounded, grey edge; ticked: the dark blue of the table headers with a white tick; "All" with only some
   ticked: a white dash. The size is set where it is used. */
.devices-table .select-col input[type=checkbox],
.devices-sort-mobile .select-all-mobile input[type=checkbox],
#tracks-table .tt-signal-box {
  -webkit-appearance: none;
  appearance: none;
  transform: none;
  flex: 0 0 auto;
  box-sizing: border-box;
  border: 1.5px solid #8593a3;
  border-radius: 4px;
  background: #fff center / 75% no-repeat;
  transition: background-color 0.1s, border-color 0.1s;
}
.devices-table .select-col input[type=checkbox]:hover,
.devices-sort-mobile .select-all-mobile input[type=checkbox]:hover,
#tracks-table .tt-signal-box:hover { border-color: #2b3a4a; }
.devices-table .select-col input[type=checkbox]:focus-visible,
.devices-sort-mobile .select-all-mobile input[type=checkbox]:focus-visible,
#tracks-table .tt-signal-box:focus-visible { outline: 2px solid #6ea8fe; outline-offset: 1px; }
.devices-table .select-col input[type=checkbox]:checked,
.devices-sort-mobile .select-all-mobile input[type=checkbox]:checked,
#tracks-table .tt-signal-box:checked {
  border-color: #2b3a4a;
  background-color: #2b3a4a;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.devices-table .select-col input[type=checkbox]:indeterminate,
.devices-sort-mobile .select-all-mobile input[type=checkbox]:indeterminate {
  border-color: #2b3a4a;
  background-color: #2b3a4a;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8h8' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.dot {
  height: 25px;
  width: 25px;
  border-radius: 50%;
  display: inline-block;
}

.switch {
  font-size: 1rem;
  position: relative;
  padding-right: 1rem;
}

.switch input {
  position: absolute;
  height: 1px;
  width: 1px;
  background: none;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  padding: 0;
}

.switch input + label {
  position: relative;
  min-width: calc(calc(2.375rem * 0.8) * 2);
  border-radius: calc(2.375rem * 0.8);
  height: calc(2.375rem * 0.8);
  line-height: calc(2.375rem * 0.8);
  display: inline-block;
  cursor: pointer;
  outline: none;
  user-select: none;
  vertical-align: middle;
  text-indent: calc(calc(calc(2.375rem * 0.8) * 2) + 0.5rem);
}

.switch input + label::before,
.switch input + label::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: calc(calc(2.375rem * 0.8) * 2);
  bottom: 0;
  display: block;
}

.switch input + label::before {
  right: 0;
  background-color: #dee2e6;
  border-radius: calc(2.375rem * 0.8);
  transition: 0.2s all;
}

.switch input + label::after {
  top: 2px;
  left: 2px;
  width: calc(calc(2.375rem * 0.8) - calc(2px * 2));
  height: calc(calc(2.375rem * 0.8) - calc(2px * 2));
  border-radius: 50%;
  background-color: white;
  transition: 0.2s all;
}

.switch input:checked + label::before {
  background-color: Gray;
}

.switch input:checked + label::after {
  margin-left: calc(2.375rem * 0.8);
}

.switch input:focus + label::before {
  outline: none;
  box-shadow: 0 0 0 0.2rem rgba(0, 136, 221, 0.25);
}

.switch input:disabled + label {
  color: #868e96;
  cursor: not-allowed;
}

.switch input:disabled + label::before {
  background-color: #e9ecef;
}

.switch.switch-sm {
  font-size: 0.875rem;
}

.switch.switch-sm input + label {
  min-width: calc(calc(1.9375rem * 0.8) * 2);
  height: calc(1.9375rem * 0.8);
  line-height: calc(1.9375rem * 0.8);
  text-indent: calc(calc(calc(1.9375rem * 0.8) * 2) + 0.5rem);
}

.switch.switch-sm input + label::before {
  width: calc(calc(1.9375rem * 0.8) * 2);
}

.switch.switch-sm input + label::after {
  width: calc(calc(1.9375rem * 0.8) - calc(2px * 2));
  height: calc(calc(1.9375rem * 0.8) - calc(2px * 2));
}

.switch.switch-sm input:checked + label::after {
  margin-left: calc(1.9375rem * 0.8);
}

.switch.switch-lg {
  font-size: 1.25rem;
}

.switch.switch-lg input + label {
  min-width: calc(calc(3rem * 0.8) * 2);
  height: calc(3rem * 0.8);
  line-height: calc(3rem * 0.8);
  text-indent: calc(calc(calc(3rem * 0.8) * 2) + 0.5rem);
}

.switch.switch-lg input + label::before {
  width: calc(calc(3rem * 0.8) * 2);
}

.switch.switch-lg input + label::after {
  width: calc(calc(3rem * 0.8) - calc(2px * 2));
  height: calc(calc(3rem * 0.8) - calc(2px * 2));
}

.switch.switch-lg input:checked + label::after {
  margin-left: calc(3rem * 0.8);
}

/* Battery indicator */

.battery {
  border: 3px solid #333;
  width: 18px;
  height: 28px;
  padding: 2px;
  border-radius: 4px;
  position: relative;
  margin: 15px 15px;
  box-sizing: unset;
}
.battery:before {
  content: "";
  height: 3px;
  width: 18px;
  background: #333;
  display: block;
  position: absolute;
  top: -6px;
  border-radius: 4px 4px 0 0;
}
.battery:after {
  content: "";
  display: block;
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  bottom: -1px;
  border: 1px solid #fff;
  border-radius: 2px;
}
.battery-level {
  background: #30b455;
  position: absolute;
  bottom: 0px;
  left: 0;
  right: 0;
}
.battery-level.warn {
  background-color: #efaf13;
}
.battery-level.alert {
  background-color: #e81309;
}
.battery-level.alert:before {
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%2232%22%20height%3D%2232%22%20viewBox%3D%220%200%2032%2032%22%3E%3Cg%3E%3C%2Fg%3E%20%3Cpath%20fill%3D%22%23e81309%22%20d%3D%22M17.927%2012l2.68-10.28c0.040-0.126%200.060-0.261%200.060-0.4%200-0.726-0.587-1.32-1.314-1.32-0.413%200-0.78%200.187-1.019%200.487l-13.38%2017.353c-0.18%200.227-0.287%200.513-0.287%200.827%200%200.733%200.6%201.333%201.333%201.333h8.073l-2.68%2010.28c-0.041%200.127-0.060%200.261-0.060%200.4%200.001%200.727%200.587%201.32%201.314%201.32%200.413%200%200.78-0.186%201.020-0.487l13.379-17.353c0.181-0.227%200.287-0.513%200.287-0.827%200-0.733-0.6-1.333-1.333-1.333h-8.073z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-size: 18px;
  height: 18px;
  width: 18px;
  margin: -25px 0 0 2px;
  content: "";
  display: inline-block;
  position: absolute;
}
.border{
  border: 1px solid;
}

/* "Find all" below the device switches (Tracks page) */
.toggle-all {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

/* Tracks page: courses and tracks tables below the map, styled like the Devices table */
.tt-section { margin-top: 0.9rem; }
.tt-section-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; }
.tt-section-title { font-weight: 700; font-size: 1rem; }
.tt-section-hint { color: #4b5563; font-size: 0.8rem; }
.tt-section-head .btn { width: auto; margin-left: auto; padding: 0.15rem 0.6rem; font-size: 0.85rem; }
.ocad-info { text-decoration: underline dotted; cursor: help; }
.ocad-info:focus-visible { outline: 2px solid #4363d8; outline-offset: 1px; }
.tt-table-wrap {
  margin-top: 0.4rem;
  overflow: hidden;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  background: #fff;
}
.tt-table-wrap .bootstrap-table .fixed-table-container,
.tt-table-wrap .bootstrap-table .fixed-table-container .table { border: 0; }
.tt-table { margin: 0; font-size: 0.875rem; white-space: nowrap; }
.tt-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #2b3a4a;
  color: #fff;
  font-weight: 600;
  border-bottom: 0;
  padding: 0.3rem 0.4rem;
}
.tt-table thead th .th-inner { padding: 0; }
.tt-table tbody tr:nth-child(even) { background: #f4f7fa; }
.tt-table tbody tr:hover { background: #e3eefb; }
.tt-table td { padding: 0.15rem 0.4rem; line-height: 1.3; border-color: #e3e8ee; }
.tt-table tbody tr.selected td { background: #cfe0f5 !important; }
.tt-table .tt-enable-col { width: 4.2rem; text-align: center; }
.tt-table .course-enable { width: 15px; height: 15px; margin: 0; transform: none; cursor: pointer; vertical-align: middle; }
.tt-table .tt-download .header { margin-right: 0.9rem; }
.tt-table .delete { line-height: 1; }
.tt-table .material-icons { font-size: 18px; vertical-align: middle; }
.tt-table-wrap .filter-control select { font-size: 0.8rem; padding: 0.1rem 0.3rem; height: auto; }
/* Device Tracks: the device drop-down is the Device column's header (no separate "Device" line) */
#tracks .tt-table thead th[data-field="name"] .th-inner { display: none; }
#tracks .tt-table thead th { vertical-align: middle; }
/* Upload Course: the colours and font of the table headers */
.tt-upload-btn,
.tt-upload-btn:disabled {
  background: #2b3a4a;
  border-color: #2b3a4a;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
}
.tt-upload-btn:hover,
.tt-upload-btn:focus { background: #3b4d61; border-color: #3b4d61; color: #fff; }
/* The table scrolls inside bootstrap-table's body (header stays on top); its height: 100% made the box
   taller than the table */
.tt-table-wrap .fixed-table-container { height: auto !important; }
.tt-table-wrap .fixed-table-body { height: auto !important; max-height: 45vh; overflow: auto; }

/* Tracks page: TrackTape logo in the map's top-left corner */
.map-logo {
  height: 60px;
  width: auto;
  margin: 12px 0 0 14px;
  /* Transparent, no plate: a thin light glow along the logo's own outline keeps the dark text and
     blocks readable on the satellite view */
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.95)) drop-shadow(0 0 3px rgba(255, 255, 255, 0.7));
  pointer-events: none;
}

/* Tracks page: Map / Satellite tile, bottom left; it shows a picture of the view it switches to */
.map-type-tile {
  position: relative;
  width: 64px;
  height: 64px;
  margin: 0 0 12px 10px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 8px;
  overflow: hidden;
  background: #ccc center / cover no-repeat;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}
.map-type-tile.show-satellite { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><rect width='64' height='64' fill='%233d5a2f'/><path d='M0 0h26l-4 18H0z' fill='%23577a3a'/><path d='M30 0h34v22L34 26z' fill='%236b7f45'/><path d='M0 24l24-4 6 18-30 6z' fill='%2389895a'/><path d='M36 30l28-6v20l-24 4z' fill='%234a6b34'/><path d='M0 48l32-6 4 22H0z' fill='%2363803f'/><path d='M40 52l24-4v16H42z' fill='%23a08c5c'/><path d='M-2 40C14 34 22 44 34 38s20-12 32-10' stroke='%23284a5c' stroke-width='5' fill='none'/><path d='M18 -2L28 66' stroke='%23c9c2a8' stroke-width='2' fill='none'/></svg>"); }
.map-type-tile.show-map { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><rect width='64' height='64' fill='%23eef0ea'/><path d='M0 0h22v20H0z' fill='%23cfe8c4'/><path d='M40 34h24v30H44z' fill='%23cfe8c4'/><path d='M-2 44C14 38 22 48 34 42s20-12 32-10' stroke='%23a9d3e6' stroke-width='6' fill='none'/><path d='M0 28H64M30 0V64' stroke='%23ffffff' stroke-width='4'/><path d='M-2 12L66 56' stroke='%23f6d88a' stroke-width='4'/><path d='M30 0V64' stroke='%23e2e4de' stroke-width='1'/></svg>"); }
.map-type-tile:hover { border-color: #f0f4ff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.map-type-tile:focus-visible { outline: 2px solid #4363d8; outline-offset: 2px; }
.map-type-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1px 0 2px;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
}
.map-type-tile.show-map .map-type-label { color: #1f2933; background: linear-gradient(transparent, rgba(255, 255, 255, 0.85)); }
@media (max-width: 767px) {
  .map-logo { height: 42px; margin: 8px 0 0 8px; }
  .map-type-tile { width: 52px; height: 52px; margin: 0 0 10px 6px; }
}

/* Tracks page: Device Tracks lists a device's tracks only once it is selected */
.tt-table-wrap.no-device tbody tr { display: none; }
/* "Show older tracks" under Device Tracks (the page has the latest 100 of each device) */
.tt-more-tracks { margin-top: 6px; text-align: center; }
.tt-more-tracks.hidden { display: none; }

/* Page menu: a floating, frosted-glass bar (tabs.hbs). In the map on the Tracks page (top centre),
   at the top of the other pages with the logo at its left. */
#tabs { padding: 8px 2px 10px; }
/* Above the pages' sticky table headers (z-index 2-3): the menu bar's blur makes it a layer of its own, so without
   this the User drop-down opened under the Devices table header. On the Tracks page the bar is moved into the map. */
.tt-nav-row { position: relative; z-index: 1030; display: flex; align-items: center; gap: 14px; }
.tt-nav-logo { line-height: 0; }
.tt-nav-logo img { height: 46px; width: auto; }
.tt-nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 4px 3px 8px;
  border-radius: var(--tt-card-radius);
  border: 1px solid rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.74);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  backdrop-filter: blur(10px) saturate(1.4);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
.tt-nav .tt-nav-link {
  position: relative;
  padding: 6px 10px !important;
  border-radius: 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1f2933;
  text-decoration: none;
}
.tt-nav .tt-nav-link:hover { background: rgba(255, 255, 255, 0.75); color: #111827; }
.tt-nav .tt-nav-link.active { color: #892901 !important; } /* the darkest red of the TrackTape logo */
.tt-nav .tt-nav-link.active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: #892901;
}
.tt-nav-account { margin-left: 4px; }
/* The account icon: the TrackTape logo red on every page (as when the Account page is open) */
.tt-nav-avatar { display: flex; width: 32px; height: 32px; border-radius: 50%; color: #cc3a0c !important; } /* !important: links are gray !important */
.tt-nav-avatar svg { width: 100%; height: 100%; fill: currentColor; }
.tt-nav-avatar:hover, .tt-nav-avatar[aria-expanded="true"] { color: #892901 !important; }
.tt-nav .dropdown-menu { min-width: 10rem; font-size: 0.9rem; }
#map .tt-nav { margin-top: 10px; }
@media (max-width: 767px) {
  .tt-nav { gap: 0; padding: 2px 3px 2px 5px; }
  .tt-nav .tt-nav-link { padding: 5px 7px !important; font-size: 0.8rem; }
  .tt-nav .tt-nav-link.active::after { left: 7px; right: 7px; }
  .tt-nav-avatar { width: 28px; height: 28px; }
  .tt-nav-logo img { height: 36px; }
  #map .tt-nav { margin-top: 8px; }
}

/* Tracks page: event organizer logo, top-right corner, the size of the TrackTape logo (top left) */
.map-logo.organizer-logo { margin: 12px 14px 0 0; max-width: 32vw; object-fit: contain; filter: none; } /* no white glow: the logo is transparent */
@media (max-width: 767px) {
  .map-logo.organizer-logo { margin: 8px 8px 0 0; }
}

/* Admin page: event organizer logo */
.org-logo-section { margin-top: 1.2rem; }
.org-logo-hint { margin-bottom: 0.5rem; font-size: 0.9rem; }
.org-logo-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.org-logo-row .btn { width: auto; }
.org-logo-preview {
  display: flex; align-items: center; justify-content: center;
  min-width: 120px; height: 76px; padding: 6px 10px;
  border: 1px dashed #9ca3af; border-radius: 6px; background: #f3f4f6; color: #6b7280; font-size: 0.85rem;
}
.org-logo-preview img { height: 60px; width: auto; max-width: 260px; object-fit: contain; }
.org-logo-status { min-height: 1.3em; margin-top: 0.3rem; font-size: 0.85rem; }
.org-logo-status.error { color: #b91c1c; }

/* Tracks page: top-left group in the map - the TrackTape logo, the menu bar to its right (wrapping
   below it on a narrow map) */
.map-top-left { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 12px 0 0 14px; }
.map-top-left .map-logo { margin: 0; }
#map .map-top-left .tt-nav { margin-top: 0; }
@media (max-width: 767px) {
  .map-top-left { gap: 6px 10px; margin: 8px 0 0 8px; }
}

/* Tracks page: one top-centre column in the map (the banners) */
.map-top-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  max-width: min(460px, 92vw);
}
#map .map-top-center .tt-nav { margin-top: 0; }
.map-top-center .focus-banner,
.map-top-center .omaps-hint,
.map-top-center .live-status { margin-top: 0 !important; max-width: 100%; white-space: normal; text-align: center; }
@media (max-width: 767px) {
  .map-top-center { margin-top: 8px; gap: 4px; }
}

/* Device Tracks: distance and location */
.tt-table .tt-dist { font-variant-numeric: tabular-nums; } /* left, under its header like the other columns */
.tt-table .tt-place { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; }

/* Short messages ("Course deleted"), bottom centre, going away by themselves */
.tt-toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transform: translateX(-50%);
  pointer-events: none;
}
.tt-toast {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: rgba(31, 41, 51, 0.92);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.tt-toast.show { opacity: 1; transform: none; }
.tt-toast.error { background: rgba(185, 28, 28, 0.95); }

/* Admin page: in the style of the Tracks and Devices pages - white boxes, small headings and
   buttons, normal text */
.tt-admin { font-size: 0.9rem; font-weight: normal; }
.tt-admin .tt-card {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  background: #fff;
}
.tt-admin h3 { margin: 0 0 0.5rem; font-size: 1rem; font-weight: 700; }
.tt-admin p { margin: 0 0 0.4rem; }
.tt-admin .tt-steps { margin: 0 0 0.6rem; padding-left: 1.3rem; }
.tt-admin .tt-steps li { margin: 0.1rem 0; }
.tt-admin .tt-form-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.tt-admin .tt-pair-input { width: 9rem; }
.tt-admin .btn { width: auto; padding: 0.2rem 0.7rem; font-size: 0.85rem; }
.tt-admin .form-control, .tt-admin select.form-control { max-width: 26rem; padding: 0.25rem 0.5rem; font-size: 0.9rem; }
.tt-admin textarea.form-control { max-width: 40rem; font-family: Consolas, "Courier New", monospace; font-size: 0.8rem; }
.tt-admin .col-form-label { padding-top: 0.25rem; padding-bottom: 0.25rem; font-size: 0.9rem; font-weight: 600; }
.tt-admin .form-group.row { margin: 0 0 0.5rem; }
.tt-admin .form-group.row > [class*="col-"] { padding-left: 0; }
.tt-admin .pair-result:empty, .tt-admin .pair-result span:empty { display: none; }
.tt-admin label, .tt-admin .padding-left { padding-left: 0 !important; }
.tt-admin .tt-notice {
  margin-top: 0.6rem;
  padding: 6px 10px;
  border: 1px solid #f0c36d;
  border-radius: 6px;
  background: #fff8e6;
  color: #7a4b00;
  font-size: 0.85rem;
}
.tt-admin .tt-notice.hidden { display: none; }
.tt-admin .pair-result { margin-top: 0.4rem; font-size: 0.85rem; }
.tt-admin .org-logo-section { margin-top: 0; }
.tt-admin .org-logo-section h3 { font-size: 1rem; }

/* Devices page: other users than superadmins only look (views/connect.hbs) */
.devices-readonly-note { margin: 0.5rem 0 0; font-size: 0.85rem; color: #374151; }

/* Devices page: one row per device */
.devices-table-wrap {
  overflow-x: auto;
  max-height: 75vh;
  margin-top: 0.75rem;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  background: #fff;
}
.devices-table {
  margin: 0;
  font-size: 0.875rem;
  white-space: nowrap;
}
.devices-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #2b3a4a;
  color: #fff;
  font-weight: 600;
  border-bottom: 0;
  padding: 0.5rem 0.3rem;
}
.devices-table th.sortable {
  cursor: pointer;
  user-select: none;
}
.devices-table th.sortable::after { content: " \21C5"; opacity: 0.45; }
.devices-table th.sortable[data-dir="desc"]::after { content: " \25BC"; opacity: 1; }
.devices-table th.sortable[data-dir="asc"]::after { content: " \25B2"; opacity: 1; }
.devices-table th.sortable:hover { background: #3c5068; }
.devices-table tbody tr:nth-child(even) { background: #f4f7fa; }
.devices-table tbody tr:hover { background: #e3eefb; }
.devices-table td { padding: 0.3rem 0.3rem; border-color: #e3e8ee; }
/* Label column stays visible when scrolling sideways */
.devices-table th:first-child,
.devices-table td:first-child { position: sticky; left: 0; z-index: 1; }
.devices-table thead th:first-child { z-index: 3; background: #2b3a4a; }
.devices-table tbody tr td:first-child { background: #fff; }
.devices-table tbody tr:nth-child(even) td:first-child { background: #f4f7fa; }
.devices-table tbody tr:hover td:first-child { background: #e3eefb; }
.devices-table .label-input { min-width: 6rem; font-weight: 600; }
/* Selects and buttons in the size of the other columns */
.devices-table .form-select-sm { min-width: 6rem; font-size: 0.8rem; padding-top: 0.15rem; padding-bottom: 0.15rem; }
.devices-table .label-input { font-size: 0.8rem; }
.devices-table .action-col .btn { font-size: 0.8rem; padding: 0.12rem 0.3rem; }
.devices-table .mono { font-family: Consolas, "Courier New", monospace; font-size: 0.74rem; color: #374151; }
/* The three button columns stay pinned to the right edge while the middle columns scroll */
.devices-table {
  --action-map-w: 4.3rem;
  --action-stop-w: 3.7rem;
  --action-remove-w: 4.6rem;
}
.devices-table .action-col {
  position: sticky;
  z-index: 1;
  text-align: center;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}
.devices-table .action-map { right: calc(var(--action-stop-w) + var(--action-remove-w)); width: var(--action-map-w); min-width: var(--action-map-w); }
.devices-table .action-stop { right: var(--action-remove-w); width: var(--action-stop-w); min-width: var(--action-stop-w); }
.devices-table .action-remove { right: 0; width: var(--action-remove-w); min-width: var(--action-remove-w); }
.devices-table .action-col .btn { width: 100%; }
.devices-table thead th.action-col { z-index: 3; background: #2b3a4a; }
.devices-table tbody tr td.action-col { background: #fff; }
.devices-table tbody tr:nth-child(even) td.action-col { background: #f4f7fa; }
.devices-table tbody tr:hover td.action-col { background: #e3eefb; }
.devices-table .action-map { box-shadow: -6px 0 6px -6px rgba(0, 0, 0, 0.35); }
.devices-table .switch { padding-right: 0; }
.devices-table .switch input + label { text-indent: 0; }
/* The tick-boxes of the first column ("All" in the header): a command in a ticked row applies to every ticked
   device. The Label column stays in view next to it when the table scrolls sideways. */
.devices-table .select-col { width: 2.9rem; min-width: 2.9rem; text-align: center; }
/* not the site-wide scale(2) of input[type=checkbox]: that enlarges the box after layout, over the "All" text and
   the cell edges */
.devices-table .select-col input[type=checkbox],
.devices-sort-mobile .select-all-mobile input[type=checkbox] {
  width: 1rem; height: 1rem; margin: 0; vertical-align: middle; cursor: pointer;
}
.devices-table .select-all { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0; white-space: nowrap; cursor: pointer; font-weight: 600; }
.devices-table th.select-col + th,
.devices-table td.select-col + td { position: sticky; left: 2.9rem; z-index: 1; }
.devices-table thead th.select-col + th { z-index: 3; background: #2b3a4a; }
.devices-table tbody tr td.select-col + td { background: #fff; }
.devices-table tbody tr:nth-child(even) td.select-col + td { background: #f4f7fa; }
.devices-table tbody tr:hover td.select-col + td { background: #e3eefb; }
.devices-table tbody tr.tt-row-selected td,
.devices-table tbody tr.tt-row-selected td:first-child,
.devices-table tbody tr.tt-row-selected td.select-col + td,
.devices-table tbody tr.tt-row-selected td.action-col { background: #fff3cd; }
.devices-sort-mobile .select-all-mobile { display: none; margin: 0 0 0 auto; white-space: nowrap; font-weight: 600; }
.state-dot {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.35);
  vertical-align: middle;
  margin-right: 0.3rem;
}
.battery-bar {
  display: inline-block;
  width: 2rem;
  height: 0.7rem;
  border: 1px solid #6b7280;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 0.3rem;
  background: #fff;
  overflow: hidden;
}
.battery-fill { height: 100%; background: #9ca3af; }
.battery-fill.battery-ok { background: #2e9e44; }
.battery-fill.battery-mid { background: #e0a100; }
.battery-fill.battery-low { background: #d93025; }
.devices-table .btn-sm { padding: 0.15rem 0.45rem; }
.devices-table .btn-outline-warning { color: #9a5b00; border-color: #d39200; }
.devices-table .btn-outline-warning:hover { color: #fff; background: #d39200; }

/* Devices page: "Filter:" inline before the account list, styled like the table header */
.devices-filter {
  display: flex;
  align-items: stretch;
  max-width: 28rem;
  margin-top: 0.5rem;
  font-size: 0.875rem;
}
.devices-filter label {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0 0.6rem;
  background: #2b3a4a;
  color: #fff;
  font-weight: 600;
  border: 1px solid #2b3a4a;
  border-radius: 6px 0 0 6px;
}
.devices-filter select {
  flex: 1;
  font-size: 0.875rem;
  border-color: #d0d7de;
  border-radius: 0 6px 6px 0;
}

/* Tracks page: "All ON/OFF" tick-box above the device list (ticked = show all, unticked = hide all) */
.toggle-all-box {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 2px;
  padding: 1px 4px 1px 2px !important; /* beats the global label padding */
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.toggle-all-box.hidden { display: none; }
.toggle-all-box input { width: 11px; height: 11px; margin: 0 2px 0 0; transform: none; cursor: pointer; } /* no global 2x scale */
.follow-box { margin: 4px 0 0; } /* Follow, under "Find" */

/* Tracks page: device list + "Find all" as one box, as wide as the list */
.device-panel {
  display: inline-flex;
  flex-direction: column;
  max-width: 100%;
}
.device-panel .toggle-all {
  /* width 0 + min-width 100%: the buttons take the list's width instead of widening it */
  width: 0;
  min-width: 100%;
  flex-wrap: nowrap;
  gap: 4px;
}
.device-panel .toggle-all .btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.15rem 0.25rem;
  font-size: 0.75rem;
  line-height: 1.2;
}

/* Tracks page: legend as a discreet overlay at the bottom of the map */
.map-wrap {
  position: relative;
  padding: 0;
}
.map-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 12px;
  margin: 0 0 6px;
  padding: 3px 10px;
  font-size: 0.75rem;
  line-height: 1.4;
  color: #1f2933;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  pointer-events: none
}
.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid;
  background: transparent;
}

/* Account page: mobile number verification status */
.phone-status {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}
.phone-verified { color: #2e9e44; }
.phone-verified::before { content: "\2713  "; } /* plain tick: \2714 shows as a purple emoji */
.phone-unverified { color: #b45309; }

/* Admin page: result of "Connect new TrackTape" right under the button */
.pair-result {
  margin-top: 0.6rem;
  min-height: 1.5rem;
}

/* Tracks page: device colour next to each switch (same colour as its dot and tail on the map) */
.device-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 5px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  vertical-align: -1px;
}
/* Device name above its dot on the map */
.device-map-label {
  background: rgba(255, 255, 255, 0.85);
  padding: 0 4px;
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.control-map-label { padding: 0 3px; line-height: 1.25; } /* orienteering control numbers: a little smaller tag */
/* Afterglow control */
.afterglow-control {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.afterglow-control { font-size: 0.875rem; }
.afterglow-control label { margin: 0; font-weight: 600; }
.afterglow-control input { width: 5rem; }
/* "Orienteering map here" hint at the top of the map */
.omaps-hint {
  margin-top: 10px;
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #7a2e00;
  background: rgba(255, 244, 214, 0.95);
  border: 1px solid #d9480f;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  pointer-events: none
}
.legend-omap {
  display: inline-block;
  width: 14px;
  height: 10px;
  border: 2px solid #d9480f;
  background: rgba(245, 159, 0, 0.15);
  border-radius: 2px;
}

/* Tracks page: in-map panel (top left, under the map type buttons) */
.map-panel {
  position: relative;
  margin: 10px;
  width: max-content;
  transition: transform 0.25s ease;
  /* as narrow as its widest line; wider with an orienteering course: one control box per control */
  max-width: calc(100vw - 80px);
  color: #1f2933;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.94);
  border-radius: var(--tt-card-radius);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.map-panel-body {
  max-height: 55vh;
  overflow-y: auto;
  padding: 6px 8px 6px;
}
.map-panel .switch { display: block; font-size: 0.75rem; padding-right: 0; white-space: nowrap; }
.map-panel .switch label { max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
.map-panel .afterglow-control { margin-top: 6px; gap: 4px; font-size: 0.75rem; }
.map-panel .afterglow-control label { padding-left: 0 !important; text-indent: 0; min-width: 0; }
.map-panel .afterglow-control input { width: 3.8rem; padding: 0 4px; height: 1.4rem; font-size: 0.75rem; }
.map-panel .toggle-all { margin-top: 4px; gap: 3px; }
.map-panel .toggle-all .btn { width: auto; font-size: 0.7rem; padding: 0.1rem 0.4rem; white-space: nowrap; flex: 1 0 auto; }
/* In the card the buttons keep their full text (the card widens to them if needed) */
.map-panel .device-panel { display: flex; }
.map-panel .device-panel .toggle-all { width: auto; min-width: 0; }
/* Compact switches inside the panel (height 1.05rem) */
.map-panel .switch.switch-sm input + label {
  min-width: 2.1rem;
  height: 1.05rem;
  line-height: 1.05rem;
  padding-left: 0 !important; /* not the 16 px of labels in general: the card would be wider than its lines */
  text-indent: calc(2.1rem + 5px);
}
.map-panel .switch.switch-sm input + label::before { width: 2.1rem; }
.map-panel .switch.switch-sm input + label::after {
  width: calc(1.05rem - 4px);
  height: calc(1.05rem - 4px);
}
.map-panel .switch.switch-sm input:checked + label::after { margin-left: 1.05rem; }
.map-panel .switch + .switch { margin-top: 2px; }
/* Device without an update for 20 minutes */
.device-dot.stale { opacity: 0.45; }

/* ── Phones and small tablets ─────────────────────────────────────────────── */
.devices-sort-mobile { display: none; }
@media (max-width: 767px) {
  article.text { padding: 8px; }
  label, .padding-left { padding-left: 0 !important; white-space: normal; }
  .navbar-nav .nav-link { padding: 0.5rem 0.25rem; }

  /* Tracks */
  .map-panel { margin: 6px; max-width: 46vw; }
  .map-panel-body { max-height: 45vh; }
  .map-panel .switch label { max-width: 28vw; }
  .map-legend { font-size: 0.68rem; gap: 0 8px; padding: 2px 6px; margin-bottom: 16px; max-width: 70vw; }
  .omaps-hint { font-size: 0.72rem; max-width: 62vw; white-space: normal; text-align: center; margin-top: 6px; }
  .tt-section-title { font-size: 0.95rem; }
  #courses-table, #tracks-table { font-size: 0.85rem; }
  .bootstrap-table .fixed-table-container { overflow-x: auto; }

  /* Devices: one card per device */
  .devices-sort-mobile {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 0.85rem;
  }
  .devices-sort-mobile label { margin: 0; font-weight: 600; white-space: nowrap; }
  .devices-sort-mobile select { flex: 1 1 auto; width: auto; min-width: 0; }
  .devices-sort-mobile .btn { flex: 0 0 auto; width: 2.4rem; }
  .devices-sort-mobile .select-all-mobile { display: flex; align-items: center; gap: 4px; }
  .devices-table td.select-col { width: auto; text-align: left; }
  .devices-table .select-col input[type=checkbox],
  .devices-sort-mobile .select-all-mobile input[type=checkbox] { width: 1.3rem; height: 1.3rem; } /* a finger's tap */
  /* Form labels line up with their fields */
  .row > label.col-form-label, .row > .col-form-label { padding-left: calc(var(--bs-gutter-x) * 0.5) !important; }
  .devices-filter { max-width: none; }
  .devices-table-wrap { max-height: none; overflow: visible; border: 0; background: transparent; }
  .devices-table, .devices-table tbody { display: block; white-space: normal; }
  .devices-table thead { display: none; }
  .devices-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px 10px;
    background: #fff !important;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  }
  .devices-table td,
  .devices-table tbody tr td:first-child,
  .devices-table tbody tr td.action-col {
    position: static;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 4px 0;
    border: 0;
    background: transparent !important;
    box-shadow: none;
    text-align: left;
  }
  .devices-table td[data-label]::before {
    content: attr(data-label);
    font-weight: 600;
    color: #4b5563;
    white-space: nowrap;
  }
  .devices-table td[data-col="label"] { padding-bottom: 6px; border-bottom: 1px solid #e5e7eb; margin-bottom: 2px; }
  .devices-table .label-input { min-width: 0; width: 100%; font-size: 1rem; }
  .devices-table .form-select-sm { min-width: 0; max-width: 60%; }
  .devices-table tbody tr td.action-col { width: 33.333%; padding: 8px 2px 0; }
  .devices-table td.action-col .btn { width: 100%; padding: 0.3rem 0.2rem; font-size: 0.8rem; white-space: normal; }
}

/* Tracks page: "Following TRT-01 · Show all devices" (link from a geofence SMS) */
.focus-banner {
  margin-top: 10px;
  padding: 4px 12px;
  font-size: 0.8rem;
  color: #0b3a6e;
  background: rgba(225, 239, 254, 0.96);
  border: 1px solid #4363d8;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}
.focus-banner a { font-weight: 600; }
/* Tracks page: shown on the map while the live position feed reconnects */
.live-status {
  margin-top: 10px;
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #7c2d12;
  background: rgba(255, 237, 213, 0.97);
  border: 1px solid #ea580c;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}
.live-status.hidden { display: none; }
@media (max-width: 767px) {
  .focus-banner, .live-status { margin-top: 6px; font-size: 0.75rem; }
  .live-status { white-space: normal; max-width: 62vw; text-align: center; }
  .focus-banner + .omaps-hint { margin-top: 6px; }
}

/* Account menu (round icon, right): Account + Logout */
.account-menu { display: flex; flex-direction: column; align-items: flex-end; }
.account-menu .account-toggle { text-align: right; cursor: pointer; }
.account-menu .dropdown-menu { min-width: 9rem; }

/* Tracks page: loading indicator in the middle of the orienteering map being fetched */
.omaps-loading {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  color: #7a2e00;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 10px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  white-space: nowrap;
}
.omaps-loading .spinner-border { width: 2rem; height: 2rem; color: #d9480f; }

/* Tracks card: device rows instead of switches. Filled dot = shown, empty ring = hidden. */
.device-row { position: relative; }
.device-row .device-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.device-row label {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 1px 4px 1px 2px !important;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
}
.device-row label:hover { background: #eef2f7; }
.device-row .device-toggle:focus-visible + label { outline: 2px solid #4363d8; }
.device-row .device-toggle:disabled + label { cursor: default; }
.device-row .device-toggle:disabled + label:hover { background: none; }
.device-row .device-dot {
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
  margin-right: 6px;
  background: var(--c);
  border: 2px solid var(--c);
  box-shadow: none;
}
.device-row .device-toggle:not(:checked) + label .device-dot { background: transparent; }
.device-row .device-toggle:not(:checked) + label { color: #6b7280; }
/* Control boxes after each device name, on the same line, while an orienteering course is shown:
   an empty square, or the orange/white control flag (as in the map legend) once punched */
/* The device list is a two-column grid (names | control boxes), so the boxes line up in one column
   whatever the length of the names. Each row's own box is flattened into it (display: contents). */
#togglers:not(.hidden) { display: grid; grid-template-columns: max-content auto; align-items: center; position: relative; }
.device-row { display: contents; }
.device-row label { min-width: 0; }
.device-row table { border-collapse: separate; border-spacing: 2px 0; margin: 0 0 0 4px; justify-self: start; }
.device-row .ctl-box { width: 11px; height: 11px; padding: 0; font-size: 0; line-height: 0; border: 1px solid #374151; border-radius: 1px; background: #fff; }
.device-row .ctl-box.punched,
.device-row .ctl-box.track-punched { border-color: #e25312; background: linear-gradient(to top left, #e25312 50%, #fff 50%); }


/* Tracks card: buttons stacked, one font size for everything in the card */
.map-panel .toggle-all { flex-direction: column; flex-wrap: nowrap; gap: 3px; }
.map-panel .toggle-all .btn { width: 100%; flex: 0 0 auto; text-align: center; font-size: 0.75rem; }
.map-panel .device-row label,
.map-panel .afterglow-control,
.map-panel .afterglow-control label,
.map-panel .afterglow-control input,
.map-panel .switch,
.map-panel .switch label { font-size: 0.75rem; }
.map-panel .afterglow-control label { font-weight: 400; }
.map-panel .afterglow-control input { width: 3.4rem; height: 1.25rem; padding: 0 3px; }

/* Orienteering map image, clipped to the map's border */
.omaps-image { position: absolute; pointer-events: none; user-select: none; max-width: none; }


/* Afterglow box: three digits visible (longer values scroll), no spin arrows */
.map-panel .afterglow-control input {
  width: calc(3ch + 10px);
  padding: 0 4px;
  text-align: right;
  -moz-appearance: textfield;
  appearance: textfield;
}
.map-panel .afterglow-control input::-webkit-outer-spin-button,
.map-panel .afterglow-control input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Header exactly as tall as the TrackTape logo (60 px), on every screen size */
nav.navbar { padding-top: 0; padding-bottom: 0; }
nav.navbar > .container-fluid { padding-left: 0; padding-right: 6px; }
nav.navbar .navbar-brand { padding: 0; margin-right: 0.75rem; line-height: 0; }
nav.navbar .navbar-brand img { display: block; }
nav.navbar .navbar-toggler { padding: 0.15rem 0.45rem; }
@media (min-width: 992px) {
  nav.navbar .navbar-nav { align-items: center; }
  nav.navbar .navbar-nav .nav-link { padding-top: 0; padding-bottom: 0; }
  /* account icon + e-mail fit within the logo's height */
  .account-menu .account-toggle { padding-top: 2px; padding-bottom: 2px; }
  .account-menu .account-toggle svg { width: 32px; height: 32px; }
  .account-menu .account-toggle h6 { margin: 0; font-size: 0.75rem; line-height: 1.2; }
  .account-menu .account-toggle .padding-left { padding-left: 0 !important; }
}

/* Phones / folded menu: less room around the content, so the map gets more */
@media (max-width: 991px) {
  article.text { padding: 0 4px 4px; }
}

/* Tracks page: the menu as a drawer at the map's top edge, its tab hanging down (like the device card's) */
.nav-drawer { position: relative; transition: transform 0.25s ease; }
.nav-drawer.dragging, .nav-drawer.no-anim { transition: none; }
.nav-drawer:not(.open):not(.dragging) .tt-nav { box-shadow: none; } /* no shadow line at the map's edge */
.nav-drawer-tab {
  position: absolute;
  top: 100%;
  left: 50%;
  width: 56px;
  height: 20px;
  margin-left: -28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  color: #4b5563;
  background: rgba(255, 255, 255, 0.94);
  border: 0;
  border-radius: 0 0 8px 8px;
  box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.3);
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.nav-drawer-tab span { display: inline-block; transform: rotate(90deg); transition: transform 0.25s ease; }
.nav-drawer.open .nav-drawer-tab span { transform: rotate(-90deg); }
.nav-drawer.dragging .nav-drawer-tab { cursor: grabbing; }
.nav-drawer-tab:hover { color: #111827; background: #fff; }
.nav-drawer-tab:focus-visible { outline: 2px solid #4363d8; }
@media (max-width: 767px) {
  .nav-drawer-tab { width: 64px; height: 24px; margin-left: -32px; } /* a bigger target for fingers */
}

/* Device card drawer: the tab at the map's left edge */
.map-panel.dragging, .map-panel.no-anim { transition: none; }
.map-panel-tab {
  position: absolute;
  left: 100%;
  top: 10px;
  width: 20px;
  height: 56px;
  padding: 0;
  margin-left: -1px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  color: #4b5563;
  background: rgba(255, 255, 255, 0.94);
  border: 0;
  border-radius: 0 8px 8px 0;
  box-shadow: 2px 1px 4px rgba(0, 0, 0, 0.3);
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.map-panel.dragging .map-panel-tab { cursor: grabbing; }
.map-panel-tab:hover { color: #111827; background: #fff; }
.map-panel-tab:focus-visible { outline: 2px solid #4363d8; }
@media (max-width: 767px) {
  .map-panel-tab { width: 24px; height: 64px; } /* a bigger target for fingers */
}


/* Admin page, option 4: remote pairing (superadmin) */
.tt-admin .tt-remote-pair-input { width: 32rem; max-width: 100%; font-family: Consolas, Menlo, monospace; resize: vertical; }
.tt-admin .tt-remote-pair-status { font-size: 0.85rem; margin-top: 0.35rem; }
.tt-admin .tt-remote-pair-status:empty { display: none; }
.tt-admin .tt-remote-pair-status.ok { color: #1e6b34; }
.tt-admin .tt-remote-pair-status.error { color: #a32020; }
.tt-admin .tt-form-row + .tt-steps { margin-top: 0.9rem; }

/* Account settings page: the Admin page's cards, with a label column */
.tt-settings .tt-field {
  display: grid;
  grid-template-columns: 10.5rem minmax(0, 18rem) auto;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 0.45rem;
}
.tt-settings .tt-field > label, .tt-settings .tt-field-label { margin: 0; font-weight: 600; }
.tt-settings .tt-field.hidden { display: none; }
.tt-settings .tt-field-actions { display: flex; align-items: center; gap: 10px; }
.tt-settings .tt-hint { color: #6b7280; font-size: 0.85rem; }
.tt-settings .form-control:disabled { background: #f3f4f6; }
.tt-settings .phone-status { font-size: 0.85rem; }
.tt-settings .tt-notice { margin-top: 0.5rem; }
.tt-settings-result { font-size: 0.85rem; }
.tt-settings-result span { display: block; padding: 0.35rem 0.6rem; border-radius: 6px; margin-top: 0.4rem; }
.tt-settings-result span:empty { display: none; }
.tt-settings-result .bg-success { background: #e7f6ec !important; color: #1e6b34; }
.tt-settings-result .bg-danger { background: #fdecec !important; color: #a32020; }
@media (max-width: 575px) {
  .tt-settings .tt-field { grid-template-columns: 1fr; gap: 3px; }
}

/* Admin option 4: one row per device in the box */
.tt-admin .tt-remote-pair-table { margin-top: 0.5rem; max-width: 62rem; overflow-x: auto; }
.tt-admin .tt-remote-pair-rows { font-size: 0.82rem; margin: 0; }
.tt-admin .tt-remote-pair-rows td { white-space: nowrap; font-family: Consolas, Menlo, monospace; }
.tt-admin .tt-remote-pair-rows td:nth-child(2) { font-family: inherit; font-weight: 600; }
.tt-admin .tt-remote-pair-rows td.tt-rp-status { white-space: normal; font-family: inherit; min-width: 14rem; }
.tt-admin .tt-rp-ok .tt-rp-status { color: #1e6b34; }
.tt-admin .tt-rp-error .tt-rp-status { color: #a32020; }
.tt-admin .tt-rp-busy .tt-rp-status { color: #6b7280; }
.tt-admin .tt-take-over { display: inline-flex; align-items: center; gap: 6px; margin: 0.45rem 0 0; font-size: 0.85rem; color: #7a1d1d; cursor: pointer; }
.tt-admin .tt-take-over input { transform: none; accent-color: #a32020; }
.tt-admin .tt-auto-connect { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 0.3rem 0 0; }
.tt-admin .tt-auto-connect-label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.tt-admin .tt-auto-connect-label input { transform: none; }
.tt-admin .tt-auto-connect-state { font-size: 0.8rem; color: #555; }
.tt-admin .tt-auto-connect-state.on { color: #1d6b2a; }
.tt-admin .tt-auto-connect-state.error { color: #a32020; }
.tt-admin .tt-auto-connect-warning { margin: 0.1rem 0 0.2rem; font-size: 0.85rem; font-weight: 600; color: #a32020; }

/* Account page: the phone number's Verified / Not verified marker inside the box */
.tt-settings .tt-phone-box { position: relative; }
.tt-settings .tt-phone-box .form-control { padding-right: 6.8rem; }
.tt-settings .tt-phone-box .phone-status {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  font-size: 0.78rem;
  pointer-events: none;
  white-space: nowrap;
}
.tt-settings #pw-change.hidden, .tt-settings #pw-row.hidden { display: none; }

/* The menu bar as tall as the TrackTape logo next to it: 46 px at the top of the pages (36 on phones),
   60 px in the Tracks map (42 on phones) */
.tt-nav { box-sizing: border-box; height: 46px; padding-top: 0; padding-bottom: 0; border-radius: var(--tt-card-radius); }
.tt-nav .tt-nav-link { font-size: 0.95rem; }
.tt-nav .tt-nav-avatar { width: auto; height: auto; padding: 6px; align-items: center; } /* round icon as tall as the menu text; the padding keeps it easy to tap */
.tt-nav .tt-nav-avatar svg { width: 0.95rem; height: 0.95rem; }
#map .tt-nav { height: 60px; border-radius: var(--tt-card-radius); padding: 0 9px 0 14px; }
#map .tt-nav .tt-nav-link { font-size: 1.05rem; padding: 8px 12px !important; }
#map .tt-nav .tt-nav-avatar svg { width: 1.05rem; height: 1.05rem; }
@media (max-width: 767px) {
  .tt-nav { height: 36px; border-radius: var(--tt-card-radius); }
  .tt-nav .tt-nav-link { font-size: 0.8rem; }
  .tt-nav .tt-nav-avatar svg { width: 0.8rem; height: 0.8rem; }
  #map .tt-nav { height: 42px; border-radius: var(--tt-card-radius); padding: 0 5px 0 8px; }
  #map .tt-nav .tt-nav-link { font-size: 0.85rem; padding: 5px 8px !important; }
  #map .tt-nav .tt-nav-avatar svg { width: 0.85rem; height: 0.85rem; }
}

/* Admin option 4: the account the devices go to */
.tt-admin .tt-target-row { margin-bottom: 0.5rem; }
.tt-admin .tt-target-row label { margin: 0; font-weight: 600; }
.tt-admin .tt-target-select { width: auto; min-width: 16rem; max-width: 100%; font-size: 0.9rem; }

/* Tracks page: a device has taken a control — red rings from the control's centre, the device's name under it */
.control-taken { position: absolute; width: 0; height: 0; pointer-events: none; z-index: 5; }
.control-taken .ct-ring {
  position: absolute;
  left: -14px;
  top: -14px;
  width: 28px;
  height: 28px;
  border: 3px solid var(--ct-color, #e03131); /* the device's colour (views/account.hbs showControlTaken) */
  border-radius: 50%;
  opacity: 0;
  animation: ct-ring 1.6s ease-out 3 both;
}
.control-taken .ct-ring:nth-child(2) { animation-delay: 0.5s; }
.control-taken .ct-ring:nth-child(3) { animation-delay: 1s; }
@keyframes ct-ring {
  0% { transform: scale(0.45); opacity: 0.95; }
  100% { transform: scale(3.2); opacity: 0; }
}
.control-taken .ct-name {
  position: absolute;
  top: 19px;
  left: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 1px 6px;
  border: 2px solid var(--ct-color, #e03131);
  border-radius: 3px;
  background: #fff;
  color: #1f2933; /* dark on white: readable whatever the device's colour */
  font: 600 12px/1.3 Roboto, Arial, sans-serif;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  animation: ct-name 6.5s ease forwards;
}
@keyframes ct-name {
  0% { opacity: 0; margin-top: 4px; }
  6% { opacity: 1; margin-top: 0; }
  85% { opacity: 1; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .control-taken .ct-ring { animation-iteration-count: 1; }
  .control-taken .ct-ring:nth-child(n+2) { display: none; }
}

/* Phones: the Tracks page's tabs and tables (Samsung A53 and alike, ~360-430 px wide) */
@media (max-width: 575px) {
  /* The menu's tab at the right end of the bar, clear of the device card's tab below it */
  .nav-drawer-tab { left: auto; right: 16px; margin-left: 0; }
  .map-panel-body { max-height: 40vh; }

  /* Tables: smaller and tighter; the date over the time; long names wrap; what is still too wide
     scrolls inside the white box */
  .tt-section-hint { font-size: 0.72rem; }
  .tt-section-head .btn { font-size: 0.8rem; }
  .tt-table { font-size: 0.78rem; }
  .tt-table thead th { padding: 0.25rem 0.3rem; font-size: 0.74rem; }
  .tt-table td { padding: 0.2rem 0.3rem; }
  .tt-table td.tt-time { white-space: normal; min-width: 4.6rem; max-width: 4.6rem; line-height: 1.2; }
  .tt-table td.tt-place { max-width: 7rem; white-space: normal; }
  #courses-table td:nth-child(2) { white-space: normal; word-break: break-word; min-width: 5rem; }
  .tt-table td.tt-download .header { margin-right: 4px; }
  .tt-table .tt-enable-col { width: 2.2rem; }
  .tt-table .delete .material-icons { font-size: 1.1rem; }
  .tt-table-wrap .fixed-table-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Device Tracks: room for the device drop-down in its column header */
  #tracks .tt-table thead th[data-field="name"] { min-width: 7.5rem; }
  #tracks .tt-table-wrap .filter-control select { min-width: 7rem; font-size: 0.76rem; padding: 0.1rem 1.4rem 0.1rem 0.3rem; background-position: right 0.3rem center; }
}

/* Admin page: participant list */
.tt-admin .tt-participants .tt-hint { color: #4b5563; font-size: 0.85rem; }
.tt-admin .tt-participants-tools { margin-bottom: 0.5rem; }
.tt-admin .tt-participants-wrap { max-width: 60rem; overflow-x: auto; }
.tt-admin .tt-participants-table { white-space: normal; }
.tt-admin .tt-participants-table td { padding: 0.2rem 0.25rem; }
.tt-admin .tt-participants-table .form-control { max-width: none; padding: 0.15rem 0.35rem; font-size: 0.85rem; }
.tt-admin .tt-participants-table td:nth-child(1) { width: 8rem; } /* Class */
.tt-admin .tt-participants-table td:nth-child(2) { width: 5.5rem; }
.tt-admin .tt-participants-table td:nth-child(5) { width: 5rem; }
.tt-admin .tt-participants-table td:nth-child(6) { width: 9rem; }
.tt-admin .tt-participants-table td:nth-child(7) { width: 2rem; }
.tt-admin .tt-participants-table .tt-acronym { font-family: Consolas, Menlo, monospace; font-weight: 700; }
.tt-admin .tt-row-remove { width: auto; padding: 0 0.4rem; color: #a32020; font-size: 1.1rem; line-height: 1; border: 0; background: none; }
.tt-admin .tt-participants-actions { margin-top: 0.5rem; }
@media (max-width: 575px) {
  .tt-admin .tt-participants-table { min-width: 42rem; }
}
/* Events page, Participants: whose list (an event marked in the table: its own; finished: read-only) */
.tt-admin .tt-participants-for { font-weight: 400; color: #4a5560; }
.tt-admin .tt-participants-mode { margin: 0 0 0.5rem; padding: 0.35rem 0.6rem; border-radius: 6px; font-size: 0.85rem;
  background: #e8f1fb; border: 1px solid #b9d3ee; color: #1d4b7a; }
.tt-admin .tt-participants-mode.tt-readonly { background: #fff6e0; border-color: #f0d48a; color: #6b4e00; }
/* Events page, New event: Save and Classes side by side; the Classes dialog */
.tt-admin .tt-event-buttons { display: flex; gap: 8px; }
.tt-classes-dialog { width: min(40rem, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 1rem 1.1rem;
  border: 1px solid #c8d1db; border-radius: 8px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25); }
.tt-classes-dialog::backdrop { background: rgba(20, 30, 40, 0.35); }
.tt-classes-dialog h4 { margin: 0 0 0.4rem; font-size: 1.05rem; font-weight: 700; }
.tt-classes-dialog .tt-classes-table { margin-bottom: 0.4rem; }
.tt-classes-dialog .tt-classes-table td { padding: 0.2rem 0.25rem; }
.tt-classes-dialog .tt-classes-table td:first-child { width: 45%; }
.tt-classes-dialog .form-control, .tt-classes-dialog .form-select { max-width: none; font-size: 0.85rem; padding: 0.15rem 0.35rem; }
.tt-classes-dialog .tt-classes-actions { margin-top: 0.6rem; justify-content: flex-end; display: flex; }
.tt-more-classes { font-size: 0.85rem; }
/* Tracks page: the classes of the event, a tick-box each, under ON/OFF */
.class-toggles { display: flex; flex-direction: column; margin: 0 0 3px 10px; }
.class-toggles.hidden { display: none; }
.class-toggles .class-box { font-weight: 600; letter-spacing: 0; }
.tt-admin .tt-participants-table .tt-device-select { font-size: 0.85rem; padding: 0.15rem 1.6rem 0.15rem 0.35rem; }
.tt-admin .tt-participants-table .tt-device-select.tt-invalid { border-color: #a32020; color: #a32020; background-color: #fdecec; }

/* Device Tracks: "Delete all" bin in the header (white on the dark header, red on hover) */
#tracks .tt-delete-all { display: inline-flex; color: #fff; cursor: pointer; border-radius: 4px; }
#tracks .tt-delete-all.hidden { display: none; }
#tracks .tt-delete-all .material-icons { font-size: 18px; } /* as the bins in the rows */
/* lined up with the rows' bins: the header cell gets the rows' cell padding */
#tracks .tt-table thead th[data-field="delete"] .th-inner { padding-left: 0.4rem; }
@media (max-width: 575px) {
  #tracks .tt-delete-all .material-icons { font-size: 1.1rem; }
  #tracks .tt-table thead th[data-field="delete"] .th-inner { padding-left: 0.3rem; }
}
#tracks .tt-delete-all:hover, #tracks .tt-delete-all:focus-visible { color: #ff8a80; outline: none; }
#tracks .tt-delete-all.busy { opacity: 0.5; pointer-events: none; }

/* Events page */
.tt-events .tt-events-filter { margin-bottom: 0.6rem; }
.tt-events .tt-hint { color: #4b5563; font-size: 0.85rem; }
/* the events table scrolls sideways when it is wider than the card (Export and the last columns stay reachable) */
.tt-events .tt-events-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tt-events .tt-events-table { white-space: normal; }
.tt-events .tt-events-table td { vertical-align: middle; }
.tt-events .tt-event-name { font-weight: 600; }
.tt-events .tt-event-file { display: inline-block; margin: 0 6px 2px 0; padding: 0 6px; border-radius: 10px; background: #eef2f7; font-size: 0.78rem; }
.tt-events .tt-add-files { padding: 0 4px; font-size: 0.78rem; }
.tt-events .tt-event-status { font-size: 0.8rem; font-weight: 600; }
.tt-events .tt-status-finished { color: #1e6b34; }
.tt-events .tt-status-running { color: #b42318; }
.tt-events .tt-status-upcoming { color: #4b5563; }
.tt-events .tt-play { white-space: nowrap; }

/* Tracks page: event playback card (bottom of the map) */
.playback-bottom { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 6px; }
.playback-bottom.hidden { display: none; }
.playback-bottom .map-legend { margin: 0; }
/* the progress bar across the map: the time since the start, the bar, the length of the event */
.playback-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  padding: 4px 12px;
  border-radius: var(--tt-card-radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.playback-progress .pb-elapsed { font-size: 1rem; color: #892901; min-width: 4.6rem; }
.playback-progress .pb-total { color: #4b5563; min-width: 4.2rem; text-align: right; }
.playback-progress .pb-progress { flex: 1; min-width: 0; accent-color: #2b3a4a; cursor: pointer; transform: none; }
.playback-card {
  margin-bottom: 0;
  padding: 8px 12px 10px;
  width: min(420px, 92vw);
  border-radius: var(--tt-card-radius);
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  font-size: 0.85rem;
}
.playback-card.hidden { display: none; }
.playback-card .pb-head { display: flex; align-items: center; gap: 8px; }
.playback-card .pb-head b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.playback-card .pb-close { width: auto; border: 0; background: none; font-size: 1.3rem; line-height: 1; color: #4b5563; padding: 0 4px; }
.playback-card .pb-close:hover { color: #111827; }
.playback-card .pb-time { display: flex; justify-content: space-between; color: #374151; font-variant-numeric: tabular-nums; }
.playback-card .pb-progress { width: 100%; margin: 4px 0 6px; accent-color: #2b3a4a; }
.playback-card .pb-controls { display: flex; gap: 6px; justify-content: center; }
.playback-card .pb-btn { width: auto; padding: 0.15rem 0.7rem; font-size: 0.8rem; font-weight: 700; color: #fff; background: #2b3a4a; border: 1px solid #2b3a4a; }
.playback-card .pb-btn:hover { background: #3b4d61; color: #fff; }
.playback-card .pb-btn.active, .playback-card .pb-btn.active:hover { background: #892901; border-color: #892901; color: #fff; }
.playback-card .pb-speed { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.playback-card .pb-speed label { margin: 0; font-weight: 600; }
.playback-card .pb-speed-scale { flex: 1; }
.playback-card .pb-speed-scale input { width: 100%; accent-color: #2b3a4a; transform: none; }
.playback-card .pb-speed-ticks { display: flex; justify-content: space-between; font-size: 0.7rem; color: #6b7280; margin-top: -2px; }
.playback-card #pb-speed-text { min-width: 2.4rem; text-align: right; }
.tt-events .tt-event-logo img { display: block; height: 32px; width: auto; max-width: 96px; object-fit: contain; cursor: pointer; border-radius: 4px; }
.tt-events .tt-event-logo img:hover { outline: 2px solid #2b3a4a; }
.tt-events .tt-event-url a { font-size: 0.8rem; word-break: break-all; color: #2b3a4a !important; }
.tt-events .tt-event-people a { font-size: 0.8rem; white-space: nowrap; color: #2b3a4a !important; }
/* Events page: the Save button inside the date and time picker */
.flatpickr-calendar .tt-picker-save { display: block; width: calc(100% - 12px); margin: 6px; }
.flatpickr-calendar.hasTime .flatpickr-time { border-bottom: 1px solid #e6e6e6; }
/* Events page: Keep data for, Kept until, Export */
.tt-events .tt-event-keep { max-width: 14rem; }
.tt-events .tt-keep-hint { font-size: 0.75rem; margin-top: 2px; }
.tt-events .tt-event-kept { white-space: nowrap; color: #4b5563; }
.tt-events .tt-export { white-space: nowrap; }
/* Sign-up: value code and the terms of service */
.tt-value-code { text-transform: uppercase; letter-spacing: 0.15em; font-family: ui-monospace, Consolas, monospace; }
.tt-accept-terms { display: flex; align-items: center; gap: 8px; }
.tt-accept-terms label { padding-left: 0 !important; margin: 0; }
/* Admin page: value codes */
.tt-valuecodes .tt-valuecode { font-family: ui-monospace, Consolas, monospace; font-weight: 600; letter-spacing: 0.1em; }
.tt-valuecodes tr.tt-valuecode-new td { background: #fff4e5; }
.tt-valuecodes tr.tt-valuecode-used .tt-valuecode { color: #6b7280; text-decoration: line-through; }
.tt-valuecodes .tt-table-wrap { margin-top: 8px; }
/* Login page: the legal and contact footer (as on the legal pages, stylesheets/legal.css) */
.tt-legal-footer { margin: 28px 0 12px; padding: 8px 16px; text-align: center; font-size: 0.9rem; } /* on the page's gray, no frame */
.tt-contact-email { height: 1.3em; width: auto; vertical-align: -0.45em; } /* the e-mail address as an image: not readable by spam robots */
.tt-legal-footer nav { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 10px; }
.tt-legal-footer nav a { display: inline-block; padding: 6px 4px; font-weight: 600; color: #1e3a5f !important; text-decoration: underline; }
.tt-legal-footer nav a:focus-visible { outline: 3px solid #1f6f9f; outline-offset: 2px; border-radius: 2px; }
.tt-legal-footer nav span { color: #4b5563; }
.tt-legal-copy { margin: 6px 0 0; color: #374151; }
/* On a phone: the four links in two columns (no separators), the copyright line below */
@media (max-width: 480px) {
  .tt-legal-footer { margin: 20px 0 8px; padding: 8px 10px 10px; font-size: 0.85rem; }
  .tt-legal-footer nav { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
  .tt-legal-footer nav span { display: none; }
  .tt-legal-footer nav a { padding: 7px 2px; }
}
/* Playback menu: moved by its head, collapsed to a tab at the bottom of the map */
.playback-card .pb-head { cursor: move; touch-action: none; user-select: none; }
.playback-card .pb-grip { color: #9ca3af; letter-spacing: -2px; font-size: 0.9rem; }
.playback-card .pb-collapse { width: auto; border: 0; background: none; font-size: 1.1rem; line-height: 1; color: #4b5563; padding: 0 4px; }
.playback-card .pb-collapse:hover { color: #111827; }
.playback-card.pb-collapsed { display: none; }
.playback-card.pb-floating { position: absolute; z-index: 1000010; margin: 0; }
.playback-card.pb-moving { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); opacity: 0.96; }
.pb-tab { width: auto; padding: 3px 16px 4px; font-size: 0.8rem; font-weight: 700; color: #1f2933; background: rgba(255, 255, 255, 0.94);
  border: 0; border-radius: 10px 10px 0 0; box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.25); cursor: grab; touch-action: none; user-select: none; }
.pb-tab:hover { background: #fff; }
.pb-tab:focus-visible { outline: 2px solid #4363d8; }
.pb-tab.hidden { display: none; }
/* In the playback column the legend is a plain block (never placed where Google Maps put it as a control) */
.playback-bottom .map-legend { position: static !important; inset: auto !important; transform: none !important; }
/* Events page: Copy Event */
.tt-events .tt-copy-event { margin: 4px 0 12px; padding: 8px 10px; border: 1px dashed #9ca3af; border-radius: 8px; background: #f9fafb; }
.tt-events .tt-copy-event p { margin: 0 0 6px; font-size: 0.85rem; }
.tt-events .tt-event-copied { margin-top: 6px; font-size: 0.85rem; color: #1e6b34; }
.tt-events .tt-copied-cancel { padding: 0 4px; font-size: 0.8rem; }
.tt-events tr.tt-event-row { cursor: pointer; }
.tt-events tr.tt-event-row:focus-visible { outline: 2px solid #4363d8; outline-offset: -2px; }
.tt-events tr.tt-row-marked td { background: #fff4e5 !important; box-shadow: inset 0 2px 0 #892901, inset 0 -2px 0 #892901; }
/* Sign-in page: as the other pages (logo row at the top, white cards), only what is needed to log in */
/* the logo and the Log in card side by side, the same size; on a phone the card first, the logo under it */
.tt-signin { max-width: calc(52rem + 18px); padding-top: 8px; }
.tt-signin .tt-signin-main { display: grid; grid-template-columns: repeat(2, minmax(0, 26rem)); gap: 18px; align-items: start; }
.tt-signin .tt-signin-logo { display: flex; align-items: center; justify-content: center; min-height: 12rem; line-height: 0; }
.tt-signin .tt-signin-logo img { width: 100%; height: 100%; object-fit: contain; }
.tt-signin .tt-signin-card { margin: 0; }
@media (max-width: 767px) {
  .tt-signin .tt-signin-main { grid-template-columns: minmax(0, 1fr); }
  .tt-signin .tt-signin-logo { order: 2; }
}
.tt-signin .tt-signin-card .form-control { max-width: none; margin-bottom: 8px; }
.tt-signin .tt-signin-messages span { display: block; margin-bottom: 8px; padding: 4px 8px; border-radius: 6px; font-size: 0.85rem; }
.tt-signin .tt-signin-messages span:empty { display: none; }
.tt-signin .tt-signin-messages .bg-danger { background: #fdecec !important; color: #a32020; }
.tt-signin .tt-signin-messages .bg-success { background: #e7f6ec !important; color: #1e6b34; }
.tt-signin .tt-forgot { display: block; margin: -2px 0 10px; padding: 0; border: 0; background: none; font-size: 0.8rem; color: #4b5563; text-decoration: underline; }
.tt-signin .tt-forgot:hover { color: #111827; }
.tt-signin .tt-forgot:focus-visible, .tt-signin .tt-create-toggle:focus-visible { outline: 2px solid #4363d8; outline-offset: 2px; }
.tt-signin .tt-reset { margin-top: 12px; padding-top: 10px; border-top: 1px solid #e5e7eb; }
.tt-signin .tt-reset > div { margin-bottom: 8px; }
.tt-signin h3 .tt-create-toggle { padding: 0; border: 0; background: none; font: inherit; color: inherit; }
.tt-signin .tt-create-link { margin: 10px 0 0; }
.tt-signin .tt-accept-terms { align-items: flex-start; margin: 2px 0 10px; font-size: 0.85rem; }
/* the terms: the text wraps inside the card (labels are kept on one line elsewhere); a small tick-box as
   on the Tracks page (ON/OFF, Follow), not the global double size */
.tt-signin .tt-accept-terms label { flex: 1; min-width: 0; white-space: normal; padding-left: 0 !important; line-height: 1.35; cursor: pointer; }
.tt-signin .tt-accept-terms input { flex: 0 0 auto; width: 13px; height: 13px; margin: 3px 0 0; transform: none; cursor: pointer; }
.tt-signin .tt-signin-actions { display: flex; gap: 8px; margin-bottom: 8px; }
.tt-signin #code-div.hidden, .tt-signin #verify-div.hidden { display: none; }
.tt-value-code::placeholder { text-transform: none; letter-spacing: normal; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
/* Events page on a phone: each event a card (name and logo, then one labelled line per detail, the buttons
   at the bottom) instead of a table wider than the screen (also on a tablet); shorter help texts */
@media (max-width: 1000px) {
  .tt-events .tt-hint, .tt-events .tt-copy-event p { font-size: 0.78rem; }
  .tt-events .tt-events-wrap { overflow: visible; border: 0; }
  .tt-events .tt-events-table { border: 0; background: none; }
  .tt-events .tt-events-table thead { display: none; }
  .tt-events .tt-events-table, .tt-events .tt-events-table tbody { display: block; width: 100%; }
  .tt-events .tt-events-table tr.tt-event-row {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px;
    margin: 0 0 10px; padding: 8px 12px 10px; border: 1px solid #d0d7de; border-radius: 8px; background: #fff;
  }
  .tt-events .tt-events-table tr.tt-event-row > td {
    display: flex; align-items: baseline; gap: 8px; width: 100%; padding: 2px 0 !important;
    border: 0 !important; background: none !important; box-shadow: none !important; font-size: 0.85rem;
  }
  .tt-events .tt-events-table tr.tt-event-row > td[data-label]::before { content: attr(data-label); flex: 0 0 6.2rem; color: #6b7280; font-weight: 600; font-size: 0.78rem; }
  .tt-events .tt-events-table tr.tt-event-row > td.tt-empty { display: none; }
  .tt-events .tt-events-table tr.tt-event-row > td.tt-event-name { order: -2; width: calc(100% - 110px); font-size: 1rem; }
  .tt-events .tt-events-table tr.tt-event-row > td.tt-event-logo { order: -1; width: auto; margin-left: auto; }
  .tt-events .tt-events-table tr.tt-event-row > td.tt-event-place { order: 1; }
  .tt-events .tt-events-table tr.tt-event-row > td.tt-event-start { order: 2; }
  .tt-events .tt-events-table tr.tt-event-row > td.tt-event-end { order: 3; }
  .tt-events .tt-events-table tr.tt-event-row > td.tt-event-state { order: 4; }
  /* the files beside their label, wrapping under each other */
  .tt-events .tt-events-table tr.tt-event-row > td.tt-event-files { order: 5; display: block; position: relative; padding-left: calc(6.2rem + 8px) !important; }
  .tt-events .tt-events-table tr.tt-event-row > td.tt-event-files::before { position: absolute; left: 0; top: 3px; }
  .tt-events .tt-events-table tr.tt-event-row > td.tt-event-people { order: 6; }
  .tt-events .tt-events-table tr.tt-event-row > td.tt-event-kept { order: 7; }
  .tt-events .tt-events-table tr.tt-event-row > td.tt-event-url { order: 8; }
  /* Live Map on a phone: "Enable Link", and the link (the code) after it, or on its own line under it when there is no
     room: never cut off by the edge of the card */
  .tt-events .tt-events-table tr.tt-event-row > td.tt-event-live { flex-wrap: wrap; row-gap: 4px; }
  .tt-events .tt-events-table tr.tt-event-row > td.tt-event-live .tt-live-link { min-width: 0; overflow-wrap: anywhere; }
  .tt-events .tt-events-table tr.tt-event-row > td.tt-event-url a { word-break: break-word; overflow-wrap: anywhere; }
  /* Play, the bin and Export in one row at the bottom */
  .tt-events .tt-events-table tr.tt-event-row > td.tt-event-action { order: 10; width: auto; margin-top: 6px; align-items: center; }
  .tt-events .tt-events-table tr.tt-event-row > td.tt-event-action:empty { display: none; }
  .tt-events .tt-events-table tr.tt-event-row > td.tt-event-action:last-child { margin-left: auto; }
  .tt-events tr.tt-event-row.tt-row-marked { background: #fff4e5; box-shadow: inset 0 0 0 2px #892901; }
}
/* Events page: the New event form in a grid — three fields per row on a wide screen, two on a tablet, one
   on a phone; the boxes fill their column */
.tt-events .tt-event-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 18px; align-items: start; margin-top: 4px; }
.tt-events .tt-event-form .tt-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tt-events .tt-event-form .tt-field > label { margin: 0; font-weight: 600; }
.tt-events .tt-event-form .form-control, .tt-events .tt-event-form .form-select, .tt-events .tt-event-form .tt-event-keep { width: 100%; max-width: none; }
.tt-events .tt-event-form .tt-keep-hint { margin-top: 3px; }
.tt-events .tt-event-form .tt-event-save { align-self: end; }
.tt-events .tt-event-form .tt-event-save > span { display: none; }
@media (max-width: 1000px) {
  /* two columns: name | place, URL, start | end, storage, logo | files, Save */
  .tt-events .tt-event-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tt-events .tt-event-form .tt-field-wide { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .tt-events .tt-event-form { grid-template-columns: minmax(0, 1fr); }
}
/* Tracks page on a phone: the organizer logo left out when it would push the menu below the TrackTape logo */
.map-logo.organizer-logo.tt-logo-crowded { display: none !important; }
/* Device Tracks: the acronym of the participant who had the device, after its label */
#tracks-table .tt-acronym { color: #4b5563; font-weight: 600; }

/* Admin: move devices between accounts — the two accounts' devices side by side */
.tt-admin .tt-move-accounts { display: flex; flex-wrap: wrap; gap: 0 2rem; }
.tt-admin .tt-move-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 0.25rem 0 0.5rem; }
.tt-admin .tt-move-side { min-width: 0; }
.tt-admin .tt-move-side h4 { font-size: 0.95rem; font-weight: 600; margin: 0 0 0.3rem; overflow-wrap: anywhere; }
.tt-admin .tt-move-table td { font-family: Consolas, Menlo, monospace; }
.tt-admin .tt-move-table td.tt-move-label { font-family: inherit; font-weight: 600; }
.tt-admin .tt-move-table td.tt-hint { font-family: inherit; color: #6b7280; }
.tt-admin .tt-move-table .tt-move-tick { width: 2rem; text-align: center; }
.tt-admin .tt-move-table .tt-move-nr { width: 2.5rem; text-align: right; color: var(--tt-muted, #6c757d); font-variant-numeric: tabular-nums; }
.tt-admin .tt-move-table input[type=checkbox] { transform: none; margin: 0; cursor: pointer; vertical-align: middle; }
.tt-admin .tt-move-table tr.tt-move-moved td { background: #dff3e4 !important; }
.tt-admin .tt-move-notice { margin: 0.25rem 0 0.5rem; padding: 0.5rem 0.75rem; border-radius: 8px; background: #fff4e5; border: 1px solid #f0b45a; color: #7a4a00; font-size: 0.9rem; }
.tt-admin .tt-move-notice.hidden { display: none; }
.tt-admin .tt-move-retain { color: inherit; }
@media (max-width: 991px) {
  .tt-admin .tt-move-tables { grid-template-columns: 1fr; }
}
/* Events page: the Live Map link of each event (mypages.tracktape.org/<code>) */
.tt-events .tt-live-link { font-family: Consolas, Menlo, monospace; font-size: 0.82rem; white-space: nowrap; }
/* Live Map (routes/live.js): the event's name and whether it is live, about to start or played back, at the top of the map */
.live-banner { margin: 6px 0 0; padding: 3px 10px; border-radius: 14px; background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); font-size: 0.85rem; color: #1f2933; white-space: nowrap; max-width: calc(100vw - 140px);
  overflow: hidden; text-overflow: ellipsis; }
.live-banner .live-state { margin-left: 8px; color: #4a5560; }
.live-banner .live-state.live-on { color: #c62828; font-weight: 700; }
.live-banner .live-state.live-on::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 5px;
  border-radius: 50%; background: #e53935; vertical-align: 1px; }
.pb-close.hidden { display: none; }
/* Live Map: no event at the address */
.tt-live-missing { max-width: 34rem; margin: 15vh auto 0; padding: 0 16px; text-align: center; }
.tt-live-missing img { height: 48px; margin-bottom: 1rem; }
/* Events page: "Enable Link" in front of the Live Map link (the link shows only when ticked) */
.tt-events .tt-live-enable, .tt-events .tt-live-backup { display: inline-flex; align-items: center; gap: 4px; margin: 0 6px 0 0; padding: 0 !important; font-size: 0.8rem; white-space: nowrap; cursor: pointer; }
.tt-events .tt-live-enable input, .tt-events .tt-live-backup input { width: 13px; height: 13px; margin: 0; transform: none; }
.tt-events .tt-live-backup.hidden { display: none; }
.tt-events .tt-live-link.hidden { display: none; }
/* Events page: the QR-code link (only with "Enable Link"), and the QR code dialog */
.tt-events .tt-live-qr.hidden { display: none; }
.tt-qr-dialog .tt-qr-image { text-align: center; margin: 0.4rem 0 0.6rem; }
.tt-qr-dialog canvas { width: 280px; max-width: 100%; height: auto; image-rendering: pixelated; border: 1px solid #e3e8ee; }
.tt-events .tt-events-table thead th { white-space: nowrap; }
/* Participants: a list being read and put into the table (a spinner and how far it has come) */
.tt-remote-pair-status.tt-busy { display: inline-flex; align-items: center; gap: 8px; color: #1d4b7a; }
.tt-spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid #b9d3ee; border-top-color: #1d4b7a;
  border-radius: 50%; animation: tt-spin 0.8s linear infinite; flex: 0 0 auto; }
@keyframes tt-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .tt-spinner { animation-duration: 2.4s; } }
/* Participants: an acronym changed because another participant had it already */
.tt-admin .tt-participants-table .tt-acronym.tt-adjusted { background: #fff6e0; border-color: #e0b44a; }
/* Events page: the event's "Participants (n)" just saved: lit up for a moment */
.tt-events .tt-event-people.tt-flash { animation: tt-flash 1.6s ease-out; }
@keyframes tt-flash { 0%, 30% { background: #fff1b8; } 100% { background: transparent; } }
/* Tracks page: the position under a right-click (copied to the clipboard) */
.position-info { font-size: 0.85rem; line-height: 1.35; padding: 2px 4px 0; }
.position-info .position-value { font-family: Consolas, Menlo, monospace; font-weight: 700; user-select: all; }
.position-info .position-note { color: #4a5560; font-size: 0.75rem; }

/* Live Map: the map tile's menu of maps (Google Maps, and the free maps of the backup map: javascripts/backupmap.js) */
.map-type-menu { position: fixed; z-index: 2000; min-width: 180px; padding: 4px 0 6px; background: #fff; border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); font-size: 0.85rem; }
.map-type-menu .mtm-group { padding: 6px 12px 2px; font-size: 0.7rem; font-weight: 600; color: #6b7280; text-transform: uppercase;
  letter-spacing: 0.03em; }
.map-type-menu button { position: relative; display: block; width: 100%; padding: 5px 14px 5px 28px; border: 0; background: none;
  color: #111827; text-align: left; }
.map-type-menu button[aria-checked="true"] { font-weight: 600; }
.map-type-menu button[aria-checked="true"]::before { content: "\2713"; position: absolute; left: 10px; }
.map-type-menu button:hover:not(:disabled), .map-type-menu button:focus-visible { background: #f0f4ff; outline: none; }
.map-type-menu button:disabled { color: #9ca3af; cursor: not-allowed; }
.map-type-menu .mtm-note { max-width: 210px; padding: 4px 12px 0; font-size: 0.72rem; color: #6b7280; }
/* A sailrace's sea marks on Google's map: OpenSeaMap's credit, styled as Google's own in the bottom-right corner */
.tt-seamarks-credit { margin: 0 2px 0 0; padding: 0 5px; background: rgba(255, 255, 255, 0.75); color: #444; font: 10px Roboto, Arial, sans-serif;
  line-height: 14px; white-space: nowrap; }
.tt-seamarks-credit a { color: #444; }
/* Events page: "Event type" next to Classes and Save */
.tt-event-buttons { align-items: center; }
.tt-event-buttons .tt-event-type-label { margin: 0; font-size: 0.85rem; white-space: nowrap; }
.tt-event-buttons .tt-event-type { width: auto; }
/* … and in the events table, after the name of a sailrace */
.tt-event-name[data-event-type="sailrace"]::after { content: "Sailrace"; margin-left: 6px; padding: 0 5px; border-radius: 8px;
  background: #e0ecff; color: #1d4ed8; font-size: 0.7rem; font-weight: 600; vertical-align: 1px; }
/* … and the banner's note when the Live Map shows the backup map (the organizer's choice, or Google Maps failed) */
.live-banner .live-backup { margin-left: 8px; color: #b45309; font-weight: 600; cursor: help; }

/* Device Tracks: the Signal tick-box of a track with signal quality values (a band along the track on the map) */
#tracks-table td.tt-signal { text-align: center; }
#tracks-table .tt-signal-box { width: 1rem; height: 1rem; margin: 0; vertical-align: middle; cursor: pointer; } /* look: .tt-tick */
