.meta-grid {
  grid-template-columns: 270px minmax(0, 1fr) 130px !important;
}

.topic-control {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) max-content;
  gap: 6px;
}

.topic-control button {
  align-self: end;
  width: auto !important;
  min-width: 72px;
  height: 38px;
  margin-top: 6px;
  padding: 0 11px !important;
  border: 1px solid #d8c8bb;
  border-radius: 5px;
  background: #fff;
  color: #9d5d43;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.category-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(34 29 25 / 48%);
}

.category-modal[hidden] {
  display: none;
}

.category-panel {
  width: min(680px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  padding: 22px;
  border: 1px solid #decfc2;
  border-radius: 7px;
  background: #fffdf9;
  box-shadow: 0 20px 55px rgb(47 36 29 / 24%);
}

.category-head,
.category-row,
.category-row-actions {
  display: flex;
  align-items: center;
}

.category-head {
  justify-content: space-between;
  margin-bottom: 16px;
}

.category-head strong {
  display: block;
  font-size: 18px;
}

.category-head small {
  display: block;
  margin-top: 2px;
  color: #8b776a;
}

.category-head > button {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: #6c594d;
  font-size: 23px;
  cursor: pointer;
}

.category-list {
  border-top: 1px solid #e5d9cf;
}

.category-row {
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid #e5d9cf;
}

.category-fields {
  display: grid;
  flex: 1;
  grid-template-columns: 150px minmax(180px, 1fr);
  gap: 8px;
}

.category-fields input {
  margin: 0;
}

.category-row-actions {
  flex: 0 0 auto;
  gap: 6px;
}

.category-row-actions small {
  width: 58px;
  color: #8b776a;
  text-align: right;
}

.category-row-actions button,
.new-category-form button {
  height: 34px;
  padding: 0 11px;
  border: 1px solid #d8c8bb;
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
}

.category-row-actions button:disabled {
  cursor: not-allowed;
  opacity: .42;
}

.new-category-form {
  display: grid;
  grid-template-columns: 150px minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 20px;
  padding: 16px;
  border: 1px solid #e1d3c7;
  border-radius: 6px;
  background: #f8f2ec;
}

.new-category-form > strong,
.new-category-form .account-error {
  grid-column: 1 / -1;
}

.new-category-form .primary {
  border: 0;
  background: #a96146;
  color: #fff;
}

@media (max-width: 680px) {
  .meta-grid {
    grid-template-columns: 1fr !important;
  }

  .category-row {
    align-items: stretch;
    flex-direction: column;
  }

  .category-fields,
  .new-category-form {
    grid-template-columns: 1fr;
  }

  .category-row-actions {
    justify-content: flex-end;
  }

  .new-category-form > strong,
  .new-category-form .account-error {
    grid-column: auto;
  }
}
