/* ===============================================================
   Neumi.Ui, the date picker's stylesheet (hand-written, not compiled)
   ===============================================================
   Served at /_content/Neumi.Ui/date-picker.css beside date-picker.js. A site links it after the design tokens
   (https://cdn.neumi.com/design/v1/tokens.css). It is NOT built by Tailwind: the build's minifier removes a fallback
   declaration the browser it targets does not need (a literal colour before its var(), vh before dvh, a physical side before
   a logical one), and those fallbacks are the whole point here, for members on old phones and old browsers.

   The rules of this file, which the package's tests check:
   - a fallback declaration comes BEFORE any recent one (a literal before var(), vh before dvh, a plain padding before env());
   - none of: :has, :is, :where, :dir(), inset, gap, aspect-ratio, min(), max(), clamp(), color-mix(), a logical side;
   - :focus-visible only as a rule of its own after the :focus rule, so a browser without it keeps the :focus ring;
   - geometry in px (the sites' legacy root font size is 14 px, which would shrink every rem);
   - direction by the root's data-dir (written by the script from the root's computed direction), never :dir() or [dir]
     (an ltr island in an rtl page would mirror wrongly), and by flex and text-align: start, which follow the reading direction;
   - the markup hides the calendar half with the hidden attribute, so no rule here is needed to hide it; the rule below only stops
     a display value from beating that attribute.

   Tokens used, each with its literal fallback: --background, --foreground, --muted-foreground, --border, --input, --accent,
   --accent-foreground, --primary, --primary-foreground, --ring, --radius. --neumi-date-picker-height sets the field's height
   (default 36 px, the shadcn input).
   =============================================================== */

.neumi-date-picker [hidden] {
  display: none !important;
}

.neumi-date-picker {
  position: relative;
  display: block;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 14px;
  line-height: 20px;
  color: #0a0a0a;
  color: var(--foreground, #0a0a0a);
}
.neumi-date-picker *,
.neumi-date-picker *::before,
.neumi-date-picker *::after {
  box-sizing: border-box;
}

/* The no-script half: a block, so the hint sits under the input; the hidden attribute (set by the script) wins over this. */
.neumi-date-picker-fallback {
  display: block;
}

.neumi-date-picker-label {
  display: block;
  margin: 0 0 6px 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
}

/* The field's box: the no-script input and the button share it, so the swap changes nothing the eye sees. */
.neumi-date-picker-input,
.neumi-date-picker-trigger {
  display: block;
  width: 100%;
  height: 36px;
  height: var(--neumi-date-picker-height, 36px);
  margin: 0;
  padding: 0 12px;
  border: 1px solid #d4d4d8;
  border: 1px solid var(--input, var(--border, #d4d4d8));
  border-radius: 6px;
  border-radius: calc(var(--radius, 8px) - 2px);
  background-color: #fff;
  background-color: var(--background, #fff);
  color: inherit;
  font: inherit;
  text-align: start;
  -webkit-appearance: none;
  appearance: none;
}
.neumi-date-picker-input {
  line-height: normal;
}
.neumi-date-picker-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.neumi-date-picker-text {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 8px;
  line-height: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.neumi-date-picker-text[data-placeholder="true"] {
  color: #71717a;
  color: var(--muted-foreground, #71717a);
}
.neumi-date-picker-icon {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  opacity: 0.6;
}
.neumi-date-picker-hint {
  margin: 4px 0 0 0;
  font-size: 12px;
  line-height: 16px;
  color: #71717a;
  color: var(--muted-foreground, #71717a);
}
.neumi-date-picker-input:disabled,
.neumi-date-picker-trigger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Focus: the :focus ring for every browser, then the :focus-visible rule that removes it for a pointer where the browser can tell. */
.neumi-date-picker-input:focus,
.neumi-date-picker-trigger:focus,
.neumi-date-picker-nav:focus,
.neumi-date-picker-day:focus,
.neumi-date-picker-today:focus {
  outline: 2px solid #2563eb;
  outline: 2px solid var(--ring, #2563eb);
  outline-offset: 1px;
}
.neumi-date-picker-input:focus:not(:focus-visible),
.neumi-date-picker-trigger:focus:not(:focus-visible),
.neumi-date-picker-nav:focus:not(:focus-visible),
.neumi-date-picker-day:focus:not(:focus-visible),
.neumi-date-picker-today:focus:not(:focus-visible) {
  outline: none;
}

/* ── The calendar ─────────────────────────────────────────────── */

.neumi-date-picker-scrim {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 10140;
  background: rgba(0, 0, 0, 0.4);
}

.neumi-date-picker-panel {
  position: fixed;
  z-index: 10150;
  width: 304px;
  max-width: 100%;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid #d4d4d8;
  border: 1px solid var(--border, #d4d4d8);
  border-radius: 8px;
  border-radius: calc(var(--radius, 8px));
  background-color: #fff;
  background-color: var(--background, #fff);
  color: #0a0a0a;
  color: var(--foreground, #0a0a0a);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
  -webkit-animation: neumi-date-picker-fade 100ms ease-out;
  animation: neumi-date-picker-fade 100ms ease-out;
}

/* A phone: a bottom sheet across the width, the last part of the screen the thumb reaches. */
.neumi-date-picker[data-mode="sheet"] .neumi-date-picker-panel {
  left: 0;
  right: 0;
  bottom: 0;
  top: auto;
  width: auto;
  max-width: none;
  max-height: 90vh;
  max-height: 90dvh;
  padding: 8px 8px 8px 8px;
  padding-bottom: 8px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  border-width: 1px 0 0 0;
  border-radius: 12px 12px 0 0;
  -webkit-animation: neumi-date-picker-up 160ms ease-out;
  animation: neumi-date-picker-up 160ms ease-out;
}
@media (max-width: 359px) {
  .neumi-date-picker[data-mode="sheet"] .neumi-date-picker-panel {
    padding-left: 4px;
    padding-right: 4px;
  }
}

@-webkit-keyframes neumi-date-picker-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes neumi-date-picker-fade { from { opacity: 0; } to { opacity: 1; } }
@-webkit-keyframes neumi-date-picker-up { from { opacity: 0; -webkit-transform: translateY(24px); } to { opacity: 1; -webkit-transform: none; } }
@keyframes neumi-date-picker-up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

.neumi-date-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 8px 0;
}
.neumi-date-picker-caption {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 8px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}

.neumi-date-picker-nav,
.neumi-date-picker-day,
.neumi-date-picker-today {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  border-radius: calc(var(--radius, 8px) - 2px);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: center;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.neumi-date-picker-nav {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
}
.neumi-date-picker-nav-glyph {
  display: block;
  width: 18px;
  height: 18px;
  margin: 0 auto;
}
.neumi-date-picker[data-dir="rtl"] .neumi-date-picker-nav-glyph {
  -webkit-transform: scaleX(-1);
  transform: scaleX(-1);
}

.neumi-date-picker-grid {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  border-collapse: collapse;
  border-spacing: 0;
  table-layout: fixed;
}
.neumi-date-picker-grid th {
  height: 32px;
  padding: 0;
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
  text-align: center;
  color: #71717a;
  color: var(--muted-foreground, #71717a);
}
.neumi-date-picker-grid td {
  padding: 0;
  text-align: center;
}
.neumi-date-picker-day {
  position: relative;
  width: 100%;
  height: 40px;
  font-size: 14px;
  line-height: normal;
}
.neumi-date-picker-day[data-outside="true"] {
  color: #71717a;
  color: var(--muted-foreground, #71717a);
}
.neumi-date-picker-day[data-today="true"] {
  background-color: #f4f4f5;
  background-color: var(--accent, #f4f4f5);
  color: #18181b;
  color: var(--accent-foreground, #18181b);
  font-weight: 600;
}
/* Today also carries a dot, so it never rests on a colour alone. */
.neumi-date-picker-day[data-today="true"]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background-color: currentColor;
}
.neumi-date-picker-day[data-selected="true"] {
  background-color: #18181b;
  background-color: var(--primary, #18181b);
  color: #fafafa;
  color: var(--primary-foreground, #fafafa);
  font-weight: 600;
}
.neumi-date-picker-day:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.neumi-date-picker-footer {
  margin: 8px 0 0 0;
  text-align: center;
}
.neumi-date-picker-today {
  display: inline-block;
  height: 36px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 500;
}
.neumi-date-picker-today:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Hover only where the pointer can hover, so a touch screen never keeps a stuck highlight; nothing here is the only sign of anything. */
@media (hover: hover) {
  .neumi-date-picker-nav:hover,
  .neumi-date-picker-today:hover,
  .neumi-date-picker-day:hover {
    background-color: #f4f4f5;
    background-color: var(--accent, #f4f4f5);
    color: #18181b;
    color: var(--accent-foreground, #18181b);
  }
  .neumi-date-picker-day[data-selected="true"]:hover {
    background-color: #18181b;
    background-color: var(--primary, #18181b);
    color: #fafafa;
    color: var(--primary-foreground, #fafafa);
  }
  .neumi-date-picker-nav:disabled:hover,
  .neumi-date-picker-day:disabled:hover,
  .neumi-date-picker-today:disabled:hover {
    background-color: transparent;
  }
}

/* Touch: 44 px targets on a phone sheet and on any coarse pointer (a tablet's popover too). */
.neumi-date-picker[data-mode="sheet"] .neumi-date-picker-nav {
  width: 44px;
  height: 44px;
}
.neumi-date-picker[data-mode="sheet"] .neumi-date-picker-day {
  height: 44px;
  font-size: 16px;
}
.neumi-date-picker[data-mode="sheet"] .neumi-date-picker-today {
  height: 44px;
}
@media (pointer: coarse) {
  .neumi-date-picker-nav {
    width: 44px;
    height: 44px;
  }
  .neumi-date-picker-day {
    height: 44px;
  }
  .neumi-date-picker-today {
    height: 44px;
  }
}

/* Reduced motion: the calendar appears at once. */
@media (prefers-reduced-motion: reduce) {
  .neumi-date-picker-panel,
  .neumi-date-picker[data-mode="sheet"] .neumi-date-picker-panel {
    -webkit-animation: none;
    animation: none;
  }
}

/* Forced colours (Windows high contrast): system colours, the chosen day on Highlight, today underlined, disabled in GrayText. */
@media (forced-colors: active) {
  .neumi-date-picker-input,
  .neumi-date-picker-trigger,
  .neumi-date-picker-panel {
    border: 1px solid CanvasText;
    background-color: Canvas;
    color: CanvasText;
  }
  .neumi-date-picker[data-mode="sheet"] .neumi-date-picker-panel {
    border-width: 1px 0 0 0;
  }
  .neumi-date-picker-icon,
  .neumi-date-picker-nav-glyph {
    forced-color-adjust: auto;
  }
  .neumi-date-picker-day[data-selected="true"] {
    forced-color-adjust: none;
    background-color: Highlight;
    color: HighlightText;
  }
  .neumi-date-picker-day[data-today="true"] {
    background-color: transparent;
    text-decoration: underline;
  }
  .neumi-date-picker-day[data-today="true"]::after {
    forced-color-adjust: none;
    background-color: CanvasText;
  }
  .neumi-date-picker-day[data-selected="true"]::after {
    background-color: HighlightText;
  }
  .neumi-date-picker-day:disabled,
  .neumi-date-picker-nav:disabled,
  .neumi-date-picker-today:disabled {
    color: GrayText;
    opacity: 1;
  }
  .neumi-date-picker-input:focus,
  .neumi-date-picker-trigger:focus,
  .neumi-date-picker-nav:focus,
  .neumi-date-picker-day:focus,
  .neumi-date-picker-today:focus {
    outline: 2px solid Highlight;
  }
  .neumi-date-picker-scrim {
    background: transparent;
  }
}

/* More contrast asked: a heavier border and ink. */
@media (prefers-contrast: more) {
  .neumi-date-picker-input,
  .neumi-date-picker-trigger,
  .neumi-date-picker-panel {
    border-color: currentColor;
  }
  .neumi-date-picker-text[data-placeholder="true"],
  .neumi-date-picker-hint,
  .neumi-date-picker-grid th,
  .neumi-date-picker-day[data-outside="true"] {
    color: inherit;
  }
  .neumi-date-picker-day[data-today="true"] {
    text-decoration: underline;
  }
}
