/* ============================================================================
   Apple Liquid Glass — HIG Components & Mobile Pocket Instrument Styles
   ========================================================================== */

/* --- Capsules & Circular Glass Controls (44x44pt hit targets, press state) -- */
.lg-gbtn {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-pill);
  color: var(--label);
  font: 600 var(--t-subhead)/1 var(--font);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-out),
              background-color var(--dur-normal) var(--ease-out);
}
.lg-gbtn.lg-circle { width: 44px; height: 44px; padding: 0; }
.lg-gbtn:active { transform: scale(0.92); }
.lg-gbtn.glass-clear { color: #FFFFFF; }

/* Shared capsule for related toolbar actions (no internal borders) */
.lg-capsule {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: 3px 5px;
  border-radius: var(--r-pill);
}
.lg-capsule > button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  min-width: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: inherit;
  font: 600 var(--t-footnote)/1 var(--font);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.lg-capsule > button:hover { background: var(--fill-2); }
.lg-capsule > button:active { transform: scale(0.94); }
.lg-capsule > button[aria-pressed='true'] {
  background: var(--tint);
  color: var(--on-tint);
}

/* Title capsule (two-line centered HUD pill) */
.lg-title-cap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 4px 18px;
  border-radius: var(--r-pill);
  line-height: 1.18;
  text-align: center;
}
.lg-title-cap strong {
  font-size: var(--t-subhead);
  font-weight: 600;
  letter-spacing: var(--tr-body);
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lg-title-cap span {
  font-size: var(--t-caption-1);
  color: var(--label-2);
  font-variant-numeric: tabular-nums;
}
.lg-title-cap.glass-clear span { color: rgba(255, 255, 255, 0.86); }

/* --- Segmented Control (max 5-7 items, raised opaque thumb) --------------- */
.lg-segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-ctrl);
  background: var(--fill);
  overflow-x: auto;
  scrollbar-width: none;
}
.lg-segmented::-webkit-scrollbar { display: none; }
.lg-segmented button {
  flex: 1 1 0;
  min-height: 34px;
  padding: 5px 11px;
  border: 0;
  border-radius: calc(var(--r-ctrl) - 2px);
  background: transparent;
  color: var(--label-2);
  font: 500 var(--t-footnote)/1.2 var(--font);
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--dur-normal) var(--ease-out),
              background-color var(--dur-normal) var(--ease-spring),
              transform var(--dur-fast) var(--ease-out);
}
.lg-segmented button:active { transform: scale(0.96); }
.lg-segmented button[aria-selected='true'] {
  background: var(--surface);
  color: var(--label);
  font-weight: 600;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.05);
}

/* --- Inset Grouped List (Opaque Content Layer, 0.5px inset hairlines) ----- */
.lg-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px 7px;
  font-size: var(--t-footnote);
  font-weight: 600;
  color: var(--label-2);
  letter-spacing: 0;
}
.lg-inset-group {
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--card-shadow);
  padding: 2px 0;
  overflow: hidden;
}
.lg-inset-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 14px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--label);
  text-align: left;
  font: inherit;
  transition: background-color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}
button.lg-inset-row { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button.lg-inset-row:hover { background: var(--fill-2); }
button.lg-inset-row:active { background: var(--fill); transform: scale(0.992); }
.lg-inset-row + .lg-inset-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 62px;
  right: 14px;
  height: 0.5px;
  background: var(--separator);
}
.lg-inset-row.lg-no-lead + .lg-inset-row.lg-no-lead::before { left: 14px; }
.lg-row-lead {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  outline: 1px solid rgba(128, 128, 128, 0.22);
  outline-offset: -1px;
}
.lg-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lg-row-title {
  font-size: var(--t-body);
  font-weight: 600;
  line-height: 1.25;
  color: var(--label);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lg-row-sub {
  font-size: var(--t-footnote);
  color: var(--label-2);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lg-row-trail {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}
.lg-row-qty {
  font-size: var(--t-headline);
  font-weight: 700;
  color: var(--label);
}

/* --- iOS 26 Floating Capsule Tab Bar (Neutral bar, tinted active item) ---- */
.lg-tabbar-dock {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: 95;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
}
@media (max-width: 840px) {
  .lg-tabbar-dock { display: flex; }
}
.lg-tabbar-capsule {
  pointer-events: auto;
  flex: 1;
  max-width: 380px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 60px;
  padding: 4px 8px;
  border-radius: var(--r-pill);
}
.lg-tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 48px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--label-2);
  font: 500 var(--t-caption-2)/1.1 var(--font);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}
.lg-tab-item:active { transform: scale(0.92); }
.lg-tab-item[aria-current='page'] {
  color: var(--tint);
  font-weight: 600;
}
.lg-tabbar-search {
  pointer-events: auto;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--label);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-out);
}
.lg-tabbar-search:active { transform: scale(0.90); }

/* ── Form Field (contratto form Astryx) ────────────────────────────────── */
.kx-form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1, 4px);
}

.kx-form-label {
  font-size: var(--t-caption-1, 12px);
  font-weight: 600;
  color: var(--label-2, inherit);
}

.kx-form-required { color: var(--sys-red, currentcolor); }

.kx-form-field--invalid .kx-form-label { color: var(--sys-red, currentcolor); }
.kx-form-field--warning .kx-form-label { color: var(--sys-orange, currentcolor); }
.kx-form-field--valid .kx-form-label { color: var(--sys-green, currentcolor); }

.kx-field-error {
  font-size: var(--t-caption-1, 12px);
  color: var(--sys-red, currentcolor);
}

.kx-field-helper {
  font-size: var(--t-caption-1, 12px);
  color: var(--label-3, inherit);
}
