/* ============================================================
   Termiq — dark aviation theme
   ============================================================ */

:root {
  --bg:        #070b10;
  --bg-2:      #0d131b;
  --panel:     rgba(14, 20, 28, 0.92);
  --panel-solid:#0e141c;
  --border:    rgba(148, 178, 214, 0.14);
  --border-2:  rgba(148, 178, 214, 0.26);

  --text:      #e6edf6;
  --text-2:    #93a4bb;
  --text-3:    #64748b;

  --accent:    #38bdf8;
  --accent-2:  #0ea5e9;
  --amber:     #fbbf24;
  --green:     #34d399;
  --red:       #f87171;

  --lift:      #22c55e;
  --sink:      #60a5fa;

  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 18px 48px rgba(0, 0, 0, 0.55);

  --topbar-h:  56px;
  --timebar-h: 78px;
  --sidebar-w: 320px;
  --panel-w:   380px;

  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

/* The UA rule for [hidden] is display:none at the lowest specificity, so any
   class that sets a display (.row is flex) silently defeats it. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: -.004em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Inter's contextual alternates round off the shapes that read as
     mechanical at UI sizes; tabular figures keep live counters from jittering. */
  font-feature-settings: "cv05" 1, "cv08" 1, "ss03" 1;
}

/* Icon defaults. Charts opt out via .p-chart below. */
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9;
      stroke-linecap: round; stroke-linejoin: round; }

/* The logo is the one filled glyph in the set, so it opts out of the stroke
   defaults above. It carries no colour of its own -- it inherits the text
   colour of whatever it sits in. */
.mark { width: 100%; height: 100%; fill: currentColor; stroke: none; }

/* Keyboard users get the same affordances as pointer users. */
:where(a, button, input, select, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148,178,214,.18); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148,178,214,.32); }

/* ============================ BOOT ============================ */

#boot {
  position: fixed; inset: 0; z-index: 3000;
  display: grid; place-items: center;
  background: radial-gradient(1200px 700px at 50% 38%, #101a26 0%, #070b10 68%);
  transition: opacity .5s ease, visibility .5s;
}
#boot.done { opacity: 0; visibility: hidden; }
.boot-inner { text-align: center; }
.boot-mark { width: 62px; height: 62px; margin: 0 auto; color: var(--text);
             animation: rise 3.4s ease-in-out infinite; }
@keyframes rise { 0%,100% { transform: translateY(3px); opacity: .82; }
                  50%     { transform: translateY(-3px); opacity: 1; } }
.boot-title { margin-top: 16px; font-size: 25px; font-weight: 700; letter-spacing: 5px;
              text-indent: 5px; }
.boot-tagline { margin-top: 5px; font-size: 11px; letter-spacing: 2.2px;
                text-transform: uppercase; color: var(--text-3); }
.boot-status { margin-top: 14px; color: var(--text-2); font-size: 13px; min-height: 18px; }
.boot-bar { margin: 18px auto 0; width: 230px; height: 3px; border-radius: 3px;
            background: rgba(148,178,214,.14); overflow: hidden; }
.boot-bar span { display: block; height: 100%; width: 0;
                 background: linear-gradient(90deg, var(--accent), var(--green));
                 transition: width .35s ease; }

/* ============================ TOPBAR ============================ */

#topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); z-index: 900;
  display: flex; align-items: center; gap: 12px; padding: 0 12px;
  background: linear-gradient(180deg, rgba(10,15,21,.97), rgba(10,15,21,.82));
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 9px; padding-right: 6px;
         text-decoration: none; color: inherit; }
.brand-mark { width: 25px; height: 25px; flex: none; color: var(--text);
              transition: color .18s; }
.brand:hover .brand-mark { color: var(--accent); }
.brand-text { font-size: 14px; font-weight: 700; letter-spacing: 3.2px;
              color: var(--text); white-space: nowrap; }

.icon-btn {
  flex: none; display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  background: rgba(148,178,214,.07); border: 1px solid var(--border);
  color: var(--text-2); cursor: pointer; transition: all .15s;
}
.icon-btn:hover { background: rgba(148,178,214,.14); color: var(--text); border-color: var(--border-2); }
.icon-btn.on { background: rgba(56,189,248,.16); border-color: rgba(56,189,248,.42); color: var(--accent); }

.pills { display: flex; gap: 7px; margin-left: 4px; }
.pill {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px; font-size: 12px;
  background: rgba(148,178,214,.06); border: 1px solid var(--border);
  color: var(--text-2); white-space: nowrap;
}
.pill b { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 650; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.pill.live .dot { background: var(--green); box-shadow: 0 0 0 0 rgba(52,211,153,.6); animation: ping 2s infinite; }
.pill.dead .dot { background: var(--red); }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(52,211,153,.55); } 70% { box-shadow: 0 0 0 7px rgba(52,211,153,0); } 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); } }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.search-wrap { position: relative; }
.search-icon { position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
               width: 15px; height: 15px; color: var(--text-3); pointer-events: none; }
#search {
  width: 210px; height: 34px; padding: 0 10px 0 30px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: rgba(148,178,214,.07); color: var(--text);
  font-family: var(--font); font-size: 13px; outline: none; transition: all .15s;
}
#search::placeholder { color: var(--text-3); }
#search:focus { border-color: rgba(56,189,248,.5); background: rgba(56,189,248,.08); width: 250px; }
#search::-webkit-search-cancel-button { filter: invert(.6); }

.search-results {
  position: absolute; top: calc(100% + 6px); right: 0; width: 300px; max-height: 340px;
  overflow-y: auto; background: var(--panel-solid); border: 1px solid var(--border-2);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 5px; z-index: 50;
}
.sr-item { display: flex; align-items: center; gap: 9px; padding: 8px 9px;
           border-radius: var(--radius-sm); cursor: pointer; }
.sr-item:hover { background: rgba(56,189,248,.12); }
.sr-badge { font-family: var(--mono); font-size: 11px; font-weight: 700;
            padding: 2px 6px; border-radius: 5px; background: rgba(56,189,248,.18);
            color: var(--accent); flex: none; }
.sr-main { min-width: 0; flex: 1; }
.sr-main b { display: block; font-size: 13px; }
.sr-main span { display: block; font-size: 11px; color: var(--text-2);
                overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-alt { font-family: var(--mono); font-size: 11px; color: var(--text-2); }
.sr-empty { padding: 14px; text-align: center; color: var(--text-3); font-size: 12px; }

/* ============================ SIDEBAR ============================ */

#sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: var(--sidebar-w); z-index: 800;
  background: var(--panel); border-right: 1px solid var(--border);
  backdrop-filter: blur(16px);
  transition: transform .26s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
#sidebar.hidden { transform: translateX(-100%); }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 12px 12px calc(var(--timebar-h) + 16px); }

.card { margin-bottom: 10px; border: 1px solid var(--border); border-radius: var(--radius);
        background: rgba(148,178,214,.035); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between;
             padding: 10px 12px; border-bottom: 1px solid var(--border); }
.card-head h2 { margin: 0; font-size: 12px; font-weight: 650; letter-spacing: .5px;
                text-transform: uppercase; color: var(--text-2); }
.card-head.clickable { cursor: pointer; }
.card-head .chev { width: 16px; height: 16px; color: var(--text-3); transition: transform .2s; }
.card.collapsed .card-head { border-bottom-color: transparent; }
.card.collapsed .card-head .chev { transform: rotate(-90deg); }
.card.collapsed .card-body { display: none; }
.card-body { padding: 11px 12px; }
.card.off .card-body { opacity: .4; pointer-events: none; }

/* toggle switch */
.switch { position: relative; display: inline-block; width: 34px; height: 19px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; cursor: pointer; border-radius: 19px;
               background: rgba(148,178,214,.2); transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 13px; height: 13px; left: 3px; top: 3px;
                       border-radius: 50%; background: #94a3b8; transition: .2s; }
.switch input:checked + span { background: rgba(56,189,248,.4); }
.switch input:checked + span::before { transform: translateX(15px); background: var(--accent); }

/* weather layer picker */
.layer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 12px; }
.layer-btn {
  padding: 8px 9px; border-radius: var(--radius-sm); cursor: pointer; text-align: left;
  background: rgba(148,178,214,.06); border: 1px solid transparent;
  color: var(--text-2); font-family: var(--font); font-size: 11.5px; line-height: 1.25;
  transition: all .15s;
}
.layer-btn:hover { background: rgba(148,178,214,.12); color: var(--text); }
.layer-btn.active { background: rgba(56,189,248,.16); border-color: rgba(56,189,248,.45); color: var(--accent); font-weight: 600; }
.layer-btn small { display: block; font-size: 10px; opacity: .65; font-weight: 400; margin-top: 1px; }

/* chips */
.chip-row { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 9px; }
.chip {
  padding: 4.5px 9px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  background: rgba(148,178,214,.06); border: 1px solid var(--border);
  color: var(--text-2); font-family: var(--font); font-size: 11.5px; transition: all .15s;
}
.chip:hover { background: rgba(148,178,214,.13); color: var(--text); }
.chip.active { background: rgba(56,189,248,.16); border-color: rgba(56,189,248,.45); color: var(--accent); }
.chip .cnt { opacity: .55; margin-left: 4px; font-variant-numeric: tabular-nums; }

/* rows / sliders */
.row { display: flex; align-items: center; gap: 9px; margin: 9px 0; }
.row-label { flex: none; width: 92px; font-size: 11.5px; color: var(--text-2); }
.row-value { flex: none; width: 58px; text-align: right; font-family: var(--mono);
             font-size: 11.5px; color: var(--text); }

input[type=range] {
  flex: 1; -webkit-appearance: none; appearance: none; height: 3px; border-radius: 3px;
  background: rgba(148,178,214,.22); outline: none; cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent); border: 2px solid #0b1119; cursor: pointer;
  box-shadow: 0 0 0 1px rgba(56,189,248,.5); transition: transform .12s;
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.25); }
input[type=range]::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%; background: var(--accent);
  border: 2px solid #0b1119; cursor: pointer;
}

/* checkboxes */
.check-row { display: flex; flex-direction: column; gap: 7px; margin: 10px 0 4px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer;
         font-size: 11.5px; color: var(--text-2); }
.check input { appearance: none; width: 15px; height: 15px; flex: none; border-radius: 4px;
               border: 1px solid var(--border-2); background: rgba(148,178,214,.07);
               cursor: pointer; position: relative; transition: all .15s; }
.check input:checked { background: var(--accent-2); border-color: var(--accent); }
.check input:checked::after { content: ""; position: absolute; left: 4.5px; top: 1px;
                              width: 4px; height: 8px; border: solid #04121c;
                              border-width: 0 2px 2px 0; transform: rotate(45deg); }
.check:hover { color: var(--text); }

.hint { margin: 9px 0 0; font-size: 11px; line-height: 1.5; color: var(--text-3); }
.hint b { color: var(--text-2); font-weight: 600; }

/* legends */
.legend { margin-top: 10px; }
.legend-bar { height: 9px; border-radius: 5px; border: 1px solid var(--border); }
.legend-scale { display: flex; justify-content: space-between; margin-top: 4px;
                font-family: var(--mono); font-size: 10px; color: var(--text-3); }
.legend-title { font-size: 11px; color: var(--text-2); margin-bottom: 5px; }

.legend-list { display: flex; flex-wrap: wrap; gap: 4px 11px; margin-top: 9px; }
.lg { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-2); }
.lg i { width: 9px; height: 9px; border-radius: 3px; flex: none; }

/* aircraft mini list */
.ac-list { margin-top: 10px; max-height: 210px; overflow-y: auto; }
.ac-row { display: flex; align-items: center; gap: 8px; padding: 6px 7px;
          border-radius: var(--radius-sm); cursor: pointer; font-size: 12px; }
.ac-row:hover { background: rgba(56,189,248,.1); }
.ac-row .cn { font-family: var(--mono); font-weight: 700; font-size: 11px; color: var(--accent);
              min-width: 30px; }
.ac-row .nm { flex: 1; color: var(--text-2); overflow: hidden;
              text-overflow: ellipsis; white-space: nowrap; }
.ac-row .cl { font-family: var(--mono); font-size: 11px; font-variant-numeric: tabular-nums; }
.ac-empty { padding: 12px; text-align: center; font-size: 11.5px; color: var(--text-3); }

.attrib { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border);
          font-size: 10px; line-height: 1.7; color: var(--text-3); }

/* ============================ MAP ============================ */

#map { position: fixed; inset: var(--topbar-h) 0 0 0; }
.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { display: none; }
.maplibregl-canvas { outline: none; }

/* ============================ TIMEBAR ============================ */

#timebar {
  position: fixed; left: calc(var(--sidebar-w) + 14px); right: 14px; bottom: 14px; z-index: 850;
  height: var(--timebar-h);
  display: flex; align-items: center; gap: 11px; padding: 0 15px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(16px);
  transition: left .26s cubic-bezier(.4,0,.2,1), right .26s cubic-bezier(.4,0,.2,1);
}
#sidebar.hidden ~ #timebar { left: 14px; }
body.panel-open #timebar { right: calc(var(--panel-w) + 14px); }

.now-btn {
  flex: none; height: 30px; padding: 0 12px; border-radius: var(--radius-sm);
  background: rgba(56,189,248,.13); border: 1px solid rgba(56,189,248,.34);
  color: var(--accent); font-family: var(--font); font-size: 11px; font-weight: 700;
  letter-spacing: .7px; cursor: pointer; transition: all .15s;
}
.now-btn:hover { background: rgba(56,189,248,.24); }
.now-btn.active { background: var(--accent-2); color: #04121c; border-color: var(--accent); }

.time-track { flex: 1; min-width: 0; }
.time-readout { display: flex; align-items: baseline; gap: 9px; margin-bottom: 3px; }
.time-readout b { font-size: 14px; font-variant-numeric: tabular-nums; letter-spacing: -.2px; }
.time-readout span { font-size: 11px; color: var(--text-2); }
#timeSlider { width: 100%; }
.time-ticks { position: relative; height: 13px; margin-top: 1px; }
.time-ticks span { position: absolute; transform: translateX(-50%); font-family: var(--mono);
                   font-size: 9.5px; color: var(--text-3); white-space: nowrap; }
.time-ticks span.day { color: var(--text-2); font-weight: 700; }

.play .ico-pause { display: none; }
.play.playing .ico-play { display: none; }
.play.playing .ico-pause { display: block; }
.play svg { fill: currentColor; stroke: none; }
.play.playing svg { fill: none; stroke: currentColor; }

/* ============================ DETAIL PANEL ============================ */

#panel {
  position: fixed; top: var(--topbar-h); right: 0; bottom: 0; width: var(--panel-w); z-index: 860;
  background: var(--panel); border-left: 1px solid var(--border);
  backdrop-filter: blur(16px); overflow-y: auto;
  animation: slideIn .24s cubic-bezier(.4,0,.2,1);
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.panel-close { position: absolute; top: 11px; right: 11px; z-index: 5;
               width: 28px; height: 28px; display: grid; place-items: center;
               border-radius: 7px; background: rgba(148,178,214,.1);
               border: 1px solid var(--border); color: var(--text-2); cursor: pointer; }
.panel-close:hover { background: rgba(248,113,113,.18); color: var(--red); }

#panelBody { padding: 15px 16px calc(var(--timebar-h) + 24px); }

.p-head { margin-bottom: 14px; padding-right: 34px; }
.p-kicker { font-size: 10.5px; letter-spacing: 1.1px; text-transform: uppercase;
            color: var(--accent); font-weight: 650; }
.p-title { margin: 3px 0 0; font-size: 21px; font-weight: 700; letter-spacing: -.5px; line-height: 1.15; }
.p-sub { margin-top: 3px; font-size: 12px; color: var(--text-2); }

.rating-bar { display: flex; align-items: center; gap: 10px; margin: 12px 0 4px;
              padding: 11px 12px; border-radius: var(--radius); border: 1px solid var(--border); }
.rating-score { font-size: 26px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.rating-meta b { display: block; font-size: 13px; }
.rating-meta span { font-size: 11px; color: var(--text-2); }
.r-excellent { background: rgba(34,197,94,.13); border-color: rgba(34,197,94,.4); }
.r-excellent .rating-score { color: #4ade80; }
.r-good { background: rgba(163,230,53,.12); border-color: rgba(163,230,53,.35); }
.r-good .rating-score { color: #a3e635; }
.r-ok { background: rgba(251,191,36,.12); border-color: rgba(251,191,36,.35); }
.r-ok .rating-score { color: var(--amber); }
.r-poor { background: rgba(251,146,60,.12); border-color: rgba(251,146,60,.35); }
.r-poor .rating-score { color: #fb923c; }
.r-bad { background: rgba(148,163,184,.1); border-color: var(--border); }
.r-bad .rating-score { color: var(--text-3); }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 12px 0; }
.stat {
  padding: 9px 11px; border-radius: var(--radius-sm);
  background: rgba(148,178,214,.05); border: 1px solid var(--border);
}
.stat .k { font-size: 10px; letter-spacing: .4px; text-transform: uppercase; color: var(--text-3); }
.stat .v { margin-top: 2px; font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums;
           letter-spacing: -.4px; }
.stat .v small { font-size: 11px; font-weight: 500; color: var(--text-2); margin-left: 2px; }
.stat.wide { grid-column: span 2; }
.stat.lift .v { color: var(--lift); }
.stat.height .v { color: var(--accent); }

.p-section { margin-top: 18px; }
.p-section > h3 { margin: 0 0 9px; font-size: 11px; font-weight: 650; letter-spacing: .8px;
                  text-transform: uppercase; color: var(--text-2); }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 5.5px 0;
      border-bottom: 1px solid rgba(148,178,214,.07); font-size: 12.5px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-2); }
.kv .v { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.kv .v.mono { font-family: var(--mono); font-size: 11.5px; font-weight: 500; }

/* Charts must escape the global icon sizing/stroke defaults. */
.p-chart {
  width: 100%; height: auto; display: block;
  fill: initial; stroke: none; stroke-width: 1;
  border-radius: var(--radius-sm);
  background: rgba(148,178,214,.04); border: 1px solid var(--border);
}

.tabs { display: flex; gap: 4px; margin-bottom: 11px; padding: 3px;
        background: rgba(148,178,214,.06); border-radius: var(--radius-sm); }
.tab { flex: 1; padding: 6px; border-radius: 6px; border: none; cursor: pointer;
       background: transparent; color: var(--text-2);
       font-family: var(--font); font-size: 11.5px; font-weight: 550; transition: all .15s; }
.tab:hover { color: var(--text); }
.tab.active { background: rgba(56,189,248,.2); color: var(--accent); }

.zone-row { display: flex; align-items: center; gap: 9px; padding: 8px 10px; margin-bottom: 5px;
            border-radius: var(--radius-sm); background: rgba(148,178,214,.05);
            border: 1px solid var(--border); border-left-width: 3px; }
.zone-row.active { border-left-color: var(--red); }
.zone-row.soon   { border-left-color: var(--amber); }
.zone-row.later  { border-left-color: #64748b; }
.zone-row.inactive { border-left-color: #334155; opacity: .68; }
.zone-row .zn { font-family: var(--mono); font-size: 11.5px; font-weight: 700; }
.zone-row .zt { flex: 1; font-size: 10.5px; color: var(--text-2); }
.zone-row .za { font-family: var(--mono); font-size: 10.5px; color: var(--text-2); }

.badge { display: inline-block; padding: 2px 7px; border-radius: 999px;
         font-size: 10px; font-weight: 650; letter-spacing: .3px; }
.badge.red   { background: rgba(248,113,113,.2); color: #fca5a5; }
.badge.amber { background: rgba(251,191,36,.2);  color: #fcd34d; }
.badge.grey  { background: rgba(148,163,184,.16); color: #cbd5e1; }
.badge.green { background: rgba(52,211,153,.2);  color: #6ee7b7; }
.badge.blue  { background: rgba(56,189,248,.2);  color: #7dd3fc; }

.win-list { font-family: var(--mono); font-size: 11px; }
.win { display: flex; align-items: center; gap: 8px; padding: 5px 0;
       border-bottom: 1px solid rgba(148,178,214,.07); }
.win:last-child { border-bottom: none; }
.win .wt { flex: 1; color: var(--text); }
.win .wa { color: var(--text-2); }
.win.now { color: var(--red); }
.win.now .wt { color: #fca5a5; font-weight: 700; }

.hours-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.hours-table th { text-align: right; padding: 5px 4px; font-size: 9.5px; font-weight: 600;
                  letter-spacing: .4px; text-transform: uppercase; color: var(--text-3);
                  border-bottom: 1px solid var(--border); }
.hours-table th:first-child, .hours-table td:first-child { text-align: left; }
.hours-table td { padding: 4px; text-align: right; font-variant-numeric: tabular-nums;
                  border-bottom: 1px solid rgba(148,178,214,.05); }
.hours-table tr.sel { background: rgba(56,189,248,.12); }
.hours-table tr:hover { background: rgba(148,178,214,.06); cursor: pointer; }
.hours-table .h { font-family: var(--mono); color: var(--text-2); }

/* map popup override */
.maplibregl-popup-content {
  background: var(--panel-solid); color: var(--text);
  border: 1px solid var(--border-2); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 10px 12px; font-family: var(--font); font-size: 12px;
}
.maplibregl-popup-tip { border-top-color: var(--panel-solid) !important;
                        border-bottom-color: var(--panel-solid) !important; }
.maplibregl-popup-close-button { color: var(--text-2); font-size: 17px; padding: 2px 7px; }

/* ============================ TOAST ============================ */

#toast {
  position: fixed; bottom: calc(var(--timebar-h) + 26px); left: 50%; transform: translateX(-50%) translateY(16px);
  z-index: 1500; padding: 9px 16px; border-radius: 999px;
  background: var(--panel-solid); border: 1px solid var(--border-2); box-shadow: var(--shadow);
  font-size: 12.5px; opacity: 0; pointer-events: none; transition: all .25s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: rgba(248,113,113,.5); color: #fca5a5; }

/* ============================ TASK ============================ */

.tk-row { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
.tk-row select { flex: 1; min-width: 0; }

select {
  height: 30px; padding: 0 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: rgba(148,178,214,.07);
  color: var(--text); font-family: var(--font); font-size: 12px;
  outline: none; cursor: pointer; transition: border-color .15s;
}
select:hover { border-color: var(--border-2); }
select:focus { border-color: rgba(56,189,248,.5); }
select option { background: var(--panel-solid); color: var(--text); }

.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm svg { width: 15px; height: 15px; }

.tk-upload { margin: 0 0 8px; padding: 8px; border-radius: var(--radius-sm);
             background: rgba(56,189,248,.08); border: 1px solid rgba(56,189,248,.3); }
#tkUploadName {
  width: 100%; height: 28px; margin-bottom: 6px; padding: 0 8px;
  border-radius: 6px; border: 1px solid var(--border);
  background: rgba(148,178,214,.08); color: var(--text);
  font-family: var(--font); font-size: 12px; outline: none;
}
#tkUploadName:focus { border-color: rgba(56,189,248,.55); }

/* point list */
.tk-points { margin: 10px 0 8px; }
.tk-empty { padding: 14px 10px; text-align: center; font-size: 11.5px; color: var(--text-3);
            border: 1px dashed var(--border-2); border-radius: var(--radius-sm); }

.tk-pt { border: 1px solid var(--border); border-radius: var(--radius-sm);
         background: rgba(148,178,214,.05); margin-bottom: 4px; border-left-width: 3px; }
.tk-pt.start  { border-left-color: #22c55e; }
.tk-pt.turn   { border-left-color: #38bdf8; }
.tk-pt.finish { border-left-color: #f87171; }

.tk-pt-head { display: flex; align-items: center; gap: 7px; padding: 6px 7px; }
.tk-idx { font-family: var(--mono); font-size: 10px; font-weight: 700; color: var(--text-3);
          min-width: 13px; text-align: right; }
.tk-name { flex: 1; min-width: 0; font-size: 12px; font-weight: 600;
           overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-zsum { font-family: var(--mono); font-size: 10px; color: var(--text-2);
           padding: 1px 5px; border-radius: 4px; background: rgba(148,178,214,.1);
           cursor: pointer; white-space: nowrap; }
.tk-zsum:hover { background: rgba(56,189,248,.18); color: var(--accent); }
.tk-mini { width: 19px; height: 19px; flex: none; display: grid; place-items: center;
           border: none; background: transparent; color: var(--text-3);
           border-radius: 4px; cursor: pointer; }
.tk-mini svg { width: 13px; height: 13px; }
.tk-mini:hover { background: rgba(148,178,214,.15); color: var(--text); }
.tk-mini.del:hover { background: rgba(248,113,113,.2); color: var(--red); }
.tk-mini:disabled { opacity: .25; cursor: default; }
.tk-mini:disabled:hover { background: transparent; color: var(--text-3); }

/* per-point zone editor */
.tk-zone { padding: 2px 8px 9px 27px; border-top: 1px solid var(--border); margin-top: 2px; }
.tk-presets { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.tk-preset { padding: 3px 7px; border-radius: 999px; cursor: pointer; white-space: nowrap;
             background: rgba(148,178,214,.07); border: 1px solid var(--border);
             color: var(--text-2); font-family: var(--font); font-size: 10.5px; }
.tk-preset:hover { background: rgba(56,189,248,.16); color: var(--accent); }
.tk-field { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.tk-field label { flex: none; width: 78px; font-size: 11px; color: var(--text-2); }
.tk-field select { flex: 1; height: 26px; font-size: 11px; }
.tk-field input[type=number] {
  flex: 1; min-width: 0; height: 26px; padding: 0 7px; border-radius: 6px;
  border: 1px solid var(--border); background: rgba(148,178,214,.07);
  color: var(--text); font-family: var(--mono); font-size: 11px; outline: none;
}
.tk-field input[type=number]:focus { border-color: rgba(56,189,248,.5); }
.tk-field .unit { flex: none; font-size: 10.5px; color: var(--text-3); width: 26px; }

/* add-a-point search */
.tk-search { position: relative; }
#tkSearch {
  width: 100%; height: 30px; padding: 0 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: rgba(148,178,214,.07);
  color: var(--text); font-family: var(--font); font-size: 12px; outline: none;
}
#tkSearch:focus { border-color: rgba(56,189,248,.5); background: rgba(56,189,248,.08); }
#tkSearch::placeholder { color: var(--text-3); }
.tk-suggest {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  max-height: 220px; overflow-y: auto; padding: 4px;
  background: var(--panel-solid); border: 1px solid var(--border-2);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.tk-sg { display: flex; align-items: center; gap: 7px; padding: 6px 7px;
         border-radius: 6px; cursor: pointer; font-size: 12px; }
.tk-sg:hover, .tk-sg.on { background: rgba(56,189,248,.14); }
.tk-sg i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.tk-sg .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-sg .e { font-family: var(--mono); font-size: 10px; color: var(--text-3); }

/* totals */
.tk-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin: 10px 0 9px; }
.tk-tot { padding: 7px 9px; border-radius: var(--radius-sm);
          background: rgba(148,178,214,.05); border: 1px solid var(--border); }
.tk-tot .k { font-size: 9.5px; letter-spacing: .4px; text-transform: uppercase; color: var(--text-3); }
.tk-tot .v { margin-top: 1px; font-size: 15px; font-weight: 650; letter-spacing: -.3px;
             font-variant-numeric: tabular-nums; }
.tk-tot.wide { grid-column: span 2; }
.tk-tot.accent .v { color: var(--accent); }
.tk-tot.amber .v { color: var(--amber); }

.tk-actions { display: flex; gap: 5px; margin-bottom: 4px; }
.tk-btn { flex: 1; height: 28px; border-radius: var(--radius-sm); cursor: pointer;
          background: rgba(148,178,214,.07); border: 1px solid var(--border);
          color: var(--text-2); font-family: var(--font); font-size: 11px;
          font-weight: 550; transition: all .15s; }
.tk-btn:hover { background: rgba(148,178,214,.14); color: var(--text); }
.tk-btn.primary { background: rgba(56,189,248,.16); border-color: rgba(56,189,248,.42); color: var(--accent); }
.tk-btn.primary:hover { background: rgba(56,189,248,.26); }
.tk-btn.danger:hover { background: rgba(248,113,113,.18); border-color: rgba(248,113,113,.4); color: var(--red); }
.tk-btn:disabled { opacity: .35; cursor: default; }
.tk-btn:disabled:hover { background: rgba(148,178,214,.07); color: var(--text-2); }

/* leg analysis in the detail panel */
.leg-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.leg-table th { text-align: right; padding: 5px 4px; font-size: 9.5px; font-weight: 600;
                letter-spacing: .4px; text-transform: uppercase; color: var(--text-3);
                border-bottom: 1px solid var(--border); }
.leg-table th:first-child, .leg-table td:first-child { text-align: left; }
.leg-table td { padding: 5px 4px; text-align: right; font-variant-numeric: tabular-nums;
                border-bottom: 1px solid rgba(148,178,214,.05); }
.leg-table .lg-name { font-size: 11px; color: var(--text-2); max-width: 96px;
                      overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leg-table .head { color: #fca5a5; }
.leg-table .tail { color: #6ee7b7; }
.leg-table .cross { color: var(--text-2); }

/* ============================ RESPONSIVE ============================ */

@media (max-width: 1100px) {
  :root { --panel-w: 330px; }
  .brand-text { display: none; }
}

@media (max-width: 860px) {
  :root { --sidebar-w: 288px; --panel-w: 100vw; --timebar-h: 70px; }
  #sidebar { box-shadow: var(--shadow); }
  #timebar { left: 10px !important; right: 10px; bottom: 10px; }
  body.panel-open #timebar { display: none; }
  .pills { display: none; }
  #search { width: 140px; }
  #search:focus { width: 180px; }
}
