:root {
  --app-control-ink: #092230;
  --app-control-lime: #bce027;
  --app-control-line: #dbe5e9;
  --app-control-muted: #617783;
  --app-control-danger: #c83243;
}

body.app-dialog-open {
  overflow: hidden;
}

body.app-calendar-open {
  overflow-x: hidden;
}

.app-ui-dialog[hidden],
.app-ui-calendar[hidden] {
  display: none !important;
}

.app-ui-dialog {
  position: fixed;
  inset: 0;
  z-index: 200000;
  display: grid;
  place-items: center;
  padding: 18px;
}

.app-ui-dialog-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(3, 23, 34, .7);
  backdrop-filter: blur(6px);
}

.app-ui-dialog-card {
  position: relative;
  width: min(450px, calc(100vw - 32px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .84);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 32px 100px rgba(2, 18, 28, .38);
  animation: app-ui-dialog-in .2s ease-out;
}

.app-ui-dialog-card:focus {
  outline: none;
}

.app-ui-dialog-accent {
  height: 6px;
  background: var(--app-control-lime);
}

.app-ui-dialog.is-error .app-ui-dialog-accent,
.app-ui-dialog.is-danger .app-ui-dialog-accent {
  background: #dc4b5b;
}

.app-ui-dialog.is-warning .app-ui-dialog-accent,
.app-ui-dialog.is-confirm .app-ui-dialog-accent {
  background: #f3b63f;
}

.app-ui-dialog-content {
  display: grid;
  justify-items: center;
  padding: 29px 28px 20px;
  text-align: center;
}

.app-ui-dialog-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  border-radius: 20px;
  background: #eff9d1;
  color: #5c7600;
  font-size: 1.55rem;
}

.app-ui-dialog.is-error .app-ui-dialog-icon,
.app-ui-dialog.is-danger .app-ui-dialog-icon {
  background: #fff0f1;
  color: var(--app-control-danger);
}

.app-ui-dialog.is-warning .app-ui-dialog-icon,
.app-ui-dialog.is-confirm .app-ui-dialog-icon {
  background: #fff6df;
  color: #bd7400;
}

.app-ui-dialog-kicker {
  margin-bottom: 6px;
  color: #748791;
  font: 800 .64rem Montserrat, sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.app-ui-dialog-card h2 {
  margin: 0;
  color: var(--app-control-ink);
  font: 800 1.22rem/1.25 Montserrat, sans-serif;
}

.app-ui-dialog-highlight[hidden] {
  display: none !important;
}

.app-ui-dialog-highlight {
  display: block;
  margin-top: 14px;
  padding: 10px 14px;
  border: 1px solid #cfe375;
  border-radius: 12px;
  background: #f3fad7;
  color: #395000;
  font: 900 .9rem/1.25 Montserrat, sans-serif;
  letter-spacing: .01em;
}

.app-ui-dialog.is-danger .app-ui-dialog-highlight,
.app-ui-dialog.is-error .app-ui-dialog-highlight {
  border-color: #dc4b5b;
  background: #c83243;
  color: #fff;
  box-shadow: 0 8px 22px rgba(200, 50, 67, .28);
}

.app-ui-dialog-card p {
  max-width: 360px;
  margin: 11px 0 0;
  color: #5c727e;
  font: 600 .82rem/1.58 Montserrat, sans-serif;
  white-space: pre-line;
}

.app-ui-dialog-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 0 28px 27px;
}

.app-ui-dialog-actions button,
.app-ui-dialog-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 122px;
  min-height: 43px;
  padding: 0 17px;
  border: 0;
  border-radius: 12px;
  font: 800 .74rem Montserrat, sans-serif;
  cursor: pointer;
  text-decoration: none;
}

.app-ui-dialog-cancel[hidden],
.app-ui-dialog-action[hidden] {
  display: none !important;
}

.app-ui-dialog-cancel {
  background: #edf2f4;
  color: #3e5966;
}

.app-ui-dialog-cancel:hover {
  background: #dfe8ec;
}

.app-ui-dialog-action {
  background: var(--app-control-ink);
  color: #fff;
}

.app-ui-dialog-action:hover {
  background: #173f52;
  color: #fff;
}

.app-ui-dialog-confirm {
  background: var(--app-control-lime);
  color: var(--app-control-ink);
}

.app-ui-dialog-confirm:hover {
  background: #acd318;
}

.app-ui-dialog.is-confirm .app-ui-dialog-confirm {
  background: var(--app-control-ink);
  color: #fff;
}

.app-ui-dialog.is-confirm .app-ui-dialog-confirm:hover {
  background: #173f52;
}

.app-ui-dialog.is-danger .app-ui-dialog-confirm,
.app-ui-dialog.is-error .app-ui-dialog-confirm {
  background: var(--app-control-danger);
  color: #fff;
}

.app-ui-dialog button:focus-visible,
.app-ui-dialog a:focus-visible,
.app-date-control:focus-visible,
.app-ui-calendar button:focus-visible,
.app-ui-calendar input:focus-visible {
  outline: 3px solid rgba(52, 128, 164, .3);
  outline-offset: 2px;
}

.app-date-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.app-date-control-wrap {
  display: inline-flex;
  width: 100%;
  min-width: 170px;
  max-width: 100%;
  vertical-align: middle;
}

.app-date-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #cbd8dd;
  border-radius: 11px;
  background: #fff;
  color: #173948;
  font: 750 .76rem Montserrat, sans-serif;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.app-date-control:hover {
  border-color: #96b51d;
  background: #fcfff5;
}

.app-date-control[disabled] {
  opacity: .58;
  cursor: not-allowed;
}

.app-date-control-text {
  display: grid;
  gap: 2px;
}

.app-date-control-text strong {
  color: #173948;
  font-size: .76rem;
}

.app-date-control-text small {
  color: #748791;
  font-size: .61rem;
  font-weight: 700;
}

.app-date-control > i {
  color: #79940d;
  font-size: .9rem;
}

.app-ui-calendar {
  position: fixed;
  z-index: 190000;
  box-sizing: border-box;
  width: min(390px, calc(100vw - 24px));
  max-height: calc(100vh - 16px);
  overflow: auto;
  padding: 18px;
  border: 1px solid #d9e5a7;
  border-radius: 20px;
  background: #fff;
  color: #173948;
  box-shadow: 0 28px 80px rgba(5, 29, 41, .28);
  animation: app-ui-calendar-in .16s ease-out;
}

.app-ui-calendar-head {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 8px;
  margin-bottom: 13px;
}

.app-ui-calendar-title {
  text-align: center;
}

.app-ui-calendar-title strong {
  display: block;
}

.app-ui-calendar-title strong {
  color: var(--app-control-ink);
  font: 800 .88rem Montserrat, sans-serif;
  text-transform: capitalize;
}

.app-ui-calendar-year {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  color: #7a8d96;
  font: 700 .62rem Montserrat, sans-serif;
  text-transform: uppercase;
}

.app-ui-calendar-year input {
  box-sizing: border-box;
  width: 72px;
  height: 27px;
  padding: 0 4px 0 8px;
  border: 1px solid #d5e0e4;
  border-radius: 8px;
  background: #f8fafb;
  color: #526b77;
  font: 800 .7rem Montserrat, sans-serif;
  text-align: center;
}

.app-ui-calendar-year input:hover {
  border-color: #96b51d;
  background: #fcfff5;
}

.app-ui-calendar-nav {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: #f1f6df;
  color: #4d6810;
  cursor: pointer;
}

.app-ui-calendar-nav:hover {
  background: var(--app-control-lime);
  color: var(--app-control-ink);
}

.app-ui-calendar-nav:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.app-ui-calendar-weekdays,
.app-ui-calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.app-ui-calendar-weekdays[hidden],
.app-ui-calendar-days[hidden],
.app-ui-calendar-months[hidden] {
  display: none !important;
}

.app-ui-calendar-weekdays {
  margin-bottom: 5px;
}

.app-ui-calendar-weekdays span {
  display: grid;
  place-items: center;
  height: 25px;
  color: #83939a;
  font: 900 .62rem Montserrat, sans-serif;
}

.app-ui-calendar-day {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #304c59;
  min-height: 40px;
  font: 800 .82rem Montserrat, sans-serif;
  cursor: pointer;
}

.app-ui-calendar-day:hover:not(:disabled) {
  background: #eff8d2;
  color: #304400;
}

.app-ui-calendar-day.is-outside {
  color: #b6c0c5;
}

.app-ui-calendar-day.is-today::after {
  content: "";
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #8eaa1b;
}

.app-ui-calendar-day.is-in-range {
  background: #eff8d2;
  color: #304400;
}

.app-ui-calendar-day.is-selected {
  background: var(--app-control-ink);
  color: #fff;
  box-shadow: 0 7px 16px rgba(9, 34, 48, .23);
}

.app-ui-calendar-day.is-selected::after {
  background: var(--app-control-lime);
}

.app-ui-calendar-day:disabled {
  color: #d4dadd;
  cursor: not-allowed;
  text-decoration: line-through;
}

.app-ui-calendar-months {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 4px 0;
}

.app-ui-calendar-month {
  position: relative;
  min-height: 52px;
  border: 0;
  border-radius: 12px;
  background: #f5f8ee;
  color: #304c59;
  font: 800 .69rem Montserrat, sans-serif;
  text-transform: uppercase;
  cursor: pointer;
}

.app-ui-calendar-month:hover:not(:disabled) {
  background: #eaf5c8;
  color: #304400;
}

.app-ui-calendar-month.is-today::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 7px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #8eaa1b;
  transform: translateX(-50%);
}

.app-ui-calendar-month.is-selected {
  background: var(--app-control-ink);
  color: #fff;
  box-shadow: 0 7px 16px rgba(9, 34, 48, .2);
}

.app-ui-calendar-month.is-selected::after {
  background: var(--app-control-lime);
}

.app-ui-calendar-month:disabled {
  opacity: .38;
  cursor: not-allowed;
}

.app-ui-calendar-hint {
  margin: 12px 0 0;
  color: #526b77;
  font: 750 .68rem/1.4 Montserrat, sans-serif;
  text-align: center;
}

.app-ui-calendar-hint[hidden] {
  display: none;
}

.app-ui-calendar-time {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px solid #dce8a7;
  border-radius: 13px;
  background: #f8fce9;
}

.app-ui-calendar-time[hidden] {
  display: none;
}

.app-ui-calendar-time label {
  display: grid;
  gap: 5px;
  color: #637984;
  font: 800 .62rem Montserrat, sans-serif;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.app-ui-calendar-time input {
  width: 132px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid #cbd8dd;
  border-radius: 10px;
  background: #fff;
  color: #173948;
  font: 750 .75rem Montserrat, sans-serif;
}

.app-ui-calendar-time > span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: #bce027;
  color: #092230;
}

.app-ui-calendar-footer {
  flex-wrap: wrap;
  position: sticky;
  z-index: 2;
  bottom: -18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid #edf1df;
  background: #fff;
  box-shadow: 0 -8px 16px rgba(255, 255, 255, .92);
}

.app-ui-calendar-footer-group {
  display: flex;
  gap: 7px;
}

.app-ui-calendar-footer button {
  min-height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: 9px;
  font: 800 .63rem Montserrat, sans-serif;
  cursor: pointer;
}

.app-ui-calendar-today,
.app-ui-calendar-clear {
  background: #f1f6df;
  color: #4d6810;
}

.app-ui-calendar-cancel {
  background: #edf2f4;
  color: #526b77;
}

.app-ui-calendar-apply {
  min-width: 132px;
  background: var(--app-control-ink);
  color: #fff;
}

.app-ui-calendar-apply:disabled {
  opacity: .42;
  cursor: not-allowed;
}

@keyframes app-ui-dialog-in {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to { opacity: 1; transform: none; }
}

@keyframes app-ui-calendar-in {
  from { opacity: 0; transform: translateY(-5px) scale(.98); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 520px) {
  .app-ui-dialog-content {
    padding: 25px 20px 18px;
  }

  .app-ui-dialog-actions {
    flex-direction: column-reverse;
    padding: 0 20px 23px;
  }

  .app-ui-dialog-actions button,
  .app-ui-dialog-actions a {
    width: 100%;
  }

  body.app-calendar-open {
    overflow: hidden;
  }

  body.app-calendar-open::before {
    content: "";
    position: fixed;
    z-index: 189999;
    inset: 0;
    background: rgba(3, 23, 34, .46);
    backdrop-filter: blur(3px);
  }

  .app-ui-calendar.is-sheet {
    width: auto;
    max-height: calc(100dvh - 20px);
    padding: 14px;
    border-radius: 22px;
    box-shadow: 0 24px 70px rgba(2, 18, 28, .42);
  }

  .app-ui-calendar-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .app-ui-calendar-footer-group,
  .app-ui-calendar-footer button {
    width: 100%;
  }

  .app-ui-calendar-footer {
    bottom: -14px;
  }
}

.app-ui-calendar-footer-group:last-child { margin-left: auto; }
