/* bottom-nav.css — the phone tab bar, and the bottom sheet (core/sheet.js).
 *
 * Tab bar (≤600px): EUDR phone-kit.css "Tab bar" at its exact scale — full
 * width, solid green-900 chrome, 60px plus the home indicator, 20px icons
 * (stroke 1.7, 2.1 when active), 10.5px/700 labels (gone under 360px). The
 * inactive ink is the OPAQUE --chrome-dim (crossing strokes never double);
 * the active tab, and a group tab while its sheet is open, is sage
 * (--highlight). core/bottomnav.js builds it from the rendered sidebar.
 *
 * Sheet (every width; the phone uses it by convention): EUDR's kit sheet
 * with ChemTrust's engine (core/sheet.js) — fixed at z 3000 over the scrim
 * (the only blur: 4px), a solid panel up to 88dvh rising in 0.28s, a 56px
 * head with the title centred and Done in the tint, a grabber hinting the
 * drag; the body scrolls on its own, the page under it is locked.
 * Then the tab bar's own sheets (More, a group, Account): EUDR's More sheet.
 *
 * --tabbar-h is THE tab bar height: mobile.css and phone-kit.css read it
 * (the save bar, the toasts, the cookie bar, the bell panel).
 *
 * No colour literals (tokens.css; dark.css flips what flips). No
 * backdrop-filter on the bar or a panel, only the scrim.
 * z-index: tab bar 1500 · toasts 1600 · bell panel 2000 · Back 2650 ·
 * sheet 3000 · action veil 3050 · menus 3100 · dialogs 3200+. */

:root {
  --tabbar-h: 60px; /* the bar's own height, above the home indicator */
  --ct-tabbar-h: var(--tabbar-h); /* the old name */
}

/* Desktop and tablet never see the bar. */
.ct-bottomnav {
  display: none;
}

@media (max-width: 600px) {
  /* ═══════════════════════════ Tab bar ═══════════════════════════ */
  .ct-bottomnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1500;
    display: flex;
    align-items: stretch;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding: 0 max(4px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px)
      max(4px, env(safe-area-inset-left, 0px));
    background: var(--chrome-bg);
    border-top: 0.5px solid var(--chrome-line);
    font-family: var(--font-sans);
  }
  body[data-public-page] .ct-bottomnav {
    display: none;
  }

  .ct-bottomnav__item {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    height: var(--tabbar-h);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    margin: 0;
    padding: 0 2px;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--chrome-dim);
    font: inherit;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 12px;
    letter-spacing: 0;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
  }
  /* :hover re-stated so the global a:hover can't paint a tab; a tap leaves
     :hover stuck on touch. */
  .ct-bottomnav__item:hover {
    color: var(--chrome-dim);
  }
  .ct-bottomnav__item--active,
  .ct-bottomnav__item--active:hover,
  .ct-bottomnav__item[aria-expanded="true"],
  .ct-bottomnav__item[aria-expanded="true"]:hover {
    color: var(--highlight);
  }
  @media (hover: hover) {
    .ct-bottomnav__item:hover:not(.ct-bottomnav__item--active):not([aria-expanded="true"]) {
      color: var(--chrome-sec);
    }
  }
  .ct-bottomnav__item:active {
    opacity: 0.6;
  }
  .ct-bottomnav__item:focus-visible {
    outline: 2px solid var(--highlight);
    outline-offset: -4px;
    border-radius: var(--radius-sm);
  }

  .ct-bottomnav__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
  }
  .ct-bottomnav__icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 1.7;
  }
  .ct-bottomnav__item--active .ct-bottomnav__icon svg {
    stroke-width: 2.1;
  }
  .ct-bottomnav__label {
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  /* A count on a one-page tab, on the icon's corner; a dot on a group with a
     count inside. Sage with deep-green ink, as the band's badges. */
  .ct-bottomnav__badge {
    position: absolute;
    top: 7px;
    right: calc(50% - 20px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: var(--radius-pill);
    background: var(--highlight);
    color: var(--highlight-ink);
    font-size: 10px;
    font-weight: 800;
    line-height: 16px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
  }
  .ct-bottomnav__badge--dot {
    top: 10px;
    right: calc(50% - 13px);
    min-width: 0;
    width: 8px;
    height: 8px;
    padding: 0;
  }
}

/* The narrowest phones: icons only (a label cut to two letters says nothing). */
@media (max-width: 360px) {
  .ct-bottomnav__label {
    display: none;
  }
}

/* ═══════════════════════════ The sheet ═══════════════════════════ */
.ph-sheet {
  position: fixed;
  inset: 0;
  z-index: 3000;
}
/* While it slides away, a closing sheet never swallows a tap. */
.ph-sheet:not(.is-open) {
  pointer-events: none;
}
/* The page under an open sheet stays where it is. */
html.ph-sheet-lock {
  overflow: hidden !important;
}
.ph-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  touch-action: none;
  transition: opacity 0.2s ease-out;
}
.ph-sheet.is-open .ph-sheet-backdrop {
  opacity: 1;
}

.ph-sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  max-height: 88dvh;
  margin: 0 auto;
  padding: 0 env(safe-area-inset-right, 0px) calc(16px + env(safe-area-inset-bottom, 0px))
    env(safe-area-inset-left, 0px);
  border-radius: 12px 12px 0 0;
  background: var(--m-sheet, var(--glass-strong));
  box-shadow: inset 0 0.5px 0 var(--glass-edge), 0 -10px 30px rgb(var(--storm-rgb) / 0.16);
  color: var(--m-ink, var(--text));
  font-family: var(--m-font, var(--font-sans));
  letter-spacing: -0.01em;
  outline: none;
  transform: translateY(100%);
  transition: transform 0.2s cubic-bezier(0.4, 0, 1, 1);
}
.ph-sheet.is-open .ph-sheet-panel {
  transform: none;
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ph-sheet-panel.is-dragging {
  transition: none !important;
}
/* A picker that filters (a search above many rows) keeps its height. */
.ph-sheet-panel--tall {
  height: 88dvh;
}

/* The head: drag it down to dismiss. The title centred on up to two lines,
   clear of a longer Done ("Ακύρωση"). */
.ph-sheet-head {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 16px 96px 10px;
  touch-action: none;
  cursor: grab;
}
.ph-sheet-grab {
  position: absolute;
  top: 6px;
  left: 50%;
  width: 36px;
  height: 5px;
  margin-left: -18px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
}
.ph-sheet-title {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: inherit;
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-align: center;
  overflow-wrap: anywhere;
  text-wrap: balance;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.ph-sheet-done {
  position: absolute;
  top: 9px;
  right: max(8px, env(safe-area-inset-right, 0px));
  min-width: 44px;
  height: 44px;
  margin: 0;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--m-tint, var(--link));
  font: 700 17px/1 var(--m-font, var(--font-sans));
  cursor: pointer;
}
.ph-sheet-done:hover {
  color: var(--m-tint, var(--link));
}
.ph-sheet-done:active {
  opacity: 0.55;
}
.ph-sheet-done:focus-visible {
  outline: 2px solid var(--m-focus, var(--focus));
  outline-offset: -2px;
}
.ph-sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  padding-bottom: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ══════════════ The tab bar's sheets: a group, More, Account ══════════════
   EUDR's More sheet: the section's name as the group heading, 52px rows at
   17/600 with quiet icons, the page in view on a soft fill, Log out red and
   last, the legal line quiet at the foot. */
.ct-sheet__group {
  margin: 0 8px;
}
.ct-sheet__group + .ct-sheet__group {
  margin-top: 12px;
}
.ct-sheet__label {
  padding: 12px 14px 6px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.ct-sheet__group:first-child .ct-sheet__label {
  padding-top: 0;
}
.ct-sheet__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* A page row (and Log out): icon, label, badge, chevron. */
.ct-sheet__row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ct-sheet__row:hover {
  color: var(--text);
}
@media (hover: hover) {
  .ct-sheet__row:hover:not(.is-current) {
    background: var(--surface-2);
  }
}
.ct-sheet__row:active,
.ct-sheet__row.is-current {
  background: color-mix(in srgb, var(--brand-storm) 7%, transparent);
}
body.dark-mode .ct-sheet__row:active,
body.dark-mode .ct-sheet__row.is-current {
  background: color-mix(in srgb, var(--brand-cyan) 14%, transparent);
}
.ct-sheet__row:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}
.ct-sheet__row.is-current .ct-sheet__icon {
  color: var(--link);
}
.ct-sheet__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  color: var(--text-muted);
}
.ct-sheet__icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 1.8;
}
.ct-sheet__text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.ct-sheet__badge {
  flex: none;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--radius-pill);
  background: var(--highlight);
  color: var(--highlight-ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 22px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.ct-sheet__chev {
  display: inline-flex;
  flex: none;
  width: 14px;
  height: 14px;
  color: color-mix(in srgb, var(--text) 30%, transparent);
}
.ct-sheet__chev svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.6;
}
/* Log out in red, its icon too (--confirmed: dark.css lightens it). */
.ct-sheet__row--danger,
.ct-sheet__row--danger:hover,
.ct-sheet__row--danger .ct-sheet__icon {
  color: var(--confirmed);
}

/* ── Account sheet ── */
.ct-sheet__who {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 8px;
  padding: 0 14px 10px;
}
.ct-sheet__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--action);
  color: var(--action-ink);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.ct-sheet__who-text {
  min-width: 0;
}
.ct-sheet__who-name {
  display: block;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.ct-sheet__who-email {
  display: block;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.ct-sheet__facts {
  margin: 0 22px 4px;
}
.ct-sheet__fact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  border-top: 0.5px solid var(--border-strong);
  font-size: 15px;
}
.ct-sheet__fact dt {
  flex: none;
  color: var(--text-muted);
}
.ct-sheet__fact dd {
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

/* Language and appearance: a label with a two-way segmented control. */
.ct-sheet__setting {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 4px 14px;
}
.ct-sheet__setting-label {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  font-size: 17px;
  font-weight: 600;
}
.ct-sheet__seg {
  display: inline-flex;
  flex: none;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--brand-storm) 8%, transparent);
}
body.dark-mode .ct-sheet__seg {
  background: color-mix(in srgb, var(--brand-cyan) 14%, transparent);
}
.ct-sheet__seg-btn {
  min-width: 64px;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}
.ct-sheet__seg-btn[aria-pressed="true"] {
  background: var(--action);
  color: var(--action-ink);
  font-weight: 700;
}
.ct-sheet__seg-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

/* The footer's Privacy · Terms and copyright, quiet at the foot. */
.ct-sheet__legal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin-top: 6px;
  padding: 0 14px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
}
.ct-sheet__legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}
.ct-sheet__legal a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 2px;
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none;
}
.ct-sheet__legal a + a::before {
  content: "\00b7";
  padding: 0 8px;
  color: var(--text-muted);
}
.ct-sheet__legal a:hover,
.ct-sheet__legal a:active {
  color: var(--text);
  text-decoration: underline;
}

/* The sheet rises and the scrim fades; without motion they simply appear. */
@media (prefers-reduced-motion: reduce) {
  .ph-sheet-panel,
  .ph-sheet.is-open .ph-sheet-panel,
  .ph-sheet-backdrop {
    transition: none !important;
  }
}
