/* VAT lab gadgets — one header chip + result history */

.header .header-utils {
  overflow: visible;
}
.vat-lab-header-tools {
  position: relative;
  display: inline-block;
  margin: 0;
  padding-left: 0.65rem;
  border-left: 1px solid var(--border);
}
.header .vat-lab-drop {
  position: relative;
  display: inline-block;
  margin: 0;
}
.vat-lab-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2rem;
  padding: 0.32rem 0.45rem;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.2;
  cursor: pointer;
}
.vat-lab-chip .lang-flag {
  display: block;
  width: 22px;
  height: 15px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: 2px;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--border) 65%, transparent);
}
.vat-lab-chip .lang-flag-pl {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 16'%3E%3Crect width='24' height='8' fill='%23fff'/%3E%3Crect y='8' width='24' height='8' fill='%23dc143c'/%3E%3C/svg%3E");
}
.vat-lab-chip .lang-flag-en {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 16'%3E%3Crect width='24' height='16' fill='%23B22234'/%3E%3Crect width='24' height='1.23' y='1.23' fill='%23fff'/%3E%3Crect width='24' height='1.23' y='3.69' fill='%23fff'/%3E%3Crect width='24' height='1.23' y='6.15' fill='%23fff'/%3E%3Crect width='24' height='1.23' y='8.62' fill='%23fff'/%3E%3Crect width='24' height='1.23' y='11.08' fill='%23fff'/%3E%3Crect width='24' height='1.23' y='13.54' fill='%23fff'/%3E%3Crect width='9.6' height='8.62' fill='%23002868'/%3E%3C/svg%3E");
}
.vat-lab-chip-marks {
  display: inline-flex;
  align-items: baseline;
  gap: 0.38rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.vat-lab-chip-cur {
  opacity: 0.78;
}
.vat-lab-chip-units {
  display: inline-flex;
  align-items: baseline;
  letter-spacing: 0.01em;
}
.vat-lab-chip-units .is-on {
  opacity: 0.82;
}
.vat-lab-chip-units .is-off {
  opacity: 0.38;
}
.vat-lab-chip-slash {
  margin: 0 0.12rem;
  opacity: 0.32;
  font-weight: 400;
}
.vat-lab-chip:hover .vat-lab-chip-cur,
.vat-lab-chip[aria-expanded="true"] .vat-lab-chip-cur,
.vat-lab-chip:hover .vat-lab-chip-units .is-on,
.vat-lab-chip[aria-expanded="true"] .vat-lab-chip-units .is-on {
  opacity: 0.95;
  color: var(--text);
}
.vat-lab-chip:hover,
.vat-lab-chip[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--text);
}
.vat-lab-chip-caret {
  width: 0.42rem;
  height: 0.42rem;
  margin-top: -0.12rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.55;
}
.vat-lab-format {
  margin: 0 0 0.45rem;
}
.vat-lab-tools-menu .header-format-label {
  display: block;
  width: 100%;
  margin: 0.4rem 0 0;
  padding: 0;
  border: 0;
}
.vat-lab-fmt-cap {
  display: block;
  margin-bottom: 0.15rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.vat-lab-tools-menu .header-format-label select {
  width: 100%;
  max-width: 100%;
  margin: 0;
}
.vat-lab-tools-menu .lang-form {
  display: block;
  width: 100%;
  margin: 0.4rem 0 0;
  padding: 0;
  border: 0;
}
.vat-lab-tools-menu .lang-select-wrap {
  display: flex;
  width: 100%;
  box-sizing: border-box;
}
.vat-lab-tools-menu .lang-select-wrap .lang-select {
  flex: 1;
  min-width: 0;
}
.vat-lab-hist {
  display: block;
  margin: 0.75rem 0 0;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
}
.vat-lab-quiet-btn {
  appearance: none;
  background: none;
  border: 0;
  padding: 0.15rem 0.1rem;
  margin: 0;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--border) 80%, transparent);
  text-underline-offset: 0.18em;
}
.vat-lab-quiet-btn:hover,
.vat-lab-quiet-btn[aria-expanded="true"] {
  color: var(--text);
  text-decoration-color: currentColor;
}
.vat-lab-menu {
  position: absolute;
  right: 0;
  left: auto;
  top: calc(100% + 0.35rem);
  z-index: 40;
  min-width: 14rem;
  max-width: min(22rem, calc(100vw - 1.5rem));
  padding: 0.45rem 0.35rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 0.4rem);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--text) 8%, transparent);
}
.vat-lab-tools-menu {
  width: min(17.5rem, calc(100vw - 1.25rem));
  min-width: 0;
  max-height: min(28rem, calc(100dvh - 6rem));
  padding: 0.55rem 0.7rem 0.75rem;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
.vat-lab-menu.hidden {
  display: none;
}
.vat-lab-hist .vat-lab-menu {
  left: 0;
  right: auto;
  min-width: min(22rem, 100%);
}
.vat-lab-sec {
  margin: 0.7rem 0 0.25rem;
  padding: 0;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.vat-lab-sec:first-child {
  margin-top: 0.1rem;
}
.vat-lab-empty {
  margin: 0.2rem 0 0.35rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.4;
}
.vat-lab-keep {
  margin-top: 0.45rem;
  font-size: 0.72rem;
}
.vat-lab-menu-list {
  margin: 0 0 0.35rem;
  padding: 0;
  list-style: none;
}
.vat-lab-menu-list a,
.vat-lab-tape-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.38rem 0.45rem;
  border: 0;
  border-radius: 0.3rem;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 0.86rem;
  text-decoration: none;
  cursor: pointer;
}
.vat-lab-menu-list a:hover,
.vat-lab-tape-row:hover {
  background: color-mix(in srgb, var(--accent-warm) 8%, transparent);
}
.vat-lab-text-btn {
  appearance: none;
  display: block;
  width: 100%;
  margin-top: 0.15rem;
  padding: 0.3rem 0.45rem;
  border: 0;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.78rem;
  text-align: left;
  cursor: pointer;
}
.vat-lab-text-btn:hover {
  color: var(--text);
}
.vat-lab-tools-menu label {
  display: block;
  margin: 0.4rem 0 0;
}
.vat-lab-tools-menu label span {
  display: block;
  margin-bottom: 0.15rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.vat-lab-tools-menu input,
.vat-lab-tools-menu select {
  width: 100%;
  max-width: 100%;
  padding: 0.28rem 0.4rem;
  font-size: 0.82rem;
}
.vat-lab-convert-out {
  min-height: 1.1em;
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  font-weight: 600;
}
@media (max-width: 768px) {
  .header .container .header-utils.header-utils--vat-packed .theme-toggle {
    grid-column: 1;
    grid-row: 1;
  }
  .header .container .header-utils.header-utils--vat-packed .vat-lab-header-tools {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    padding-left: 0;
    border-left: 0;
  }
  body.vat-lab-sheet-open {
    overflow: hidden;
  }
  .vat-lab-menu.vat-lab-tools-menu.vat-lab-tools-menu--sheet {
    position: fixed !important;
    right: 0.75rem !important;
    bottom: max(0.75rem, env(safe-area-inset-bottom, 0px)) !important;
    left: 0.75rem !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
    transform: none !important;
    z-index: 400 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }
}
