/* ==========================================================================
   Manifold Clean Energy — date picker
   Shared by the public forms and the admin, so it leans only on the tokens
   both stylesheets define: --ink, --body, --muted, --line, --tint, --accent,
   --accent-2, --accent-deep, --radius, --radius-sm.
   ========================================================================== */

.datefield{position:relative}

/* the real input stays in the form and keeps its name and ISO value */
.datefield__input{
  position:absolute;
  width:1px;height:1px;
  padding:0;margin:-1px;
  overflow:hidden;
  clip:rect(0 0 0 0);
  white-space:nowrap;
  border:0;
  opacity:0;
  pointer-events:none;
}

/* the button wears exactly what a text input in the same form wears */
.datefield__button{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  width:100%;
  padding:14px 16px;
  font-family:inherit;
  font-size:inherit;
  line-height:1.5;
  text-align:left;
  color:var(--ink);
  background:#fff;
  border:1px solid #dfe7ee;
  border-radius:var(--radius-sm);
  cursor:pointer;
  transition:border-color .2s ease,box-shadow .2s ease;
}
.datefield__button:hover{border-color:#c3d3df}
.datefield__button:focus-visible{
  outline:none;
  border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(75,180,83,.16);
}
.datefield__button.is-empty .datefield__value{color:var(--muted)}
.datefield__button > i{color:var(--accent-deep);font-size:17px;line-height:1;flex:none}

/* --- the clock, beside the date rather than inside the calendar --- */
.datefield--time{display:flex;flex-wrap:wrap;align-items:stretch;gap:10px}
/* a date needs about twenty characters, not the whole form width */
.datefield--time .datefield__button{flex:0 1 260px;width:auto;max-width:100%}

.timefield{
  display:flex;
  align-items:center;
  gap:4px;
  flex:0 0 auto;
  padding:0 10px;
  background:#fff;
  border:1px solid #dfe7ee;
  border-radius:var(--radius-sm);
}
.timefield:focus-within{border-color:var(--accent)}
/* the admin styles .field select, which outranks a bare class here */
.timefield .timefield__part{
  /* the browser's own arrow overlapped the text in a box this narrow, so draw
     one and keep the room for it */
  appearance:none;
  -webkit-appearance:none;
  padding:6px 16px 6px 4px;
  border:0;
  background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%238499ac'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708'/%3E%3C/svg%3E") no-repeat right 1px center;
  background-size:11px 11px;
  font-family:inherit;
  font-size:inherit;
  font-weight:600;
  font-variant-numeric:tabular-nums;
  color:var(--ink);
  cursor:pointer;
}
.timefield .timefield__part:focus{outline:none}
/* AM and PM are wider than two digits, so they need a little more room
   before the chevron */
.timefield .timefield__meridiem{
  margin-left:8px;
  padding-right:20px;
  /* Chrome sizes a select to its widest option and then clips the last glyph
     of a two-letter one, so state the room outright */
  min-width:58px;
  color:var(--accent-deep);
}
.timefield__colon{font-weight:700;color:var(--muted)}

@media (max-width:479px){
  .datefield--time .datefield__button{flex:1 1 100%}
  .timefield{width:100%;justify-content:center}
}

/* --- the panel --- */
.datepicker{
  position:absolute;
  z-index:60;
  top:calc(100% + 8px);
  left:0;
  width:min(320px,calc(100vw - 32px));
  padding:16px;
  border:1px solid var(--line);
  border-radius:var(--radius);
  background:#fff;
  box-shadow:0 24px 50px rgba(15,60,95,.16);
  display:none;
}
.datepicker.is-open{display:block}
.datepicker.is-above{top:auto;bottom:calc(100% + 8px)}

.datepicker__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin-bottom:12px;
}
.datepicker__period{display:flex;gap:6px;flex:1 1 auto;min-width:0}
/* the month name is the long one; the year never needs more than four digits */
.datepicker__month{flex:1.7 1 auto}
.datepicker__year{flex:1 1 auto;max-width:92px}
.datepicker__period select{
  flex:1 1 auto;
  min-width:0;
  padding:7px 8px;
  font-family:inherit;
  font-size:13px;
  font-weight:600;
  color:var(--ink);
  background:#fff;
  border:1px solid var(--line);
  border-radius:8px;
  cursor:pointer;
}
.datepicker__nav{
  flex:none;
  width:32px;height:32px;
  display:flex;align-items:center;justify-content:center;
  border:1px solid var(--line);
  border-radius:50%;
  background:#fff;
  color:var(--ink);
  font-size:12px;
  cursor:pointer;
  transition:background .2s ease,border-color .2s ease;
}
.datepicker__nav:hover{background:var(--tint);border-color:#c3d3df}

.datepicker__weekdays,
.datepicker__grid{
  display:grid;
  grid-template-columns:repeat(7,1fr);
  gap:2px;
}
.datepicker__weekdays{margin-bottom:4px}
.datepicker__weekdays span{
  text-align:center;
  font-size:11px;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:var(--muted);
  padding:4px 0;
}

.datepicker__day{
  aspect-ratio:1;
  display:flex;align-items:center;justify-content:center;
  border:1px solid transparent;
  border-radius:9px;
  background:none;
  font-family:inherit;
  font-size:13px;
  font-weight:600;
  color:var(--ink);
  cursor:pointer;
  transition:background .15s ease,color .15s ease,border-color .15s ease;
}
.datepicker__day:hover:not(:disabled){background:var(--tint)}
.datepicker__day:disabled{color:var(--muted);opacity:.45;cursor:not-allowed}
.datepicker__day.is-today{border-color:rgba(23,176,166,.5);color:var(--accent-deep)}
.datepicker__day.is-chosen{
  background:linear-gradient(100deg,var(--accent) 0%,var(--accent-2) 100%);
  border-color:transparent;
  color:#fff;
}
/* keep the fill under the pointer — the plain hover rule is more specific */
.datepicker__day.is-chosen:hover:not(:disabled){
  background:linear-gradient(100deg,var(--accent) 0%,var(--accent-2) 100%);
  color:#fff;
}


@media (prefers-reduced-motion:reduce){
  .datefield__button,
  .datepicker__day,
  .datepicker__nav{transition:none}
}
