/* Date boxes shown as dd/MM/yyyy whatever the computer's format (bos-date-input.js,
   docs/2026-11-12_date-format-dd-mm-yyyy.md). */

/* The real <input type="date">: kept in the page (value, events, form post, calendar) but invisible and out of the
   layout. position: fixed = no offsetParent, so the Enter-key helpers skip it. The two :not(#id) lift the rule above
   any screen rule that sizes date boxes (even with !important). Its place is set only when its calendar opens. */
input.bos-date-native:not(#bos-date-a):not(#bos-date-b) {
  position: fixed !important;
  left: var(--bos-date-left, 0px) !important;
  top: var(--bos-date-top, 0px) !important;
  right: auto !important;
  bottom: auto !important;
  width: var(--bos-date-width, 1px) !important;
  height: var(--bos-date-height, 1px) !important;
  min-width: 0 !important;
  max-width: none !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transform: none !important;
  box-shadow: none !important;
  z-index: -1 !important;
}

/* The text box shown instead. It takes the real box's classes, so it looks like the screen's other boxes. */
input.bos-date-text {
  font-variant-numeric: tabular-nums;
  text-align: left;
}

input.bos-date-text.bos-date-text--icon {
  padding-right: 30px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 3v3M17 3v3M4 9h16M5 5h14a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1Z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 8px center !important;
  background-size: 16px 16px !important;
}

[data-theme="dark"] input.bos-date-text.bos-date-text--icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 3v3M17 3v3M4 9h16M5 5h14a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1Z'/%3E%3C/svg%3E") !important;
}

input.bos-date-text:disabled.bos-date-text--icon {
  background-image: none !important;
}

/* Not a date: the box goes back to what was saved and blinks red for a moment. */
input.bos-date-text.bos-date-text--bad {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, #dc2626 18%, transparent) !important;
}

@media print {
  input.bos-date-text.bos-date-text--icon { background-image: none !important; padding-right: 0 !important; }
}
