.literature-search-dialog-close {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--panel-muted);
  cursor: pointer;
  place-items: center;
}

.literature-search-dialog-close:hover { background: #f2f5f7; color: var(--panel-text); }

.literature-panel-error {
  margin: 0 0 13px;
  padding: 10px 12px;
  border: 1px solid #ead7bd;
  border-radius: 7px;
  background: #fffaf3;
  color: #7b5b2c;
  font-size: 13px;
}

.literature-panel-error { border-color: #edc4c4; background: #fff7f7; color: #913c3c; }

.literature-task-slots {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 13px;
  align-items: stretch;
}

.literature-task-slot {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: visible;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: #fff;
  color: var(--panel-text);
  text-align: left;
}

.literature-task-slot-empty {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  min-height: 184px;
  padding: 26px;
  border-style: dashed;
  border-color: #aec5d3;
  color: var(--panel-muted);
  cursor: pointer;
  font: inherit;
  text-align: center;
  transition: border-color .16s ease, background-color .16s ease, color .16s ease;
}

.literature-task-slot-empty:hover { border-color: #6fa5c2; background: #f8fcfe; color: var(--panel-primary); }
.literature-task-slot-empty:disabled { border-color: var(--panel-line); background: #f3f4f5; color: var(--panel-subtle); cursor: not-allowed; }

.literature-task-slot-add {
  display: grid;
  width: 42px;
  height: 42px;
  margin-bottom: 4px;
  border: 1px solid #a8c3d3;
  border-radius: 50%;
  background: #edf5f8;
  place-items: center;
  font-size: 14px;
}

.literature-task-slot-empty strong { color: currentColor; font-size: 16px; font-weight: 600; }
.literature-task-slot-empty > span:last-child { color: var(--panel-subtle); font-size: 12px; }

.literature-task-slot-link,
.literature-task-slot-body {
  display: flex;
  min-width: 0;
  min-height: 0;
  padding: 16px;
  flex-direction: column;
}

.literature-task-slot-link { color: inherit; text-decoration: none; }
.literature-task-slot-link:hover h3 { color: var(--panel-primary); }

.literature-task-slot-badge {
  align-self: flex-start;
  margin-bottom: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #e1f0f8;
  color: #17658f;
  font-size: 11px;
  font-weight: 700;
}

.literature-task-slot-badge.is-running { background: #eef5ff; color: #416b9a; }
.literature-task-slot-badge.is-failed { background: #fff0f0; color: #ad3e3e; }

.literature-task-slot h3 {
  max-width: calc(100% - 42px);
  margin: 0;
  overflow-wrap: anywhere;
  color: #123b5c;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
}

.literature-task-slot-query {
  display: -webkit-box;
  min-height: 39px;
  margin: 0;
  overflow: hidden;
  color: var(--panel-muted);
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.literature-task-slot-facts {
  display: grid;
  grid-template-columns: minmax(72px, .7fr) minmax(0, 1.3fr);
  gap: 16px;
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--panel-line);
}

.literature-task-article-count,
.literature-task-dates { min-width: 0; }

.literature-task-article-count {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.literature-task-article-count span,
.literature-task-dates span {
  color: var(--panel-subtle);
  font-size: 11px;
  font-weight: 400;
}

.literature-task-article-count strong {
  color: #123b5c;
  font-size: 16px;
  font-weight: 700;
}

.literature-task-dates {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.literature-task-dates time {
  color: var(--panel-text);
  font-variant-numeric: tabular-nums;
  font-weight: 400;
}
.literature-task-retention-warning {
  margin: 8px 0 0;
  color: #ad3e3e;
  font-size: 11px;
  line-height: 1.4;
}

.literature-task-slot-menu {
  position: absolute;
  top: 13px;
  right: 13px;
  z-index: 3;
}

.literature-task-slot-menu summary {
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--panel-muted);
  cursor: pointer;
  list-style: none;
  place-items: center;
}

.literature-task-slot-menu summary::-webkit-details-marker { display: none; }
.literature-task-slot-menu summary:hover,
.literature-task-slot-menu[open] summary { border-color: var(--panel-line); background: #f5f8fa; color: var(--panel-text); }

.literature-task-slot-menu-items {
  position: absolute;
  top: 40px;
  right: 0;
  width: 132px;
  padding: 5px;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(17, 59, 92, .15);
}

.literature-task-slot-menu-items button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--panel-text);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  text-align: left;
}

.literature-task-slot-menu-items button:hover { background: #f3f6f8; }
.literature-task-slot-menu-items button.is-danger { color: #ad3e3e; }

.literature-panel-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
}

.literature-panel-button.primary { border-color: var(--panel-primary); background: var(--panel-primary); color: #fff; }
.literature-panel-button.primary:hover { border-color: var(--panel-primary-hover); background: var(--panel-primary-hover); }
.literature-panel-button.secondary { border-color: var(--panel-line-strong); background: #fff; color: var(--panel-muted); }
.literature-panel-button.danger { color: #ad3e3e; }
.literature-panel-button:disabled { opacity: .58; cursor: wait; }

.literature-task-run-note {
  margin: auto 0 0;
  padding-top: 22px;
  color: var(--panel-subtle);
  font-size: 11px;
  line-height: 1.65;
}

.literature-task-failure {
  margin: 15px 0;
  padding: 10px 11px;
  border-left: 3px solid #d64545;
  background: #fff7f7;
  color: #874040;
  font-size: 12px;
}
.literature-task-failure strong { display: block; }
.literature-task-failure p { margin: 3px 0 0; overflow-wrap: anywhere; }

.literature-search-dialog {
  width: min(590px, calc(100% - 28px));
  max-height: min(700px, calc(100vh - 28px));
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--panel-line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(17, 59, 92, .24);
  color: var(--panel-text);
}
.literature-search-dialog::backdrop { background: rgba(17, 46, 68, .46); }
.literature-panel-form { display: grid; gap: 17px; padding: 24px; }
.literature-panel-form > h2 { margin: 0; font-size: 18px; font-weight: 600; }
.literature-search-dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.literature-search-dialog-heading h2 { margin: 0; font-size: 19px; font-weight: 600; }
.literature-panel-field { display: grid; gap: 7px; }
.literature-panel-field label { color: var(--panel-text); font-size: 13px; font-weight: 500; }
.literature-panel-field input,
.literature-panel-field textarea {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--panel-line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--panel-text);
  font: inherit;
  font-size: 14px;
  line-height: 1.55;
}
.literature-panel-field input[readonly] { background: #f5f6f7; color: var(--panel-muted); }
.literature-panel-field textarea { min-height: 145px; resize: vertical; }
.literature-search-preview {
  min-width: 0;
  padding-top: 14px;
  border-top: 1px solid var(--panel-line);
}
.literature-search-preview-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  color: var(--panel-muted);
  font-size: 12px;
}
.literature-search-preview-summary strong {
  color: var(--panel-text);
  font-size: 18px;
  font-weight: 600;
}
.literature-search-preview-chart {
  margin-top: 12px;
  min-width: 0;
}
.literature-search-preview .year-mini-shell {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 60px;
  overflow: hidden;
}
.literature-search-preview .year-mini-viewport {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 60px;
  overflow: hidden;
}
.literature-search-preview .year-mini-chart {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 0;
  width: max-content;
  min-width: 0;
  height: 60px;
}
.literature-search-preview .year-filter-col {
  display: grid;
  flex: 0 0 23px;
  width: 23px;
  grid-template-rows: 12px 31px 10px;
  gap: 2px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: center;
  cursor: pointer;
  transition: opacity .15s ease;
}
.literature-search-preview .year-filter-col:hover,
.literature-search-preview .year-filter-col:focus-visible {
  border: 0;
  border-radius: 4px;
  background: rgba(23,75,112,.06);
  box-shadow: none;
  outline: 0;
}
.literature-search-preview .year-filter-col.is-muted { opacity: .32; }
.literature-search-preview .year-filter-col.is-selected {
  border-radius: 4px;
  background: rgba(23,75,112,.09);
}
.literature-search-preview .year-mini-count {
  align-self: end;
  color: #355d78;
  font-size: 9px;
  font-weight: 750;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.literature-search-preview .year-mini-track {
  position: relative;
  justify-self: center;
  width: 20px;
  height: 31px;
  overflow: hidden;
  border-radius: 4px 4px 2px 2px;
}
.literature-search-preview .year-mini-fill {
  position: absolute;
  inset: auto 0 0;
  border-radius: 3px 3px 1px 1px;
  background: linear-gradient(180deg,#b7c8d2,#6f8d9e);
}
.literature-search-preview .year-filter-col.is-selected .year-mini-fill { background: #174b70; }
.literature-search-preview .year-mini-label {
  color: #6b8495;
  font-size: 7.5px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.literature-search-preview .year-scroll {
  position: absolute;
  z-index: 2;
  top: 50%;
  visibility: hidden;
  width: 22px;
  height: 28px;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: 6px;
  background-color: rgba(23,75,112,.09) !important;
  background-image: none !important;
  box-shadow: none !important;
  color: #174b70;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.literature-search-preview .year-scroll-prev { left: 0; }
.literature-search-preview .year-scroll-next { right: 0; }
.literature-search-preview .year-mini-shell.is-overflowing .year-scroll { visibility: visible; }
.literature-search-preview .year-mini-shell .year-scroll:disabled { visibility: hidden; }
.literature-search-preview .year-scroll:hover:not(:disabled),
.literature-search-preview .year-scroll:focus-visible { background-color: rgba(23,75,112,.16) !important; }
.literature-search-preview .year-scroll:active:not(:disabled) {
  background-color: rgba(23,75,112,.22) !important;
}
.literature-search-preview > p {
  margin: 8px 0 0;
  color: var(--panel-subtle);
  font-size: 11px;
  line-height: 1.6;
}
.literature-panel-form-error { margin: -5px 0 0; color: #ad3e3e; font-size: 12px; }
.literature-search-dialog-actions { display: flex; justify-content: flex-end; gap: 9px; }

.literature-task-slot-empty:focus-visible,
.literature-task-slot-link:focus-visible,
.literature-panel-button:focus-visible,
.literature-task-slot-menu summary:focus-visible,
.literature-search-dialog-close:focus-visible {
  outline: 2px solid #2779a7;
  outline-offset: 2px;
}

@media (max-width: 760px) {
  .literature-task-slot.is-running .literature-task-slot-body { min-height: 210px; }
}

@media (max-width: 430px) {
  .literature-task-slot-link,
  .literature-task-slot-body { padding: 18px; }
  .literature-panel-form { padding: 19px; }
  .literature-search-dialog-actions .literature-panel-button { flex: 1; }
}
