html:has(#planner-dialog[open]) {
  overflow: hidden;
}

#planner-dialog {
  width: min(1020px, calc(100% - 40px));
  height: min(780px, calc(100dvh - 40px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid #cbdaf0;
  border-top: 4px solid #2949ba;
  border-radius: 16px;
  background: #fff;
  color: #172541;
  box-shadow: 0 24px 70px rgb(16 36 73 / 28%);
}

#planner-dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

#planner-dialog::backdrop {
  background: rgb(20 35 63 / 52%);
}

.planner-dialog-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px clamp(16px, 3.5vw, 34px);
  gap: 12px;
  border-bottom: 1px solid #e0e8f4;
  background: #f6f9fd;
}

#planner-dialog-title {
  margin: 0;
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.3;
}

.planner-dialog-close {
  min-height: 44px;
  padding: 7px 15px;
  border: 1px solid #cad8ed;
  border-radius: 8px;
  background: #fff;
  color: #223758;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.planner-dialog-close:hover { background: #eaf0fc; }

.planner-dialog-close:focus-visible {
  outline: 2px solid #2949ba;
  outline-offset: 2px;
}

.planner-dialog-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

@media (max-width: 600px) {
  #planner-dialog {
    width: calc(100% - 16px);
    height: calc(100dvh - 16px);
    border-radius: 12px;
  }

  .planner-dialog-bar {
    padding-block: 8px;
  }
}
