/* Reports library (QA #376): the save ("Clone this report") drawer and the small action
 * modals (Choose a new owner, Set report tags), taken as-is from the 13 Nov design's
 * reports-dashboard.css: only the rules for .reports-clone-*, .reports-action-*,
 * .reports-tags-select, .reports-owner-select and .reports-custom-select, so the rest of
 * that file (page-wide rules for the dashboard page) is not loaded on every page. */

.reports-action-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1120;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgb(12 24 40 / 48%);
}

.reports-action-modal {
  width: min(440px, 100%);
  max-height: min(90vh, 760px);
  overflow: visible;
  padding: 1.25rem;
  border: 1px solid var(--border, #d9e0e7);
  border-radius: var(--radius-lg, 0.75rem);
  background: var(--surface, #fff);
  color: var(--text, #273444);
  box-shadow: var(--shadow, 0 12px 36px rgb(20 35 50 / 18%));
}

.reports-action-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: -0.1rem 0 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border, #d9e0e7);
}

.reports-action-modal__header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.reports-action-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border: 0;
  border-radius: var(--radius-md, 0.5rem);
  background: transparent;
  color: var(--text-muted, #6b7280);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.reports-action-close:hover {
  background: var(--surface-hover);
  color: var(--text, #273444);
}

.reports-action-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0.9rem 0;
  color: var(--text, #273444);
  font-size: 0.82rem;
  font-weight: 600;
}

.reports-action-field > span em {
  color: var(--danger, #d92d20);
  font-style: normal;
}

.reports-action-field input,
.reports-action-field select,
.reports-action-field textarea {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border, #d9e0e7);
  border-radius: var(--radius-md, 0.5rem);
  background: var(--surface, #fff);
  color: var(--text, #273444);
  font: inherit;
  font-weight: 400;
}

.reports-action-field textarea {
  min-height: 80px;
  resize: none !important;
  line-height: 1.45;
}

.reports-action-field small {
  align-self: flex-start;
  color: var(--text-muted, #6b7280);
  font-size: 0.75rem;
  font-weight: 400;
}

.reports-action-choice {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 0.8rem 0;
  color: var(--text, #273444);
  font-size: 0.875rem;
  font-weight: 500;
}

.reports-action-choice input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-top: 0.15rem;
  accent-color: var(--brand, var(--brand-primary, #2457e6));
}

.reports-action-help {
  margin: 0.9rem 0;
  color: var(--text-muted, #6b7280);
  font-size: 0.78rem;
  line-height: 1.5;
}

.reports-action-section-label {
  margin: 1.2rem 0 0.6rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.reports-action-modal__footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border, #d9e0e7);
}

.reports-action-backdrop--drawer {
  display: flex;
  justify-content: flex-end;
  padding: 0;
}

.reports-save-drawer .reports-action-modal__header {
  flex: 0 0 auto;
}

.reports-action-field[hidden] {
  display: none !important;
}

@media (max-width: 640px) {
  .reports-action-backdrop {
    padding: 0.5rem;
  }
  .reports-action-backdrop--drawer {
    padding: 0;
  }
  .reports-action-modal {
    padding: 1rem;
  }
}

.reports-action-field .custom-select-wrapper.is-open {
  z-index: 50;
}

.reports-custom-select {
  max-width: 100%;
}

.reports-custom-select .custom-select-trigger,
.reports-custom-select .custom-select-button {
  max-width: 100%;
}

.reports-action-modal--rename,
.reports-action-modal--export,
.reports-action-modal--move {
  max-width: 520px;
}

.reports-action-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--text, #273444);
}

.reports-action-field > span {
  font-weight: 600;
}

.reports-action-field input,
.reports-action-field select,
.reports-action-field textarea {
  width: 100%;
  min-height: 38px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border, #d9e0e7);
  border-radius: var(--radius-md, 0.375rem);
  background: var(--surface, #fff);
  color: var(--text, #273444);
  font: inherit;
  font-size: 0.875rem;
}

.reports-action-field textarea {
  min-height: 70px;
  resize: vertical;
}

.reports-action-help {
  font-size: 0.8125rem;
  color: var(--text-muted, #64748b);
  margin-top: 0.35rem;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.reports-action-modal__notice {
  font-size: 0.875rem;
  color: var(--text, #273444);
  margin: 0.75rem 0;
  line-height: 1.45;
}

.reports-action-warning {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--warning, #d99500);
  border-radius: var(--radius-md, 0.5rem);
  background: var(--warning-bg,#fff8e8);
  color: var(--text, #273444);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.reports-action-warning strong {
  color: var(--brand-ink, var(--brand, #005c5c));
}

.reports-action-error {
  color: var(--danger, #c43c3c) !important;
  font-size: 0.8125rem !important;
  font-weight: 600 !important;
  margin-top: 0.25rem;
}

.reports-action-backdrop[data-widget-action-modal] {
  backdrop-filter: blur(3px);
}

.reports-action-backdrop--report-owner,
.reports-action-backdrop--report-tags {
  z-index: 1140;
}

.reports-action-modal--owner,
.reports-action-modal--tags {
  width: min(588px, calc(100vw - 2rem));
  padding: 1.25rem 1.5rem 1.5rem;
  border-radius: 1.25rem;
  overflow: visible;
}

.reports-action-modal--owner .reports-action-modal__header,
.reports-action-modal--tags .reports-action-modal__header {
  margin: 0 -1.5rem 1.25rem;
  padding: 0 1.5rem 1.1rem;
}

.reports-action-modal--owner .reports-action-modal__header h2,
.reports-action-modal--tags .reports-action-modal__header h2 {
  font-size: 1.25rem;
  font-weight: 650;
}

.reports-action-modal__body {
  min-width: 0;
}

.reports-action-modal--owner .reports-action-field,
.reports-action-modal--tags .reports-action-field {
  margin: 0;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.reports-action-modal--tags .reports-action-help {
  margin: -0.15rem 0 0.05rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.reports-owner-select,
.reports-tags-select {
  display: block;
  width: 100%;
  min-width: 0;
}

.reports-owner-select .custom-select__trigger,
.reports-tags-select .custom-select__trigger {
  min-height: 48px;
  padding: 0.7rem 1rem;
  border-radius: 0.7rem;
  border-color: var(--border-strong, #b8b8b8);
  color: var(--text, #273444);
  font-size: 1rem;
  background: var(--surface, #fff);
}

.reports-owner-select .custom-select__dropdown,
.reports-tags-select .custom-select__dropdown {
  top: calc(100% + 3px);
  min-width: 100%;
  max-height: min(430px, 58vh);
  overflow: hidden;
  border-radius: 1.25rem;
  border-color: var(--border, #d4d7dc);
  box-shadow: 0 18px 42px rgb(20 24 35 / 18%);
  z-index: 1160;
}

.reports-owner-select .custom-select__search {
  padding: 0.75rem 0.85rem;
  border-bottom: 0;
}

.reports-owner-select .custom-select__search input {
  min-height: 44px;
  border: 2px solid var(--brand, #0065e8);
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  font: inherit;
  font-size: 0.95rem;
  outline: none;
}

.reports-owner-select .custom-select__options,
.reports-tags-select .custom-select__options {
  max-height: min(300px, 40vh);
  padding: 0.25rem 0;
}

.reports-owner-select .custom-select__option,
.reports-tags-select .custom-select__option {
  padding: 0.7rem 1rem;
  font-size: 0.9rem;
}

.reports-owner-select .custom-select__option.is-selected,
.reports-tags-select .custom-select__option.is-selected {
  background: var(--surface-2, #f0f1f3);
}

.reports-owner-select__footer,
.reports-tags-select__footer {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border, #d4d7dc);
  background: var(--surface, #fff);
}

.reports-owner-select__footer button,
.reports-tags-select__footer a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--brand-ink, #005c5c);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
}

.reports-owner-select__footer button:hover,
.reports-tags-select__footer a:hover {
  text-decoration: underline;
}

.reports-tags-select__empty {
  padding: 1rem 1.25rem;
  color: var(--text-muted, #9ca3af);
  font-size: 0.9rem;
}

@media (max-width: 560px) {
  .reports-action-modal--owner,
  .reports-action-modal--tags {
    padding: 1rem;
  }
  .reports-action-modal--owner .reports-action-modal__header,
  .reports-action-modal--tags .reports-action-modal__header {
    margin: 0 -1rem 1rem;
    padding: 0 1rem 0.9rem;
  }
}

.reports-settings-field .custom-select-wrapper.reports-custom-select {
  width: 100%;
}

.reports-clone-backdrop:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 1090;
  display: block;
  background: rgba(24, 28, 34, 0.42);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}

.reports-clone-backdrop.popup-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.reports-clone-drawer[hidden],
.reports-clone-backdrop[hidden] {
  display: none !important;
}

.reports-clone-drawer:not([hidden]) {
  position: fixed;
  z-index: 1091;
  inset: 0 0 0 auto;
  display: flex;
  flex-direction: column;
  width: min(520px, 100vw);
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  overflow: visible;
  transform: translateX(0) !important;
  visibility: visible !important;
  opacity: 1 !important;
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: -12px 0 36px rgba(20, 24, 30, 0.12);
}

.reports-clone-drawer__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.5rem;
}

.reports-clone-drawer__footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.reports-clone-select-btn {
  height: 44px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  user-select: none;
  transition:
    border-color var(--fast) var(--ease),
    box-shadow var(--fast) var(--ease);
}

.reports-clone-select-btn:hover {
  background: var(--surface-hover);
  border-color: var(--brand);
}

.reports-clone-select-btn:focus-visible,
.reports-clone-tags-dropdown.is-open .reports-clone-select-btn,
.reports-clone-dash-dropdown.is-open .reports-clone-select-btn {
  border-color: var(--brand);
  outline: none;
  box-shadow: var(--focus-ring);
}

.reports-clone-select-btn svg,
.reports-clone-select-btn .icon {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform var(--fast) var(--ease);
}

.reports-clone-dash-dropdown.is-open .reports-clone-select-btn svg {
  transform: rotate(180deg);
}

.reports-clone-desc-textarea {
  min-height: 110px;
  max-height: 280px;
  resize: vertical;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.reports-clone-desc-textarea:focus {
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
  outline: none;
}

.reports-clone-gen-btn {
  color: var(--brand);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: transparent;
  transition: color var(--fast) var(--ease);
}

.reports-clone-gen-btn:hover {
  color: var(--brand-hover);
  text-decoration: underline;
}

.reports-clone-dash-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  width: 100% !important;
  min-width: 100% !important;
  box-sizing: border-box;
  z-index: 1050;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 8px;
}

.reports-clone-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: 6px;
}

.reports-clone-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
}

.reports-clone-search-icon svg,
.reports-clone-search-icon .icon {
  width: 14px !important;
  height: 14px !important;
  display: block;
}

.reports-clone-search-input {
  width: 100% !important;
  height: 36px !important;
  padding-left: 34px !important;
  padding-right: 12px !important;
  border-radius: var(--radius-pill) !important;
  border: 1px solid var(--border-strong) !important;
  background: var(--surface) !important;
  font-size: 13px !important;
  color: var(--text) !important;
  outline: none;
}

.reports-clone-search-input:focus {
  border-color: var(--brand) !important;
  box-shadow: var(--focus-ring) !important;
}

.reports-clone-dash-list {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.reports-clone-dash-list .dropdown__item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 12px;
  font-size: 13.5px;
  border-radius: var(--radius-sm, 6px);
  color: var(--text);
  cursor: pointer;
  transition: background var(--fast) var(--ease);
}

.reports-clone-dash-list .dropdown__item:hover,
.reports-clone-dash-list .dropdown__item:focus-visible {
  background: var(--surface-hover);
  outline: none;
}

.reports-clone-dash-list .dropdown__item.is-selected {
  background: var(--surface-3, #eef1f5);
  font-weight: 600;
}

.reports-clone-dash-select-wrap {
  width: 100%;
}

.reports-clone-dash-select-wrap[hidden] {
  display: none !important;
}

.reports-clone-drawer .check {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.reports-clone-drawer .check input {
  position: absolute;
  opacity: 0;
  width: 20px;
  height: 20px;
  margin: 0;
  cursor: pointer;
}

.reports-clone-drawer .check__box {
  flex: none;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  transition:
    background-color var(--fast) var(--ease),
    border-color var(--fast) var(--ease);
}

.reports-clone-drawer .check__box::after {
  content: "";
  width: 10px;
  height: 6px;
  border: 2px solid var(--brand-contrast, #ffffff);
  border-top: 0;
  border-right: 0;
  transform: rotate(-45deg) translate(1px, -1px) scale(0);
  transition: transform var(--fast) var(--ease);
}

.reports-clone-drawer .check input[type="checkbox"]:checked + .check__box {
  background: var(--brand);
  border-color: var(--brand);
}

.reports-clone-drawer
  .check
  input[type="checkbox"]:checked
  + .check__box::after {
  transform: rotate(-45deg) translate(1px, -1px) scale(1);
}

.reports-clone-drawer .check__box--radio {
  border-radius: 50% !important;
}

.reports-clone-drawer .check__box--radio::after {
  content: "" !important;
  width: 8px !important;
  height: 8px !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: var(--brand-contrast, #ffffff) !important;
  transform: scale(0) !important;
  transition: transform var(--fast) var(--ease) !important;
}

.reports-clone-drawer .check:hover .check__box--radio {
  border-color: var(--brand);
}

.reports-clone-drawer .check input[type="radio"]:checked + .check__box--radio {
  background: var(--brand) !important;
  border-color: var(--brand) !important;
}

.reports-clone-drawer
  .check
  input[type="radio"]:checked
  + .check__box--radio::after {
  transform: scale(1) !important;
}

.reports-clone-drawer .check input:focus-visible + .check__box {
  box-shadow: var(--focus-ring);
}
