.store-template-section {
  margin-bottom: 14px;
  border: 1px solid #355a61;
  border-radius: 7px;
  padding: 12px;
  background: #14272b;
}

.store-template-section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.store-template-section__head > div {
  min-width: 0;
  flex: 1;
}

.store-template-section__head strong,
.store-template-section__head span {
  display: block;
}

.store-template-section__head strong {
  color: #edfff9;
  font-size: 17px;
}

.store-template-section__head span {
  margin-top: 3px;
  color: #a9c5c3;
  font-size: 11px;
  line-height: 1.5;
}

.store-template-section__head label {
  width: min(240px, 22vw);
  flex: 0 0 auto;
  color: #c3d6d8;
  font-size: 11px;
}

.store-template-section__head input,
.store-template-section__head select {
  width: 100%;
  margin-top: 4px;
}

.store-template-legacy {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  color: #b8d3cc;
  font-size: 12px;
}

.store-template-legacy[hidden] {
  display: none;
}

.store-template-section > output {
  display: block;
  margin-bottom: 8px;
  color: #b8d3cc;
  font-size: 12px;
}

.store-template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 9px;
}

.store-tool-card {
  display: grid;
  min-width: 0;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  border: 1px solid #38505e;
  border-radius: 7px;
  padding: 10px;
  background: #16232c;
  color: #eaf4f8;
  text-align: left;
  cursor: pointer;
}

.store-tool-card:hover,
.store-tool-card:focus-visible {
  border-color: #62cda1;
  background: #1b3238;
  outline: 2px solid rgba(98, 205, 161, 0.2);
}

.store-tool-card__icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(145deg, var(--tool-color, #2b8bb9), color-mix(in srgb, var(--tool-color, #2b8bb9) 70%, #111));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
}

.store-tool-card__copy {
  min-width: 0;
}

.store-tool-card__copy strong,
.store-tool-card__copy span {
  display: block;
}

.store-tool-card__copy strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.store-tool-card__copy span {
  margin-top: 3px;
  color: #96aab7;
  font-size: 10px;
  line-height: 1.4;
}

.store-template-empty {
  grid-column: 1 / -1;
  min-height: 150px;
  display: grid;
  place-items: center;
  border: 1px dashed #415766;
  border-radius: 7px;
  color: #92a5b1;
}

.store-tool-dialog {
  width: min(900px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  border: 1px solid #56717d;
  border-radius: 9px;
  padding: 0;
  overflow: hidden;
  background: #111a22;
  color: #edf6fa;
  box-shadow: 0 22px 64px rgba(0, 0, 0, 0.55);
}

.store-tool-dialog::backdrop {
  background: rgba(0, 0, 0, 0.76);
}

.store-tool-dialog__shell {
  display: grid;
  max-height: calc(100vh - 26px);
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.store-tool-dialog__head,
.store-tool-dialog__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: #172630;
}

.store-tool-dialog__head {
  border-bottom: 1px solid #415764;
}

.store-tool-dialog__head strong,
.store-tool-dialog__head span {
  display: block;
}

.store-tool-dialog__head strong {
  font-size: 16px;
}

.store-tool-dialog__head span {
  margin-top: 2px;
  color: #9db0ba;
  font-size: 11px;
}

.store-tool-dialog__head button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  font-size: 20px;
}

.store-tool-dialog__body {
  display: grid;
  grid-template-columns: minmax(300px, 1.15fr) minmax(260px, 0.85fr);
  gap: 12px;
  overflow: auto;
  padding: 12px;
}

.store-tool-form {
  display: grid;
  gap: 8px;
  align-content: start;
}

.store-tool-form label {
  color: #b8c7ce;
  font-size: 11px;
}

.store-tool-form textarea {
  min-height: 98px;
}

.store-tool-form__row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.store-tool-preview {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 8px;
}

.store-tool-preview canvas {
  display: block;
  width: 100%;
  max-height: 520px;
  border: 1px solid #4d6370;
  border-radius: 7px;
  background: #fff;
  object-fit: contain;
}

.store-tool-preview output {
  min-height: 72px;
  border: 1px solid #374c58;
  border-radius: 6px;
  padding: 8px;
  background: #0c151b;
  color: #dce8ed;
  font-size: 11px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.store-tool-dialog__actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  border-top: 1px solid #415764;
}

.store-tool-dialog__actions button {
  min-height: 32px;
  padding: 0 11px;
  font-size: 11px;
}

.store-tool-dialog__actions .is-primary {
  border-color: #48bf83;
  background: #19764c;
}

@media (max-width: 760px) {
  .store-template-section__head {
    align-items: stretch;
    flex-direction: column;
  }

  .store-template-section__head label {
    width: 100%;
  }

  .store-template-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .store-tool-card {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 7px;
    padding: 8px;
  }

  .store-tool-card__icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    font-size: 15px;
  }

  .store-tool-dialog__body {
    grid-template-columns: 1fr;
  }

  .store-tool-form__row {
    grid-template-columns: 1fr;
  }
}
