/* ILECO III — colours, header, menu and office tiles copied from i-Assist.
   Loaded on every page EXCEPT the login page (that page keeps its own look).
   Palette: --y yellow #ffc72c, --y2 orange #f4ae3c, --navy #14213d, --cream #fff6dc, --ink #1c2233, --mut #5b6275. */

:root {
  --navy: #14213d;
  --ink: #1c2233;
  --ink-soft: #5b6275;
  --amber: #ffc72c;
  --amber-deep: #8a5a00;
  --amber-tint: #fff3c9;
  --paper: #fff6dc;
  --line: #eadca8;
  --radius: 14px;
  --y: #ffc72c;
  --y2: #f4ae3c;
  --cream: #fff6dc;
}
body {
  background: var(--cream);
  color: var(--ink);
}
body.amber {
  background: var(--cream);
}

/* ---- the header: the yellow-to-orange band of i-Assist ---- */
header.top,
header.letterhead {
  background: linear-gradient(100deg, #ffd24c 0%, #ffc72c 55%, #f4ae3c 100%);
  color: var(--navy);
  box-shadow: 0 2px 10px #0002;
  border-bottom: 0;
}
header.top .brand,
header.letterhead .brand h1,
header.top .brand span {
  color: var(--navy);
}
header.letterhead .brand p,
header.letterhead .meta,
header .meta,
header.top .tag {
  color: rgba(20, 33, 61, 0.75);
}
header.letterhead .meta strong {
  color: var(--navy);
}
header .meta a,
header.letterhead .meta a {
  color: var(--navy);
  text-decoration: underline;
  font-weight: 700;
}
footer.foot {
  background: var(--navy);
  color: #ffe27a;
}
footer.foot a {
  color: #fff;
}
thead th {
  background: var(--navy);
}

/* ---- the menu: the same slide-down panel and sliding letters as i-Assist (PLAIN and GLASS) ---- */
nav.rail {
  background: linear-gradient(180deg, #ffd35f, #ffe49a);
}
nav.rail button,
nav.rail a {
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
  color: var(--navy);
  transition:
    background 0.22s ease,
    box-shadow 0.22s ease,
    color 0.22s ease,
    margin 0.18s ease,
    padding 0.18s ease;
}
nav.rail button.active {
  overflow: visible;
  background: var(--navy);
  color: var(--y);
}
nav.rail .lbl {
  position: relative;
  z-index: 2;
  display: grid;
  flex: 1;
  min-width: 0;
}
nav.rail .orig,
nav.rail .ltr,
.office .orig,
.office .ltr {
  grid-area: 1/1;
  display: block;
  font-style: normal;
}
nav.rail .orig,
.office .orig {
  transition:
    transform 0.3s cubic-bezier(0.87, 0, 0.13, 1),
    opacity 0.3s;
}
nav.rail .ltr,
.office .ltr {
  color: #fff;
  pointer-events: none;
}
nav.rail .ltr .w,
.office .ltr .w {
  display: inline-block;
  white-space: nowrap;
}
nav.rail .ltr .lt,
.office .ltr .lt {
  display: inline-block;
  opacity: 0;
  transform: translateY(calc(var(--s, -1) * 15px));
  transition:
    transform 0.3s cubic-bezier(0.87, 0, 0.13, 1),
    opacity 0.3s;
}
nav.rail .nav-ico {
  position: relative;
  z-index: 2;
  transition:
    transform 0.18s ease,
    color 0.3s;
}
nav.rail .nav-badge {
  position: relative;
  z-index: 2;
}
nav.rail .tag {
  position: relative;
  z-index: 2;
}
/* the dark panel that slides down over an item */
.pan {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(20, 33, 61, 0.92), rgba(40, 66, 122, 0.8));
  transform: translateY(calc(-100% - 2px));
  visibility: hidden;
  transition:
    transform 0.3s cubic-bezier(0.87, 0, 0.13, 1),
    visibility 0s linear 0.3s;
}
nav.rail button.active > .pan {
  display: none;
}
.office .nm {
  position: relative;
  z-index: 2;
  display: grid;
}
.office .detail,
.office .go,
.office .pend {
  position: relative;
  z-index: 2;
  transition: color 0.3s;
}

@media (hover: hover) {
  nav.rail button:not(.active):hover > .pan,
  nav.rail button:not(.active):focus-visible > .pan,
  nav.rail a:hover > .pan,
  nav.rail a:focus-visible > .pan,
  .office:hover > .pan,
  .office:focus-visible > .pan {
    transform: translateY(0);
    visibility: visible;
    transition:
      transform 0.3s cubic-bezier(0.87, 0, 0.13, 1),
      visibility 0s;
  }
  nav.rail button:not(.active):hover .orig,
  nav.rail button:not(.active):focus-visible .orig,
  nav.rail a:hover .orig,
  nav.rail a:focus-visible .orig,
  .office:hover .orig,
  .office:focus-visible .orig {
    transform: translateY(100%);
    opacity: 0;
  }
  nav.rail button:not(.active):hover .lt,
  nav.rail button:not(.active):focus-visible .lt,
  nav.rail a:hover .lt,
  nav.rail a:focus-visible .lt,
  .office:hover .lt,
  .office:focus-visible .lt {
    opacity: 1;
    transform: translateY(0);
    transition-delay: calc(var(--i, 0) * 0.022s);
  }
  nav.rail button:not(.active):hover .nav-ico,
  nav.rail button:not(.active):focus-visible .nav-ico,
  nav.rail a:hover .nav-ico {
    color: #fff;
    transform: translateY(-1px) scale(1.08);
  }
  .office:hover .detail,
  .office:focus-visible .detail {
    color: rgba(255, 255, 255, 0.85);
  }
  .office:hover .go,
  .office:focus-visible .go {
    color: #fff;
  }
  /* the menu buttons EXPAND a little when the pointer is on them (the other items do not move) */
  nav.rail button:hover,
  nav.rail button:focus-visible,
  nav.rail a:hover,
  nav.rail a:focus-visible {
    z-index: 2;
    margin-block: -6px;
    padding-block: calc(var(--py, 12px) + 6px);
  }
  nav.rail button:hover:active,
  nav.rail a:hover:active {
    margin-block: -3px;
    padding-block: calc(var(--py, 12px) + 3px);
  }
}
@media (hover: hover) and (min-width: 861px) {
  nav.rail button:hover,
  nav.rail button:focus-visible,
  nav.rail a:hover,
  nav.rail a:focus-visible {
    margin-inline: -8px;
    padding-inline: calc(var(--px, 12px) + 8px);
  }
  nav.rail button:hover:active,
  nav.rail a:hover:active {
    margin-inline: -4px;
    padding-inline: calc(var(--px, 12px) + 4px);
  }
}
nav.rail button:active,
nav.rail a:active {
  transform: scale(0.98);
}
nav.rail button:focus-visible,
nav.rail a:focus-visible {
  outline: none;
}

/* ---- the four offices: the tiles of i-Assist (white, navy border; frosted glass in GLASS) ---- */
a.card.office {
  position: relative;
  overflow: hidden;
  text-align: center;
  background: #fff;
  border: 2px solid var(--navy);
  border-top: 2px solid var(--navy);
  border-radius: 14px;
  padding: 22px;
  box-shadow: none;
  transition: box-shadow 0.25s ease;
}
a.card.office:hover,
a.card.office:focus-visible {
  transform: none;
  box-shadow: 0 12px 30px rgba(20, 33, 61, 0.22);
}
a.card.office h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 6px;
}
a.card.office .detail {
  margin-bottom: 12px;
}
a.card.office .go {
  justify-content: center;
}
.office .chip {
  background: var(--navy);
  color: var(--y);
}
html[data-tema='glass'] a.card.office {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0.26)) !important;
  -webkit-backdrop-filter: blur(18px) saturate(1.7);
  backdrop-filter: blur(18px) saturate(1.7);
  border: 1px solid rgba(255, 255, 255, 0.88) !important;
  border-radius: 22px;
  box-shadow:
    0 14px 34px rgba(110, 55, 0, 0.18),
    inset 0 2px 0 rgba(255, 255, 255, 0.85),
    inset 0 -2px 0 rgba(255, 255, 255, 0.3) !important;
}
/* a phone for the field crew keeps its own layout */
html.field-mode a.card.office {
  text-align: left;
  padding: 20px;
}
html.field-mode a.card.office .nm {
  grid-area: t;
}
html.field-mode a.card.office h3 {
  font-size: 20px;
}
html.field-mode a.card.office .go {
  justify-content: flex-start;
}

@media (prefers-reduced-motion: reduce) {
  nav.rail button,
  nav.rail a,
  .pan,
  .office .orig,
  .office .lt,
  nav.rail .orig,
  nav.rail .lt {
    transition: none;
  }
  nav.rail button:hover,
  nav.rail a:hover {
    margin: 0;
    padding-block: var(--py, 12px);
    padding-inline: var(--px, 12px);
  }
}

/* =====================================================================================================
   THE MENU (as in i-Assist): the word MENU on top (centred); on a PC / laptop / tablet the items always keep their FULL size
   (they are never squeezed by a small or short window): text 15 px, icons 22 px, about 48 px apart, as in the first version of the menu; a phone gets a row of tabs (icon above the name).
   The menu has a FIXED SIZE (see the last block "FIXED SIZE MENU"): the same width and height in PLAIN and GLASS and in every window.
   ===================================================================================================== */
.shell {
  display: grid;
  grid-template-columns: 262px minmax(0, 1fr);
  gap: 0;
  padding: 0;
  align-items: stretch;
}
.shell > main {
  min-width: 0;
  max-width: none;
}
nav.rail {
  width: auto;
  align-self: stretch;
  position: static;
  overflow: visible;
  gap: 4px;
  padding: 18px 16px;
}
nav.rail::before {
  content: 'MENU';
  display: block;
  text-align: center;
  margin: 2px 6px 8px;
  padding: 2px 8px 10px calc(8px + 0.26em);
  font:
    800 13px 'Segoe UI',
    system-ui,
    sans-serif;
  letter-spacing: 0.26em;
  color: rgba(20, 33, 61, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 1px 0 rgba(120, 70, 0, 0.1);
}
nav.rail button,
nav.rail a {
  --py: 11px;
  --px: 12px;
  padding: var(--py) var(--px);
  gap: 10px;
  font-size: 15px;
  white-space: nowrap;
}
nav.rail button > .lbl,
nav.rail a > .lbl {
  white-space: nowrap;
}
nav.rail .nav-ico {
  width: 22px;
  height: 22px;
  margin-right: 0;
}

/* the glass menu */
html[data-tema='glass'] nav.rail {
  gap: 4px;
  padding: 18px 16px;
  margin-block: 14px;
  top: 14px;
}
@media (max-height: 560px) and (min-width: 761px) {
  html[data-tema='glass'] nav.rail {
    position: static;
  }
}

/* between a tablet and a phone the older rules of the pages must not turn the menu into a row */
@media (max-width: 880px) and (min-width: 761px) {
  nav.rail {
    width: auto;
    flex-direction: column;
    overflow-x: visible;
    flex-wrap: nowrap;
  }
}

/* a phone: the menu is a row of tabs, the icon above the name, like the bar of an app */
@media (max-width: 760px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }
  nav.rail,
  html[data-tema='glass'] nav.rail {
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: stretch;
    gap: 6px;
    padding: 8px;
    overflow: visible;
    max-height: none;
  }
  nav.rail::before {
    flex: 0 0 100%;
    margin: 0 2px 2px;
    padding: 2px 6px 6px calc(6px + 0.3em);
    font-size: 11px;
    letter-spacing: 0.3em;
  }
  nav.rail button,
  nav.rail a {
    --py: 8px;
    --px: 4px;
    flex: 1 1 74px;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    font-size: 12.5px;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
  }
  nav.rail .lbl {
    justify-items: center;
    text-align: center;
  }
  nav.rail button > .lbl,
  nav.rail a > .lbl {
    white-space: normal;
    overflow-wrap: anywhere;
    flex: 0 1 auto;
  }
  nav.rail .nav-ico {
    width: 25px;
    height: 25px;
  }
  nav.rail .nav-badge {
    position: absolute;
    top: 3px;
    right: 6px;
    margin: 0;
    min-width: 18px;
    height: 18px;
    font-size: 10px;
  }
  nav.rail .tag {
    display: none;
  }
  .shell > main {
    padding: 14px;
  }
}

/* as in i-Assist: the page never scrolls sideways */
html,
body {
  overflow-x: hidden;
}

/* ---- office picker: the email and "Open this office's log" slide in letter by letter after the name ---- */
.office .detail {
  display: grid;
  justify-items: center;
}
.office .go .tx {
  position: relative;
  z-index: 2;
  display: grid;
}
@media (hover: hover) {
  .office:hover .detail .lt,
  .office:focus-visible .detail .lt {
    transition-delay: calc((var(--i, 0) + 8) * 0.022s);
  }
  .office:hover .go .lt,
  .office:focus-visible .go .lt {
    transition-delay: calc((var(--i, 0) + 16) * 0.022s);
  }
  .office:hover .detail .orig,
  .office:focus-visible .detail .orig {
    transition-delay: 0.04s;
  }
  .office:hover .go .orig,
  .office:focus-visible .go .orig {
    transition-delay: 0.08s;
  }
}
html.field-mode a.card.office .detail {
  justify-items: start;
}

/* the field crew's header is the yellow band now: its "Log out" must be dark, not yellow */
.fieldbar .out {
  color: var(--navy);
  text-decoration: underline;
}
.fieldbar .who,
.fieldbar .role {
  color: var(--navy);
}

/* ---- the chart switch of i-Assist: Vertical | Horizontal | 3D Pie ---- */
.chart-seg {
  display: inline-flex;
  margin: 2px 0 10px;
  border: 1px solid var(--navy);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  max-width: 100%;
  flex-wrap: wrap;
}
.chart-seg button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--navy);
  padding: 7px 12px;
  font:
    700 12.5px 'Segoe UI',
    system-ui,
    sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.2s,
    color 0.2s;
}
.chart-seg button + button {
  border-left: 1px solid rgba(20, 33, 61, 0.3);
}
.chart-seg button:hover {
  background: rgba(255, 199, 44, 0.35);
}
.chart-seg button[aria-pressed='true'] {
  background: var(--navy);
  color: var(--y, #ffc72c);
}
.chart-seg button:focus-visible {
  outline: 2px solid #1f6bff;
  outline-offset: -2px;
}
@media (max-width: 520px) {
  .chart-seg button {
    padding: 7px 9px;
    font-size: 12px;
  }
}
@media print {
  .chart-seg {
    display: none;
  }
}

/* ---- the office of the user: his own tile is marked, the others are locked (index.html) ---- */
a.card.office.lock {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
  filter: grayscale(0.4);
}
a.card.office.lock .go {
  display: none;
}
a.card.office .own,
a.card.office .notmine {
  position: relative;
  z-index: 2;
  display: inline-block;
  margin-top: 8px;
  padding: 2px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
a.card.office .own {
  background: #fff3cd;
  color: #8a5a00;
}
a.card.office .notmine {
  background: #eee6cc;
  color: var(--ink-soft, #5b6275);
}
a.card.office.mine:hover .own {
  background: #ffc72c;
  color: #14213d;
}

/* ---- the duplicate warning of the Log form ---- */
.dup-dlg {
  width: min(520px, 94vw);
  max-height: 90vh;
  padding: 0;
  border: 0;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(20, 33, 61, 0.45);
  color: var(--ink, #1c2233);
}
.dup-dlg::backdrop {
  background: rgba(20, 33, 61, 0.55);
  backdrop-filter: blur(2px);
}
.dup-dlg form {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 90vh;
  overflow: auto;
}
.dup-dlg h3 {
  margin: 0;
  font-size: 21px;
  color: var(--navy, #14213d);
}
.dup-dlg h3::before {
  content: '\26A0';
  margin-right: 8px;
  color: #d98b00;
}
.dup-lead {
  margin: 0;
  color: var(--ink-soft, #5b6275);
  font-size: 14.5px;
}
.dup-list {
  display: grid;
  gap: 8px;
}
.dup-card {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff8e1;
  border: 1px solid #f0d98a;
  font-size: 13.5px;
}
.dup-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.dup-top b {
  color: var(--navy, #14213d);
}
.dup-date {
  color: var(--ink-soft, #5b6275);
  font-size: 12.5px;
}
.dup-name {
  font-weight: 700;
  margin-top: 2px;
}
.dup-adres,
.dup-type {
  color: var(--ink-soft, #5b6275);
}
.dup-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.dup-chip {
  padding: 2px 10px;
  border-radius: 99px;
  background: #ffd24c;
  color: #5c4400;
  font-size: 11.5px;
  font-weight: 800;
}
.dup-more {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-soft, #5b6275);
}
.dup-ask {
  margin: 4px 0 0;
  font-weight: 700;
  color: var(--navy, #14213d);
}
.dup-butones {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.dup-butones .btn {
  padding: 11px 16px;
  border-radius: 10px;
  font:
    700 14.5px 'Segoe UI',
    system-ui,
    sans-serif;
  cursor: pointer;
}
.dup-no {
  background: #fff;
  color: var(--navy, #14213d);
  border: 2px solid var(--navy, #14213d);
}
.dup-yes {
  background: var(--navy, #14213d);
  color: var(--y, #ffc72c);
  border: 2px solid var(--navy, #14213d);
}

/* the page subtitles (the short description under a page title) are for the Admin only */
html.role-office .page-sub,
html.role-field .page-sub,
html.role-office .hero p.pick-note,
html.role-field .hero p.pick-note {
  display: none !important;
}

/* =====================================================================================================
   FIXED SIZE MENU (PC / laptop / tablet): 234 px wide and as tall as its items, the same in PLAIN and in GLASS and in
   every window. It is never squeezed and never scrolls inside itself. A window that is shorter than the menu scrolls the
   PAGE; a tall screen (960 px or more) shows the whole menu and keeps it in view. Under the menu there is room for the
   toolbar (bottom-left corner), so the last items can be scrolled above it.
   ===================================================================================================== */
@media (min-width: 761px) {
  nav.rail,
  html[data-tema='glass'] nav.rail {
    box-sizing: border-box;
    width: 234px;
    min-width: 234px;
    max-width: 234px;
    height: auto;
    max-height: none;
    overflow: visible;
    margin: 14px;
    align-self: start;
    position: static;
    border-width: 1px;
    border-style: solid;
    border-color: transparent; /* PLAIN gets the invisible border that GLASS has, so both are exactly the same size */
  }
}
@media (min-width: 761px) and (min-height: 960px) {
  nav.rail,
  html[data-tema='glass'] nav.rail {
    position: sticky;
    top: 14px;
  }
}
@media (min-width: 761px) and (max-height: 959px) {
  nav.rail,
  html[data-tema='glass'] nav.rail {
    margin-bottom: 150px;
  }
}
