.omni-generatory {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.omni-generatory-notice {
  border: 1px solid #d9e2ef;
  border-radius: 6px;
  background: #f8fafc;
  color: #1f2937;
  padding: 12px 14px;
  font: 14px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.omni-image-library-modal,
.omni-image-library-modal * {
  box-sizing: border-box;
}

.omni-image-library-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(56px, 8vh, 96px) 16px 28px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: "Outfit", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.omni-image-library-modal.is-open {
  display: flex;
}

.omni-image-library-dialog {
  width: min(1000px, 94vw);
  max-height: calc(100dvh - 112px);
  min-height: min(720px, calc(100dvh - 112px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.18);
}

.omni-image-library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid #d9e2ef;
}

.omni-image-library-title {
  margin: 0;
  color: #1e293b;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.15;
}

.omni-image-library-subtitle {
  margin-top: 4px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.35;
}

.omni-image-library-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font-size: 30px;
  line-height: 1;
  padding: 2px 6px;
}

.omni-image-library-close:hover {
  color: #1e293b;
}

.omni-image-library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: #f8fafc;
  border-bottom: 1px solid #d9e2ef;
}

.omni-image-library-search {
  position: relative;
  flex: 1 1 360px;
  max-width: 440px;
}

.omni-image-library-search span {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 14px;
}

.omni-image-library-search input {
  width: 100%;
  height: 40px;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  background: #ffffff;
  color: #1e293b;
  font: 600 14px/1.2 "Outfit", system-ui, sans-serif;
  outline: none;
  padding: 8px 38px 8px 36px;
}

.omni-image-library-search input:focus {
  border-color: #4f883d;
  box-shadow: 0 0 0 3px rgba(79, 136, 61, 0.16);
}

.omni-image-library-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: 0;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.omni-image-library-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 8px;
  background: #eef6eb;
  color: #365f2b;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.omni-image-library-upload input {
  display: none;
}

.omni-image-library-count {
  color: #4f883d;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.omni-image-library-body {
  min-height: 0;
  flex: 1;
  display: flex;
  overflow: hidden;
}

.omni-image-library-categories {
  width: 240px;
  overflow-y: auto;
  background: #f8fafc;
  border-right: 1px solid #d9e2ef;
  padding: 12px;
}

.omni-image-library-category {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font: 800 13px/1.2 "Outfit", system-ui, sans-serif;
  padding: 10px 12px;
  text-align: left;
}

.omni-image-library-category:hover {
  background: rgba(15, 23, 42, 0.04);
  color: #1e293b;
}

.omni-image-library-category.is-active {
  background: rgba(79, 136, 61, 0.1);
  color: #4f883d;
}

.omni-image-library-category-count {
  min-width: 24px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  color: #64748b;
  font-size: 11px;
  line-height: 1;
  padding: 4px 7px;
  text-align: center;
}

.omni-image-library-category.is-active .omni-image-library-category-count {
  background: rgba(79, 136, 61, 0.18);
  color: #4f883d;
}

.omni-image-library-grid-wrap {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  background: #f1f5f9;
  padding: 24px;
}

.omni-image-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 16px;
}

.omni-image-library-card {
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.omni-image-library-card:hover {
  transform: translateY(-2px);
  background: #f8fafc;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.omni-image-library-card.is-selected {
  border-color: #4f883d;
  background: rgba(79, 136, 61, 0.06);
}

.omni-image-library-card.is-selected::before {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #4f883d;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
}

.omni-image-library-card img {
  max-width: 88%;
  max-height: 88%;
  object-fit: contain;
}

.omni-image-library-empty {
  padding: 48px 16px;
  color: #64748b;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.omni-image-library-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid #d9e2ef;
}

.omni-image-library-button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font: 800 14px/1 "Outfit", system-ui, sans-serif;
  padding: 10px 16px;
}

.omni-image-library-button.is-secondary {
  background: #e2e8f0;
  color: #334155;
}

.omni-image-library-button.is-primary {
  background: #4f883d;
  color: #ffffff;
}

.omni-image-library-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

@media (max-width: 760px) {
  .omni-image-library-modal {
    padding: 16px;
  }

  .omni-image-library-dialog {
    width: 100%;
    max-height: calc(100dvh - 32px);
    min-height: calc(100dvh - 32px);
  }

  .omni-image-library-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .omni-image-library-search {
    max-width: none;
  }

  .omni-image-library-body {
    flex-direction: column;
  }

  .omni-image-library-categories {
    width: 100%;
    max-height: 152px;
    border-right: 0;
    border-bottom: 1px solid #d9e2ef;
  }

  .omni-image-library-grid-wrap {
    padding: 16px;
  }

  .omni-image-library-grid {
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 12px;
  }
}
