body.cms-media-open {
  overflow: hidden;
}

.cms-media[hidden] {
  display: none;
}

.cms-media {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  background: rgb(16 42 67 / 48%);
}

.cms-media__panel {
  display: flex;
  width: min(1080px, 84vw);
  height: 100%;
  overflow: hidden;
  flex-direction: column;
  color: #20242b;
  background: #f5f6f7;
  box-shadow: -10px 0 32px rgb(16 42 67 / 18%);
}

.cms-media__panel--page {
  width: 100%;
  height: auto;
  min-height: 0;
  overflow: visible;
  box-shadow: none;
}

.cms-media__header,
.cms-media__toolbar,
.cms-media__upload {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid #dce3e8;
  background: #fff;
}

.cms-media__header {
  justify-content: space-between;
}

.cms-media__header h2,
.cms-media__group h3 {
  margin: 0;
  font-size: 18px;
}

.cms-media__heading p {
  margin: 3px 0 0;
  color: #52606d;
  font-size: 11px;
}

.cms-media__close {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
}

.cms-media__toolbar input[type="search"] {
  flex: 1;
  min-width: 180px;
}

.cms-media__toolbar .cms-media__article-filter {
  width: 120px;
  min-width: 0;
  flex: 0 0 120px;
}

.cms-media__toolbar .cms-media__check,
.cms-media__toolbar button {
  flex: 0 0 auto;
}

.cms-media__toolbar input,
.cms-media__toolbar .cms-select__trigger,
.cms-media__upload input,
.cms-media__toolbar button,
.cms-media__upload button,
.cms-media__actions button {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid #b7c3ca;
  border-radius: 4px;
  background: #fff;
  color: #27343b;
}

.cms-media__check,
.cms-media__select-delete {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.cms-media__delete {
  color: #a33a43 !important;
}

.cms-media__upload input[type="text"] {
  width: min(360px, 38vw);
}

.cms-media__article-title {
  flex: 0 1 360px;
}

.cms-media__message,
.cms-media__empty {
  margin: 0;
  padding: 10px 18px;
  color: #52606d;
  font-size: 13px;
}

.cms-media__content {
  overflow: auto;
  padding: 18px;
}

.cms-media__group {
  margin-bottom: 24px;
}

.cms-media__group h3 {
  margin-bottom: 10px;
  font-size: 15px;
}

.cms-media__group-title {
  width: fit-content;
  cursor: pointer;
}

.cms-media__group-title:hover {
  color: #0b7285;
}

.cms-media__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.cms-media__upload .cms-media__upload-button {
  border-color: #0b7285;
  background: #0b7285;
  color: #fff;
  font-weight: 650;
}

.cms-media__upload .cms-media__upload-button:hover:not(:disabled) {
  border-color: #075e6e;
  background: #075e6e;
}

.cms-media__item {
  display: grid;
  min-width: 0;
  overflow: hidden;
  grid-template-rows: 132px auto auto;
  border: 1px solid #d7e0e5;
  border-radius: 6px;
  background: #fff;
}

.cms-media__visual {
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #52606d;
  background: #eef2f4;
}

.cms-media__visual--image {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Ccircle cx='8' cy='8' r='5' fill='white' stroke='%230b7285' stroke-width='1.5'/%3E%3Cpath d='M12 12l6 6' stroke='%230b7285' stroke-width='2.25' stroke-linecap='round'/%3E%3Cpath d='M8 5.5v5M5.5 8h5' stroke='%230b7285' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") 8 8, pointer;
}

.cms-media__visual--image:focus-visible,
.cms-media__group-title:focus-visible {
  outline: 2px solid #0b7285;
  outline-offset: 2px;
}

.cms-media__visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cms-media__details,
.cms-media__actions {
  display: flex;
  min-width: 0;
  gap: 5px;
  padding: 9px;
}

.cms-media__details {
  align-items: flex-start;
  flex-direction: column;
  color: #52606d;
  font-size: 12px;
}

.cms-media__details strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: #27343b;
}

.cms-media__used {
  color: #0f6b46;
}

.cms-media__unused {
  color: #96500f;
}

.cms-media__actions {
  align-items: center;
  flex-wrap: wrap;
  border-top: 1px solid #edf1f3;
}

.cms-media__actions button {
  min-height: 28px;
  padding: 4px 6px;
  font-size: 12px;
  cursor: pointer;
}

.cms-media__zoom {
  position: fixed;
  z-index: 10020;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 32px;
  background: rgb(16 42 67 / 72%);
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Ccircle cx='8' cy='8' r='5' fill='white' stroke='%230b7285' stroke-width='1.5'/%3E%3Cpath d='M12 12l6 6' stroke='%230b7285' stroke-width='2.25' stroke-linecap='round'/%3E%3Cpath d='M5.5 8h5' stroke='%230b7285' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") 8 8, pointer;
}

.cms-media__zoom img {
  display: block;
  max-width: min(1120px, 92vw);
  max-height: 88vh;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 18px 48px rgb(16 42 67 / 32%);
  cursor: default;
}

@media (max-width: 900px) {
  .cms-media__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .cms-media__panel {
    width: 100%;
  }

  .cms-media__toolbar,
  .cms-media__upload {
    align-items: stretch;
    flex-direction: column;
  }

  .cms-media__upload input[type="text"] {
    width: auto;
  }

  .cms-media__toolbar .cms-media__article-filter {
    width: auto;
    flex-basis: auto;
  }
}

.cms-media__view {
  padding: 6px 12px;
  border: 1px solid #cfd7dd;
  border-radius: 6px;
  background: transparent;
  color: #5d6670;
}

.cms-media__view.is-active {
  border-color: #0969da;
  background: rgba(9, 105, 218, 0.1);
  color: #0969da;
  font-weight: 600;
}

.cms-media__refresh {
  padding: 6px 12px;
  border: 1px solid #cfd7dd;
  border-radius: 6px;
  background: transparent;
  color: #5d6670;
}

.cms-media__upload-target {
  padding: 7px 10px;
  border: 1px dashed #cfd7dd;
  border-radius: 6px;
  color: #5d6670;
  font-size: 12px;
}
