/* Count entry laid out like the clinics' sheet: full boxes x units per box (one line per box format),
   then + loose units = total */
.calc { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.calc__row { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.calc__f { margin-bottom: 0; width: 118px; }
.calc__f .input { padding: 0 10px; }
.calc__op { padding-bottom: 12px; color: var(--text-faint); font-weight: 500; font-size: var(--fs-md); }
.calc__remove { align-self: flex-end; margin-bottom: 2px; flex-shrink: 0; }
.calc__add { margin-left: -8px; }
.calc__total { display: flex; flex-direction: column; gap: 6px; min-width: 104px; }
.calc__total-label { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.03em; font-weight: 500; color: var(--text-muted); }
.calc__total-value { display: flex; align-items: center; height: 44px; font-size: var(--fs-md); font-weight: 600; color: var(--text); }
.calc__total-value.is-empty { color: var(--text-faint); font-weight: 400; }
.count-row .field label.calc__label, .calc .field label { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.03em; }
.count-row__last { font-size: var(--fs-xs); color: var(--text-faint); margin-top: 2px; }
@media (max-width: 560px) {
  .calc__f { width: calc(50% - 22px); min-width: 108px; }
  .calc__total { min-width: 0; flex: 1; }
  /* the "ask for a new minimum" button goes under the title instead of squeezing it */
  .count-row__head { flex-wrap: wrap; }
  .count-row__title { flex: 1 1 0; min-width: 0; }
  .count-row__request { flex: 1 0 100%; align-self: flex-start; margin-left: 52px; padding-left: 0; justify-content: flex-start; }
}

/* Search bar of the count form (stays under the top bar while the list scrolls) and the check mark of a counted line */
.count-search {
  position: sticky; top: var(--topbar-h); z-index: 3; margin: 0 0 12px; padding: 8px 0 10px;
  background: var(--bg); display: flex; flex-direction: column; gap: 6px;
}
.count-search__row { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.count-search__row .count-search__field { flex: 1 1 260px; }
.count-search__category { flex: 0 1 260px; min-width: 0; }
@media (max-width: 560px) {
  .count-search__category { flex: 1 1 160px; }
}
.count-search__field { position: relative; display: flex; align-items: center; }
.count-search__field .input { padding-left: 42px; padding-right: 44px; }
.count-search__field input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
.count-search__icon { position: absolute; left: 14px; color: var(--text-faint); display: flex; pointer-events: none; }
.count-search__clear { position: absolute; right: 6px; }
.count-search__meta { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--text-muted); }
.count-search__progress { font-size: var(--fs-sm); color: var(--text-muted); }
.count-search__save { font-size: var(--fs-xs); color: var(--text-faint); }
.count-search__save.is-error { color: var(--danger-text); font-weight: 500; }
.count-search__request { flex-shrink: 0; gap: 8px; white-space: nowrap; }
.count-draft-banner { align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.count-draft-banner .result-banner__text { flex: 1; min-width: 200px; }
.count-search__progress strong { color: var(--text); font-weight: 600; }
.count-search__none { text-align: center; }
.count-search__none p { margin: 0 0 12px; }
.count-search__none[hidden], #count-lines[hidden], #add-found-item[hidden], .count-row[hidden], .count-row__done[hidden], .count-search__clear[hidden] { display: none; }
.count-row__done {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--ok-text); color: #fff; margin-top: 2px;
}

/* Choosing the items of a bin to recount */
.pick-check { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer; }
.pick-check input[type="checkbox"] { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--accent); }
.pick-row.is-checked { border-color: var(--accent); background: var(--blue-tint); }
.pick-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pick-toolbar .input { flex: 1; min-width: 160px; }
.pick-footer { position: sticky; bottom: 0; z-index: 2; padding: 14px 0 6px; background: linear-gradient(to top, var(--bg, #f7f6f0) 75%, transparent); }
@media (max-width: 899px) {
  /* on a phone the bottom navigation sits at the bottom edge: stay above it */
  .pick-footer { bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + 4px); }
}

/* The order file offered after a count */
.order-card { margin-top: 18px; }
.order-card .btn + .btn { margin-top: 10px; }

/* The three count modes: on a phone the labels may need two lines, so the buttons grow with them */
#mode-segmented .segmented__opt { height: auto; min-height: 38px; padding: 6px 8px; line-height: 1.2; }
@media (max-width: 560px) {
  #mode-segmented .segmented__opt { font-size: var(--fs-sm); }
}

/* The round "go to the bottom" button (becomes "back to the top" near the bottom) */
.count-fab {
  position: fixed; right: 16px; bottom: 24px; z-index: 30; width: 48px; height: 48px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; border: 0; cursor: pointer;
  background: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(0, 35, 96, 0.28);
}
.count-fab[hidden] { display: none; }
.count-fab svg { transition: transform 0.2s ease; }
.count-fab.is-up svg { transform: rotate(180deg); }
.count-fab:hover { filter: brightness(1.08); }
.count-fab:focus-visible { outline: 3px solid var(--blue-tint); outline-offset: 2px; }
@media (max-width: 899px) {
  .count-fab { bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + 16px); }
}
@media (prefers-reduced-motion: reduce) { .count-fab svg { transition: none; } }

/* The photo on a count line opens bigger */
button.item-thumb--zoom { border: 0; padding: 0; cursor: zoom-in; overflow: hidden; }
button.item-thumb--zoom img { width: 100%; height: 100%; object-fit: cover; display: block; }
button.item-thumb--zoom:hover { box-shadow: 0 0 0 2px var(--accent); }
.photo-zoom { text-align: center; }
.photo-zoom__img { display: block; margin: 0 auto; width: min(100%, 520px); max-height: 68vh; object-fit: contain; border-radius: var(--radius-sm); background: #fff; }
.photo-zoom__caption { margin: 10px 0 0; font-size: var(--fs-sm); }

/* Final check: the item is a button that reopens its count */
.review-recount {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 0; text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.review-recount .item-cell { flex: 1; min-width: 0; }
.review-recount__icon { color: var(--text-faint); flex-shrink: 0; display: inline-flex; }
.review-recount:hover .gcode, .review-recount:focus-visible .gcode { text-decoration: underline; text-underline-offset: 3px; }
.review-recount:hover .review-recount__icon, .review-recount:focus-visible .review-recount__icon { color: var(--accent); }

/* The small number on the Demandes tab, and the cards of that tab */
.nav-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; margin-left: auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--sienna, #ff5629); color: #fff; font-size: 0.6875rem; font-weight: 600; line-height: 1;
}
.nav-badge[hidden] { display: none; }
.sheet-item .nav-badge { margin-left: auto; }
.bottom-nav__item { position: relative; }
.nav-badge--dot { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 10px; width: 10px; height: 10px; padding: 0; margin: 0; border: 2px solid var(--surface); box-sizing: content-box; }

.req-card { margin-bottom: 10px; }
.req-card__top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.req-card__when { font-size: var(--fs-xs); white-space: nowrap; }
.req-card__title { margin-top: 8px; font-weight: 500; }
.req-card__sub { font-size: var(--fs-sm); margin-top: 2px; }
.req-card__line { font-size: var(--fs-sm); margin-top: 6px; }
.req-card__note { font-size: var(--fs-sm); margin: 6px 0 0; white-space: pre-wrap; }
.req-card__message { margin: 0; font-size: var(--fs-sm); }
.req-card__actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.req-card--threshold { border-color: var(--amber, #c98a00); }

/* "Admin" on the place picker: a place of its own, set apart from the clinics */
.gate__clinic--admin { border-color: rgba(255, 255, 255, 0.55); background: rgba(255, 255, 255, 0.14); grid-column: 1 / -1; }
.gate__clinic--admin .gate__clinic-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }

/* one holder per screen (see App.navigate): it adds no box of its own */
.view-holder { display: contents; }

/* locations ticked one by one (employees, account requests) */
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 14px; }
.check-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: var(--fs-sm); cursor: pointer; }
.check-row input { width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }

/* tabs at the top of Settings */
.settings-tabs {
  display: flex; gap: 2px; overflow-x: auto; margin: 0 0 22px; border-bottom: 1px solid var(--border);
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.settings-tabs::-webkit-scrollbar { display: none; }
.settings-tab {
  flex: none; padding: 12px 16px; margin-bottom: -1px; border-bottom: 2px solid transparent;
  font-size: var(--fs-base); font-weight: 500; color: var(--text-muted); white-space: nowrap;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.settings-tab:hover { color: var(--text); }
.settings-tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.settings-tab:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; border-radius: 6px; }
[data-settings-panel][hidden] { display: none; }

/* "Add an employee": the form opens under the list instead of pushing it down */
.add-details { margin-bottom: 4px; }
.add-details > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.add-details > summary::-webkit-details-marker { display: none; }
