:root {
  color-scheme: light;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  color: #1f2933;
  background: #f5f7f6;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: #f5f7f6;
  color: #1f2933;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
select {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

a,
button,
input,
select {
  border-radius: 6px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #286c49;
  outline-offset: 2px;
}

.admin-header {
  border-bottom: 1px solid #d9dfdc;
  background: #ffffff;
}

.admin-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1180px, calc(100% - 40px));
  min-height: 64px;
  margin: 0 auto;
}

.admin-header h1 {
  margin: 0;
  color: #17201c;
  font-size: 22px;
  line-height: 1.3;
}

.admin-header__actions,
.form-actions,
.dialog-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.secondary-link,
.secondary-button,
.primary-button,
.danger-button {
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid #b9c4bf;
  background: #ffffff;
  color: #26342e;
  font-weight: 650;
  text-decoration: none;
}

.secondary-link:hover,
.secondary-button:hover {
  background: #edf0ee;
}

.primary-button {
  border-color: #286c49;
  background: #286c49;
  color: #ffffff;
}

.primary-button:hover {
  background: #20583c;
}

.danger-button {
  border-color: #b42318;
  background: #b42318;
  color: #ffffff;
}

.admin-main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.page-feedback {
  display: flex;
  align-items: center;
  min-height: 42px;
  gap: 12px;
}

#adminPageStatus {
  margin: 0;
  color: #5e6b65;
}

#adminPageStatus.admin-page-status--error,
.form-error {
  color: #b42318;
}

.admin-band {
  padding: 28px 0 34px;
  border-top: 1px solid #d9dfdc;
}

.admin-band:first-of-type {
  margin-top: 12px;
}

.band-heading h2 {
  margin: 0;
  color: #17201c;
  font-size: 18px;
}

.admin-form {
  display: grid;
  align-items: end;
  gap: 12px;
  margin-top: 16px;
  padding: 16px 0 18px;
}

.category-form {
  grid-template-columns: minmax(220px, 420px) auto;
}

.link-form {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, 0.7fr) auto;
}

.field-group {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.field-group label {
  color: #45524c;
  font-size: 13px;
  font-weight: 650;
}

.field-group input,
.field-group select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #aebbb5;
  background: #ffffff;
  color: #17201c;
}

.form-error {
  grid-column: 1 / -1;
  min-height: 21px;
  margin: 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.admin-list-heading,
.admin-row {
  display: grid;
  align-items: center;
  gap: 14px;
}

.admin-list-heading {
  min-height: 34px;
  padding: 0 10px;
  border-bottom: 1px solid #bfc9c4;
  color: #68756f;
  font-size: 12px;
  font-weight: 650;
}

.category-list-heading,
.category-row {
  grid-template-columns: minmax(180px, 1fr) 90px 174px;
}

.link-list-heading,
.link-row {
  grid-template-columns: minmax(120px, 0.9fr) minmax(180px, 1.5fr) minmax(100px, 0.7fr) 174px;
}

.admin-row {
  min-height: 52px;
  padding: 7px 10px;
  border-bottom: 1px solid #e0e5e2;
  background: #ffffff;
}

.admin-row__primary,
.admin-row__url,
.admin-row__category {
  min-width: 0;
  overflow-wrap: anywhere;
}

.admin-row__primary {
  color: #17201c;
  font-weight: 650;
}

.admin-row__url,
.admin-row__category,
.admin-row__count {
  color: #5e6b65;
  font-size: 13px;
}

.admin-row__url {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.admin-row__actions {
  display: grid;
  grid-template-columns: repeat(4, 36px);
  gap: 6px;
  justify-content: end;
  width: 162px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #b9c4bf;
  background: #ffffff;
  color: #286c49;
  font-size: 18px;
  line-height: 1;
}

.icon-button:hover:not(:disabled) {
  background: #edf5f0;
}

.icon-button--danger {
  border-color: #b42318;
  color: #b42318;
}

.icon-button--danger:hover:not(:disabled) {
  background: #fff1f0;
}

.admin-dialog {
  width: min(420px, calc(100% - 32px));
  padding: 0;
  border: 1px solid #bfc9c4;
  border-radius: 8px;
  background: #ffffff;
  color: #1f2933;
  box-shadow: 0 12px 32px rgb(31 41 51 / 18%);
}

.admin-dialog::backdrop {
  background: rgb(23 32 28 / 38%);
}

.dialog-form {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.dialog-form h2,
.dialog-form p {
  margin: 0;
}

.dialog-actions {
  justify-content: flex-end;
}

.admin-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 5;
  max-width: min(360px, calc(100% - 40px));
  margin: 0;
  padding: 10px 14px;
  border: 1px solid #88a996;
  border-radius: 6px;
  background: #ffffff;
  color: #20583c;
  box-shadow: 0 4px 16px rgb(31 41 51 / 12%);
  font-weight: 650;
}

@media (max-width: 720px) {
  .admin-header__inner,
  .admin-main {
    width: min(100% - 28px, 1180px);
  }

  .admin-header__inner {
    align-items: flex-start;
    padding: 14px 0;
  }

  .admin-header__actions {
    justify-content: flex-end;
  }

  .category-form,
  .link-form,
  .category-row,
  .link-row {
    grid-template-columns: 1fr;
  }

  .admin-list-heading {
    display: none;
  }

  .admin-row {
    gap: 6px;
    padding: 12px 8px;
  }

  .admin-row__actions {
    justify-content: start;
    margin-top: 4px;
  }

  .form-actions {
    align-self: start;
  }
}

@media (prefers-reduced-motion: no-preference) {
  button,
  a {
    transition: background-color 120ms ease, border-color 120ms ease;
  }
}
