@charset "UTF-8";

.drag-box { /* must be global, document.body is used to generate this box */
  position: fixed;
  top: calc(100vh + 100px);
  padding: 0 12px 12px 0; /* for shadow */
  z-index: 20;
  & > div {
    box-shadow: 6px 6px 8px rgb(47,72,88,.8); /* rhino */
    border: 2px solid var(--pl-rhino);
    background: white;
    border-radius: 6px;
    padding: 12px;
  }
}

/* Menüüde kastid elavad document.body all (main.css .menubox), seega ka nende reeglid on siin
   globaalsed -- main.plan-page sees nad ei kehtiks. */
.menubox.lap-insert {
  min-width: 190px;
  padding: 8px 0;
  border: none;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-family: "PT Sans", sans-serif;

  li.item {
    gap: 10px;
    padding: 12px 16px;
    border-radius: 0;
    border-bottom: 1px solid #F5F5F5;

    &:last-child { border-bottom: none; }
    &.disabled { cursor: not-allowed; }
    &:hover:not(.disabled), &:focus:not(.disabled), &[menu-open] { background-color: #F8F9FA; font-weight: 700; }
  }

  /* vöönd mahutab kõige laiema ikooni (haagise vahetus on teistest lamedam ja laiem) */
  .i { width: 21px; }
  .i img { width: 13px; height: 13px; object-fit: contain; }
  .i img.haagise-vahetus { width: 21px; height: 10px; }
  li.item.disabled .i img { filter: grayscale(1); opacity: .55; }
}

/* terminalide valik avaneb hallil taustal, ilma ridadevaheliste joonteta */
.menubox.lap-insert.sub {
  background: #F5F5F5;
  border: 1px solid #E0E0E0;

  li.item {
    border-bottom: none;
    &:hover:not(.disabled), &:focus:not(.disabled) { background-color: #EBEDF1; }
  }
}

/* Sisestuselement kahe peatuse vahel (plan.js LapInsert): üks fixed-element kogu heapi kohta, asukoha annab
   peatuse rea rect. Riba on 24 px kõrge ja keskendub peatuste piirile; ainult nupp püüab hiire, mujalt läheb
   hiir ridadele läbi. Menüü ise on jagatud Menu (main.css .menubox, kuju ülal .menubox.lap-insert). */
.lap-insert-bar {
  position: fixed;
  z-index: 5;
  height: 24px;
  margin-top: -12px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;

  .lap-insert-line {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    margin-top: -0.5px;
    height: 1px;
    background: #E6CC7A;
  }
  &:has(.lap-insert-plus:hover) .lap-insert-line,
  &:has([menu-open]) .lap-insert-line { background: #FFA600; }

  .lap-insert-plus {
    --lap-insert-plus-bg: #FFF8DD;
    pointer-events: auto;
    position: relative;
    box-sizing: border-box;
    width: 16px;
    height: 16px;
    padding: 0;
    border: 1px solid #E6CC7A;
    border-radius: 100px;
    background: var(--lap-insert-plus-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;

    &:hover, &[menu-open] { border-color: #FFA600; }
    .icon {
      font-size: 14px;
      margin: 0;
      color: #E6CC7A;
      font-variation-settings: 'FILL' 0, 'wght' 600, 'GRAD' 0, 'opsz' 20;
    }
    &:hover .icon, &[menu-open] .icon { color: #FFA600; }
  }
}

/* "Uus ring" silt lohistamisel (plan.js DragOver): üks fixed-element kogu heapi kohta, mõõdud päise rect-ist;
   hiirt ei püüa, drop läheb päisele */
.drag-over {
  position: fixed;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-around;
  animation: fadeInOpacity ease .4s;
  background-color: rgba(255, 255, 255, .65);
  border-top-left-radius: 6px; border-top-right-radius: 6px;
  box-sizing: border-box;
  padding: 0 20px;
  color: var(--pl-teal-green);
  font-size: 16px;
  user-select: none;
  pointer-events: none;
}

main.plan-page {
  --control-height: 3em;
  display: grid;

  max-height: calc(100vh - var(--nav-height)); height: calc(100vh - var(--nav-height)); min-height: calc(100vh - var(--nav-height));
  box-sizing: border-box;
  grid-template-areas:
    "filt filt"
    "shipments shipments" /* shipments table */
    "slicer slicer"
    "heapctrl selpanel"
    "heap map";
  grid-template-columns: 480px 1fr; /* minmax(1fr, 200px) 1fr; /*2em 2fr 1fr; */
  grid-template-rows:
    var(--control-height)  /* filt */
    1fr                    /* shipments */
    4px                    /* slicer */
    var(--control-height)  /* heap-control & selpanel */
    var(--map-height, 50%);/* map & laps; map-height is set and modified by javascript */
  /* transition: grid-template-rows .3s ease-out; */

  .slicer { grid-area: slicer; border-top: 1px solid white; border-bottom: 1px solid white; height: 2px; background-color: var(--pl-eggshell); cursor: row-resize; }
  .slicer:hover, .slicer.act { background-color: var(--pl-beetle-green); transition: background-color .4s .2s; }

  .table-header {
    grid-area: filt;
    background-color: #f4f5f7;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-sizing: border-box;
    flex-wrap: wrap;
    position: relative;
    z-index: 6;

    .date-range-section {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .filter-section {
      display: flex;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;

      label {
        display: flex;
        align-items: center;
        gap: 6px;
        white-space: nowrap;
        cursor: pointer;

        input[type=checkbox] {
          cursor: pointer;
        }

        .checkbox-wrapper {
          margin: 0;
        }
      }

      select {
        outline: none;
        padding: 4px 6px;
        border-radius: 4px;
        border-color: var(--pl-platinum);
        width: 140px;
      }

      .user-select {
        min-width: 140px;
      }
    }

    .terms {
      display: flex;
      align-items: center;
      gap: 2px;
      transition: all 0.1s ease;
    }
    
    .terms > * {
      transition: all 0.1s ease;
    }

    .search-section {
      margin-left: auto;
      
      input {
        outline: none;
      }
    }
  }

  search {
    grid-area: filt;
    .icon { margin: 0 14px 0 0; transform: scale(1.4); width: 14px; /* ilma with-ita hüppab palju kuni font on laetud */ }
    input { margin-left: 12px; }
    .disabled { opacity: .7; }
    vertical-align: center;
    box-sizing: border-box;
    padding-left: 20px;
    display: flex;
    align-items: center;
    background-color: #f4f5f7;
    /* background-color: #F7A6002A; /* --pl with opacity */
    /* background-color: var(--pl-champagne); */
    select { outline: none; padding: 4px 6px; border-radius: 4px; border-color: var(--pl-platinum); margin-left: 12px; width: 140px; }
  }
  div.shp { 
    grid-area: shipments; 
    grid-column: 1 / 3; 
    position: relative;
    z-index: 1; /* Below .table-header (z-index: 6) so dropdowns appear above table */
    width: 100%; 
    overflow: hidden;
    display: flex;
    flex-direction: column;

    /* ainult põhitabel (otsene laps): hõljuv eelvaade .shp-hover-preview sees on scroll: false ja ei tohi kerida */
    > .table-container {
      flex: 1;
      overflow: auto;
      position: relative;

      .table-wrapper {
        overflow: auto;
        height: 100%;
      }
    }

    .table-component {
      width: 100%;

      tr.sel td { 
        background-color: var(--sel-color); 
        cursor: grab; 
      }

      td.splitter {
        cursor: pointer;
      }

      .icon.colorlegend {
        font-size: 16px;

        &.a { color: var(--a-color); }
        &.b { color: var(--b-color); }
      }

      .address-info {
        display: inline;
      }

      .address-info .company {
        color: var(--pl-rhino);
        opacity: 0.5;
      }

      .shipment-id {
        cursor: pointer;
        color: #E78F00DE;
      }

      .date-day {
        color: #8D92A5;
      }

      .date-month {
        color: #000000DE;
      }

      .date-fallback {
        color: var(--pl-gray-olive);
      }

      .client-cell {
        max-width: 6em;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }

      .tags-cell {
        max-height: 1em;
        overflow-y: auto;
        max-width: 500px;
      }
    }

    .shp-hover-preview {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      z-index: 5;
      background: var(--sel-color);
      border-top: 1px solid #E6E6E6;
      box-shadow: 0 -6px 12px rgba(0, 0, 0, 0.12);
      pointer-events: none;

      .table-component {
        width: 100%;
      }

      .table-component thead,
      .table-component tfoot {
        display: none;
      }

      tbody tr td {
        background: var(--sel-color) !important;
      }

      td[data-column="id"] {
        text-align: center !important;
      }
    }
  }
  div.map {
    grid-area: map;
    /* Sama trikk mis table.css .table-wrapper'il, väiksem võit (markerid on juba omaette
       kihtidel): ~27ms -> ~23ms kaadri kohta, ∞-režiimis 335 markeriga. */
    will-change: transform;
  }
  #plan-map {
    width: 100%;
    height: 100%;
  }
  div.selpanel {
    grid-area: selpanel;
    display: flex;
    margin: 5px 12px 5px 0;
    justify-content: space-between;
    padding: 6px 12px 6px 12px;
/*
    border: 1px solid var(--pl-dark-mustard);
    background-color: var(--pl-early-dawn);
*/
    border-radius: 4px;
  }

  .table-component td.adr {
    /* & > * + * { margin-block-start: 18px; } */
    align-content: center;
    .city { font-weight: bold; }
    .twin {
      font-size: 82%;
      border: 1px solid #B5A60035;
      background-color: #B5A60005;
      color: var(--pl-sahara);
      border-radius: 4px;
      padding: 0px 3px;
      line-height: 1.3;
      margin-left: 9px;
      margin-top: 0px;
      white-space: nowrap;
      display: inline-flex;
      align-items: center;
      vertical-align: middle;
      height: auto;
      max-height: 16px;
    }
    .company {
      font-size: 96%;
      color: #aaa; white-space: nowrap; text-overflow: ellipsis; max-width: 100%; width: 0px;
      border-radius: 5px;
    }
  }

  address, div.adr {
    display: flex; 
    gap: 8px;
    flex-wrap: nowrap;
    align-items: center;
    font-style: normal;
    .city { font-weight: bold; }
    .twin {
      font-size: 82%;
      border: 1px solid #B5A60035;
      background-color: #B5A60005;
      color: var(--pl-sahara);
      border-radius: 4px;
      padding: 0px 3px;
      line-height: 1.3;
      margin-left: 9px;
      margin-top: 0px;
      white-space: nowrap;
      display: inline-flex;
      align-items: center;
      vertical-align: middle;
      height: auto;
      max-height: 16px;
    }
    .comp {
      font-size: 96%;
      color: #aaa; white-space: nowrap; text-overflow: ellipsis; max-width: 100%; width: 0px;
      border-radius: 5px;
    }
  }

  th { white-space: nowrap; }
  th.tags { width: 6em; max-width: 6em; }
/*
  td.rm { text-align: right }
  td.rm button {
    border-radius: 50%;
    border: 1px solid var(--pl-platinum);
  }
*/

  .map-term { font-size: 30px; border-radius: 50%; background-color: var(--pl); opacity: .7; }

  .term { 
    /* border: 1px solid #bbb; */
    border: 1px solid transparent;
    background: #E1E4EA;
    color: #212121;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: -0.36px;
    padding: 2px 6px;
    line-height: 1.4;
    border-radius: 4px;
    margin: 0;
    margin-right: 2px;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 18px;
    box-sizing: border-box;
    text-align: center;
    cursor: pointer;
    position: relative;
  }
  
  .term:last-child {
    margin-right: 0;
  }
  /* .term.jv, .term.kv { cursor: pointer; } */
  .term.act {
    background: var(--pl-pale-orange);
  }
  /* TODO: peaks olema fix laiusega, aga nende joinimised lähevad katki */
  /* margin: 0; text-align: center; box-sizing: border-box; width: 32px; padding-left: 0; padding-right: 0; margin-right; */
  .term.plan { background-color: #ffa600; color: white; }
  .term.done { background-color: #1e9f22; color: white; }
  th.due, td.due { width: 12em; }
  td.due .term {
    margin: 0 2px;
  }
  
  td.due {
    .alink, .blink, .link-left, .link-right { background-color: #fff8dd;  color: #212121; }
  }

  td.due .term.alink { border: 1px solid #ffa600; border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; border-right: 0 none; }
  td.due .term.blink { border: 1px solid #ffa600; border-top-left-radius : 0; border-bottom-left-radius:  0; margin-left:  0; border-left:  0 none; }

  td.due .term.link-left  { border: 1px solid #ffa600; margin-left:  0; border-top-left-radius:  0; border-bottom-left-radius:  0; border-left:  0 none; padding-left:  12px; }
  td.due .term.link-right { border: 1px solid #ffa600; margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 0 none; padding-right: 12px; }

  /* Terminal pair styles */
  span.term-pair {
    display: inline-flex;
    gap: 0;
    position: relative;
    margin-right: 4px;
  }

  span.term-pair:last-child {
    margin-right: 0;
  }
  
  /* Highlighted pair styling - applied only when pair has active class */
  span.term-pair.active .term.pair-left {
    border: 1px solid #ffa600;
    border-right: none;
    background-color: #fff8dd;
    color: #212121;
  }
  
  span.term-pair.active .term.pair-right {
    border: 1px solid #ffa600;
    border-left: 1px solid #ffa600;
    background-color: #fff8dd;
    color: #212121;
  }

  span.term {
    &.pair-left {
      border-top-right-radius: 0;
      border-bottom-right-radius: 0;
      margin-right: 0;
    }

    &.pair-right {
      border-top-left-radius: 0;
      border-bottom-left-radius: 0;
      border-left: 1px solid #ffffff;
      margin-left: 0;
    }
  }

  td img.warnsign {
    height: 24px;
    margin: 0 4px;
  }

  .plandone { color: var(--pl-gray-olive); }

  .twarn {
    display: inline flow-root;
    height: 26px;
    width: 26px;
    padding-top: 3px;
    min-width: 26px;
    background-image: url(warning.svg);
    background-size: cover;
    text-align: center;
    line-height: 30px;
    box-sizing: border-box;
  }

  .loc-marker {
    border-radius: 4px;
    opacity: .76;
    /* border: 1px solid var(--pl-early-dawn); */
    min-width: 26px;
    min-height: 18px; height: 18px; line-height: 18px;
    box-sizing: border-box;
    text-align: center;
    color: white; /* var(--pl-champagne); */
    font-size: 12px;
    outline: none;
    filter: grayscale(40%);
    border: 2px solid transparent; /* hilight lisab borderi */
    display: flex; justify-content: center; align-items: center;
    transform: translate(0, 50%); /* marker pole mitte asukoha üleval vaid peal */
    transition: height .4s, border-radius .4s, opacity .4s;
    /* position: relative; */
    & *:focus { outline: none }
    &.a  { background-color: var(--a-color); } /* .loc-marker.a::after { display:none; border-top: 8px solid var(--a-color); } */
    &.b  { background-color: var(--b-color); } /* .loc-marker.b::after { display:none; border-top: 8px solid var(--b-color); } */
    &.a.b { background: linear-gradient(90deg, var(--a-color) 0%, var(--b-color) 100%); }
    &.sel { /* TODO: töötas vanasti, enam mitte */
      color: var(--pl-light-sky);
      /* height: 100px; width: 200px; */
/*
      background: linear-gradient(90deg, blue 50%, transparent 50%), linear-gradient(90deg, blue 50%, transparent 50%), linear-gradient(0deg, blue 50%, transparent 50%), linear-gradient(0deg, blue 50%, transparent 50%);
      background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
      background-size: 15px 4px, 15px 4px, 4px 15px, 4px 15px;
      background-position: 0px 0px, 200px 100px, 0px 100px, 200px 0px;
      padding: 10px;
      animation: border-dance 4s infinite linear;
*/
    }
  }

  .filt-date input { background-color: transparent; border: 1px solid var(--pl-sahara); padding: 1px 6px; color: var(--pl-rhino); border-radius: 4px; }
  .filt-date ul {
    list-style-type: none;
    margin: 0; padding: 0;
    li { line-height: 1.4em; }
    /* li:hover { color: var(--pl-topaz); } */
  }

  .stop-pin {
    /*
    background-color: var(--pl-champagne);
    border: 1px solid var(--pl-cocoa);
    */
    font-size: 10px;
  }

  .total {
    display: flex; width: 100%;
    text-align: right;
    padding: 4px 8px 4px 0;
    box-sizing: border-box;
    align-items: center;
    gap: 4px;

    .price, .dist, .dur { margin-left: 10px }
    .creator { text-align: left; padding-left: 8px; font-size: 90%; font-style: italic; color: var(--pl-aluminium); margin-right: 8px; }
    .lap-date { flex: 1; text-align: left; } /* venitatav koht; vahe peale creatori tuleb .creator margin-right-ist */
    .price { color: var(--pl-gray-olive); }
    .icon { width: 20px; max-width: 20px; margin: -2px 0px 0 0px; font-size: 18px; color: inherit; vertical-align: middle; }
    .icon:hover { color: var(--pl-deep-sea); }
  }

  ul.shp { max-height: 50%; list-style-type: none; }

  /* Absoluutne paigutus ruudustiku alas: inset 0 täidab ala täpselt, nii on kõrgus alati ala kõrgus ja
     nimekiri (ul) kerib ise. Ilma inset'ita oleks kõrgus sisu järgi ja pikk nimekiri voolaks alast välja. */
  div.heap {
    grid-area: heap;
    display: flex;
    position: absolute;
    inset: 0;
    flex-direction: column;

    ul { padding: 0; overflow-y: scroll; overflow-x: visible; flex: 1; min-height: 0; margin: 0; list-style-type: none; }
    li { width: 100%; }

    .hi  .heap-head { background-color: #FFA952AA; }
    .new .heap-head { background-color: #FFA952AA; }

    .heap-head {
      width: 100%;
      background-color: var(--pl-early-dawn);
      /* background: linear-gradient(180deg, var(--pl-salmon-pink) 0%, var(--pl-early-dawn) 25%, var(--pl-early-dawn) 60%, white 95%); */
      color: var(--pl-deep-brown); /* without it also pretty */
      letter-spacing: .8px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: nowrap;
      height: 2.8em;
      border-top: 1px solid var(--pl-gray-olive);
      border-top-left-radius: 9px; border-top-right-radius: 9px;
      user-select: none;
      box-sizing: border-box;
      position: relative; /* to attach "Uus ring" div here */
      scroll-behavior: smooth;
      transition: background-color 1.2s .1s;

      .more { width: 1.2em; text-align: right; padding-right: 4px; opacity: 0; cursor: pointer; outline: none; /* visibility: hidden; */ }
      &:hover .more, .more[menu-open] { opacity: 1 }   /* lahtioleku ajal on hiir kasti peal, mitte real */

      /* juhi lahter on ise flex-konteiner, et select oleks flex-laps ja tohiks (min-width 0) valitud nimest kitsamaks
         kahaneda -- tavalise lapsena ei kahane select alla oma sisu ja sõidab ajale selga */
      .driver { display: flex; min-width: 0; }
      .drv { flex: 0 1 auto; min-width: 0; max-width: 180px; }

      .drag { display: block; padding: 6px 2px; visibility: hidden; }

      .regnr { flex-grow: 1; padding: 4px 0 0 4px; vertical-align: bottom; }

      .dot { display: inline-block; margin: auto 4px; color: #8D92A5; }
      .delegated-icon { display: inline-block; min-width: 14px; text-align: center; margin-right: 4px; }
      &.combo .combo-visibility { margin-left: 22px; }
      &.carrier-lap .carrier-name { flex-grow: 1; padding: 6px 4px; font-weight: bold; }
      &.carrier-lap .icon.fwd-icon { margin-left: 8px; }
      .carrier-name { flex-grow: 0; padding: 6px 4px; }
      select.carrier-name { max-width: 180px; }
      /* .space hoiab vasakpoolsed (drag, jälgimise silm, vedaja) kokku ja lükkab seisu paremale */
      .lap-visibility, .combo-visibility { flex-shrink: 0; }
      .lapfwd-state {
        padding: 2px 8px;
        margin-left: 6px;
        margin-right: 6px;
        border-radius: 8px;
        font-size: 90%;
        background: #EAEAEB;
        color: #6b7280;
        white-space: nowrap;

        &.accepted { background: #d9f2dd; color: #16803c; }
        &.rejected { background: #fbdcdc; color: #b91c1c; }
      }
      /* lukus ringi muutmise katse: seisumärk tõmbab korraks tähelepanu */
      .lapfwd-nudge { animation: lapfwdNudge .5s ease-in-out; }
      .lapfwd-send {
        height: 22px;
        padding: 0 12px;
        margin-right: 6px;
        border: none;
        border-radius: 8px;
        background: var(--accent-orange, #F7A600);
        color: white;
        font-weight: bold;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
      }
      &.combo .fwd .has-lap .fwd-icon { border: 1px solid red; }
      &.combo .car { padding: 6px 4px 6px 24px; box-sizing: border-box; }
      &.combo .trailer { padding: 6px 4px 6px 32px; box-sizing: border-box; }
      &.combo .driver { padding: 6px 4px 6px 60px; box-sizing: border-box; min-width: 8em; }
      .car { width: 6em; max-width: 6em; white-space: nowrap; }
      .trailer { width: 6.5em;}
      .space { flex-grow: 1; }
      /* .more menu li:first-child { border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; } */

      &.has-lap:hover .drag { display: inline flow-root; cursor: grab; visibility: visible; }
      /* &.has-lap */ .more:hover menu { display: block; position: relative; }
      /* span.emoji { font-size: 18px; padding-top: -16px; margin-top: -7px; } endine laadimismanifest */
      /* Päise selectid (auto, haagis, juht, aeg): brauseri legacy select kastita ja läbipaistva taustaga, valik
         paremal. Laius tuleb valitud väärtusest (field-sizing), mitte nimekirja pikimast optionist -- muidu
         venitab üks pikk juhi nimi kõigi ringide päised nimekirjast laiemaks. Rippnimekiri on brauseri oma ja
         järgib selecti enda joondust: juhi select on fookuses (lahti) vasakule joondatud, et nimed nimekirjas
         oleksid vasakul -- valitud nimi hüppab selleks ajaks vasakule, see on teadlik hind. Autonumbrid on
         ühepikkused ja jäävad paremale ka lahti olles. */
      select {
        field-sizing: content;
        background-color: transparent;
        border: 0 none;
        color: inherit;
        padding: 6px 4px;
        text-align: right;
        &:focus { outline: none; }
        &.drv:focus { color: var(--pl-rhino); text-align: left; }
      }
      .act { width: 15px; }

      .lap-visibility, .combo-visibility {
        cursor: pointer;
        font-size: 18px;
        color: #D3D5DB;
        padding: 0 2px;
        transition: filter 0.15s ease;
        font-variation-settings: 'FILL' 1, 'wght' 700, 'GRAD' 0, 'opsz' 24;

        &:hover {
          filter: brightness(0.85);
        }

        &.active {
          color: #4860A9;
        }
      }
    }

    .lap-content {
      display: grid;
    }

    table.small-lap {
      margin-left: 4px;
      width: calc(100% - 4px);   /* koos td.adr max-width: 0-ga: aadress lõikab ellipsiga, tabel ei kasva nimekirjast laiemaks */
      user-select: none; /* rida on korraga lohistatav ja klõpsuga avatav -- tekstivalik jääks mõlemale jalgu */

      .up-here, .down-here { background-color: #f5f5f5; }

      td { padding: 5px 0px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
/*
      td.track-dots { background: url(track-dots.png); background-repeat: repeat-y; background-position: 2.5px -1px; background-size: 77%; padding-left: 4px;  }
      td.track-dots span { display: block; border: 2px solid var(--pl-aluminium); width: 10px; height: 10px; border-radius:50%; background-color:white; box-sizing: border-box; transform: translate(1px, 1px); }
      td.track-dots span.up-here { background-color: var(--a-color); }
      td.track-dots span.down-here { background-color: var(--b-color); }
*/
      td.drag-indicator { font-size: 20px; line-height: 20px; vertical-align: top; color: var(--pl-aluminium); cursor: grab; padding-left: 2px; overflow: visible; }
      /* Ikoon on veerust laiem ja paistab üle serva (nii td kui ikoon on overflow: visible) -- nii jääb
         veerg kitsaks ja ruum aadressile. Laius peab olema kirjas: hover'i peale ilmuv ikoon venitaks
         muidu veeru 20 pikslile. */
      td.drag-indicator * { display: none; position: relative; width: 12px; max-height: 6px; overflow: visible; }

      td:first-child { width: 12px; max-width: 12px; min-width: 12px; text-align: left; }
      /* Laius mahutab märgi ja neljakohalise arvu ("+123,4") ning hoiab veeru paigal -- auto table-layout
         võtaks laiuse kõige laiema lahtri järgi. ch käib fondi numbrilaiuse järgi (em mitte), nii et
         Tahoma puudumisel mahub ka asendusfondi laiem number. */
      td.ldm { font-family: Tahoma; width: 5.5ch; min-width: 5.5ch; white-space: nowrap; text-align: right; }
      td.ldm.pos { color: var(--pl-redwood); }
      td.ldm.neg { color: var(--pl-teal-green); }
      /* koguse veeru kuva muutmiseks, alamridadel pole. Paksus tuleb varjust: auto table-layout'is kasvataks font-weight veergu ja nihutaks rida */
      tr:not(.sub) td.ldm { cursor: pointer; &:hover { text-shadow: 0.03em 0 0 currentColor, -0.03em 0 0 currentColor; } }
      td.km  { width: 2em; min-width: 2em; white-space: nowrap; text-align: right; }
      td.adr { width: 100%; max-width: 0; padding-left: 12px; cursor: pointer; }   /* max-width 0: auto-layout lahter tohib nowrap-sisust kitsam olla */
      td.act {
        padding-right: 4px;
        white-space: nowrap;
        margin-left: 0;
        font-size: 14px;
        vertical-align: baseline;
        text-align: right;
        width: 28px;
        min-width: 28px;
        padding-left: 4px;
        .warn {
          transform: scale(1.2);
          color: var(--pl-neon-pink);
        }
      }

      tr.dragoverup  td { border-top: 1px solid #FFA600; padding-top: 4px; } /* full-width like lap-insert line */

      tr.dragoverdown td { border-bottom: 1px solid #FFA600; padding-bottom: 4px; } /* full-width like lap-insert line */

      tr.dragoverup.invalid td:nth-child(3),
      tr.dragoverup.invalid td:nth-child(4) { border-top: 1px dashed red; padding-top: 4px; }
      tr.dragoverdown.invalid td:nth-child(3),
      tr.dragoverdown.invalid td:nth-child(4) { border-bottom: 1px dashed red; padding-bottom: 4px; }

      span.dur { width: 5em; display: inline flow-root; }
      span.km { margin-right: 12px; }
      span.company { display: inline flow-root; margin-left: 6px; color: var(--pl-rhino); opacity: .5; white-space: nowrap; text-overflow: ellipsis; max-width: 100%; width: 0px; }
      /* ajaaken, sama kuju mis tellimuste tabelis */
      span.twin {
        flex-shrink: 0;
        font-size: 82%;
        border: 1px solid #B5A60035;
        background-color: #B5A60005;
        color: var(--pl-sahara);
        border-radius: 4px;
        padding: 0 3px;
        margin-left: 6px;
        line-height: 1.3;
        white-space: nowrap;
      }

      /* aeg jääb paremale joondatuks; lahter on sisu laiune (td.adr on 100%,
         seega width: 1% annab min-content) ja padding jääb mõlemas servas võrdne -- nii on
         tekst kasti sees keskel */
      td.time {
        box-sizing: border-box;
        width: 1%;
        padding: 5px .5em;
        text-align: right;
        opacity: .5;
      }

      td.time.pick {
        position: relative;
        z-index: 0; /* et mahuks teksti alla */
        opacity: 1;
        color: #E78F00DE;
        cursor: pointer;
      }

      td.time.pick.has-time { font-weight: bold; }

      td.time.pick::after {
        content: '';
        position: absolute;
        inset: 3px 0;
        z-index: -1;
        border: 1px solid transparent;
        border-radius: 4px;
        pointer-events: none;
      }
      td.time.pick:hover::after, td.time.pick:has(select:focus)::after {
        background-color: #FFF8DD;
        border-color: #FFA600;
      }
      /* nähtamatu select katab lahtri: klõpsuga avaneb nimekiri lahtri kohale */
      td.time.pick select.time {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        opacity: 0;
        border: 0;
        padding: 0;
        cursor: pointer;
      }

      /* õhk on pilli margin'is, mitte td.lbl padding'us: labelita real jääb lahter nulli laiuseks
         ja veerg kaob kaardilt, kus ühtegi labelit pole */
      span.time-label {
        animation: fadeInOpacity ease 1s;
        display: block;
        text-align: center;
        padding: 2px 3px;
        width: 3.2em;
        box-sizing: border-box;
        border-radius: 4px;
        font-size: 12px;
        color: white;
        border: 0px none;
        margin: -1px .5em;
      }
      span.done  { background-color: var(--pl-forest); }
      span.issue { background-color: var(--pl-neon-pink); }
      span.canceled { background-color: var(--pl-platinum); text-align: center; }
      span.half-done  { background-color: var(--pl); }
      
      span.time-label.clickable {
        cursor: pointer;
        transition: filter 0.15s ease;
      }
      span.time-label.clickable:hover {
        filter: brightness(1.15);
      }

      tr:hover {
        td.drag-indicator * {  display: block; }
      }

      tr.sub {
        height: 1.2em;
        td { padding-top: 0; padding-bottom: 0; font-size: 92%; }
        .adr { color: var(--pl-rhino); opacity: .6; }
/*
        .ldm {  }
        .track-dots span { border: 0 none; background-color: transparent; width: 6px; height: 6px; transform: translate(3px, 0); }
        .track-dots span.up-here { background-color: var(--a-color); }
        .track-dots span.down-here { background-color: var(--b-color); }
*/
      }

      /* multi-stop count */
      .count::before { content: " "; }
    }
  }

  div.selagg {
    font-size: 13px;
    display: flex;
    text-align: middle;
    align-items: center;
    cursor: default;
    .sum { /* background-color: #f7f7f7; padding: 3px 5px; */  border-radius: 6px; letter-spacing: .4px; padding-left: 8px; padding-right: 8px; padding-top: 1px; /* border: 1px solid var(--pl-eggshell); */ }

    .selected-count {
      padding-right: 8px;
      padding-left: 8px;
      padding-top: 1px;
      display: inline-flex;
      align-items: center;
      font-weight: 400;
      color: var(--pl-rhino);
      white-space: pre;
      line-height: 1;
    }

    .icon { 
      color: var(--pl-aluminium); 
      display: inline-flex; 
      align-items: center; 
      justify-content: center;
      margin-left: 4px;
      line-height: 1;
      cursor: pointer;
    }
    .icon:hover { color: var(--pl-rhino); }
    .opted { background-color: #FFA600; border-radius: 8px; color: white; }
  }


  .heap-control {
    display: flex; align-items: center;
    padding-left: 12px;
    padding-right: 8px;
    gap: 8px;
    position: relative;
    z-index: 1;
    input { padding: 2px 6px; outline: none; border-radius: 5px; border: 1px solid var(--pl-aluminium); }
    img { height: 20px; width: 20px; margin-left: 8px; cursor: pointer; }

    .visibility-filter-toggle {
      cursor: pointer;
      font-size: 20px;
      color: #D3D5DB;
      transition: filter 0.15s ease;
      margin-left: auto;
      font-variation-settings: 'FILL' 1, 'wght' 700, 'GRAD' 0, 'opsz' 24;

      &:hover {
        filter: brightness(0.85);
      }

      &.active {
        color: #4860A9;
      }
    }
  }

  .gps-marker {
    font-size: 16px;
    padding: 0px 4px;
    background-color: #FFFFFF;
    color: #504639;
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    border: 1px solid #504639;
    text-align: center;
    border-radius: 4px;
  }
  .gps-marker.hi {
    background-color: var(--pl-pale-rose);
    color: var(--pl-dark-gray);
  }

  .out-of-bounds-info {
    background-color: #F5AD31;
    color: white;
    font-weight: bold;
    padding: 4px 6px;
    border-radius: 4px;
    transform: translateY(50%);
  }

  /* Infinity button styles */
  .infinity-button {
    width: auto;
    min-width: 24px;
    height: 24px;
    border-radius: 8px;
    padding: 6.5px 4px 6.5px 6.5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    gap: 4px;
    border: 0.85px solid #ddd;
    background-color: transparent;

    &.active {
      border-color: #FFA600;
      background-color: #FFF8DD;
    }

    .msymbol {
      color: #263E50;
      font-size: 12px;
    }

    .badge {
      background-color: #FFA600;
      color: white;
      font-size: 10px;
      font-weight: 700;
      padding: 4px 6px;
      border-radius: 4px;
      line-height: 1;
      min-width: 14px;
      text-align: center;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
  }
}

/* Done time editor popup */
.done-time-editor-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
}

.done-time-editor-container {
  position: absolute;
  z-index: 1000;
}

.done-time-editor {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.08);
  padding: 12px;
  min-width: 280px;
  font-size: 13px;
  
  .editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
    
    .title {
      font-weight: 600;
      color: #333;
    }
    
    .msymbol.close {
      cursor: pointer;
      font-size: 16px;
      color: #999;
      
      &:hover {
        color: #333;
      }
    }
  }
  
  .mode-toggle {
    margin-bottom: 10px;
    padding: 6px 8px;
    background: #f8f9fa;
    border-radius: 6px;
    
    label:has(> .check) {
      font-size: 12px;
      color: #555;
    }
  }
  
  .edit-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    
    &:last-child {
      margin-bottom: 0;
    }
    
    
    .row-label {
      font-size: 11px;
      color: #666;
      min-width: 50px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    
    input[type=date],
    input[type=time] {
      padding: 6px 8px;
      border: 1px solid #ddd;
      border-radius: 6px;
      font-size: 12px;
      background: white;
      transition: border-color 0.15s ease, box-shadow 0.15s ease;
      
      &:focus {
        outline: none;
        border-color: #FFA600;
        box-shadow: 0 0 0 3px rgba(255, 166, 0, 0.15);
      }
    }
    
    input[type=date] {
      width: 120px;
    }
    
    input[type=time] {
      width: 80px;
    }
    
    .save-btn {
      padding: 6px 10px;
      border: none;
      border-radius: 6px;
      cursor: pointer;
      font-size: 12px;
      font-weight: 600;
      background: #FFA600;
      color: white;
      transition: background 0.15s ease;
      
      &:hover {
        background: #e69500;
      }
    }
  }
}


@keyframes lapfwdNudge {
  0%, 100% { transform: scale(1);    filter: none; }
  35%      { transform: scale(1.14); filter: brightness(.88) saturate(1.2); }
  70%      { transform: scale(.99);  filter: brightness(.94); }
}

/* Juhile teavituse dialoog (plan.js driverNotifyDialog): kast on top-layeris, mitte lehe sees, seepärast omaette juur. */
dialog.plan.driver-notify {
  input[type="text"] { width: 100%; box-sizing: border-box; padding: 6px 8px; border: 1px solid var(--pl-gray-olive); border-radius: 4px; outline: 0 none; background: #fff; }
  input[type="text"]:focus { border-color: #FFA600; background: #FFF8DD; }
}
