.admin {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px var(--gutter) 64px;
}

.admin h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 1.2rem + 1vw, 2.1rem);
  margin: 8px 0 18px;
}

.item-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.item-head h1 {
  margin: 8px 0 18px;
}

.item-head > a {
  margin: 0 0 10px auto;
  font-weight: 700;
  white-space: nowrap;
}

.item-head form {
  margin: 0 0 10px;
  flex: none;
}

.item-head .icon-btn {
  width: 44px;
  height: 44px;
}

.item-head .icon-btn svg {
  width: 26px;
  height: 26px;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin-bottom: 22px;
}

.admin-nav a,
.admin-nav button {
  color: var(--bg-deep);
  font-weight: 700;
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0 0 2px;
  cursor: pointer;
  font: inherit;
}

.admin-nav a.is-current {
  color: var(--accent-text);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.admin-nav .who {
  margin-left: auto;
  color: var(--muted);
  font-weight: 600;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.cards a {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  text-decoration: none;
  color: inherit;
}

.cards b {
  display: block;
  font-size: 1.6rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
}

.table th,
.table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table a {
  color: inherit;
  font-weight: 700;
}

.table form {
  margin: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.icon-btn--danger {
  color: #c62828;
}

.icon-btn--danger:hover {
  background: #fdecea;
}

.thumb {
  width: 54px;
  height: 40px;
  object-fit: contain;
  background: #f6f8f8;
  border-radius: 4px;
}

.form {
  display: grid;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.search-form {
  grid-template-columns: minmax(0, 1fr) minmax(180px, 280px);
  align-items: start;
}

.search-form > label {
  grid-template-rows: auto 44px;
}

.search-form .search,
.search-form select {
  height: 44px;
  min-height: 0;
}

.form label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
}

.search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.form input,
.form textarea,
.form select {
  font: inherit;
  font-weight: 500;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 100%;
  background: #fff;
}

.form .search input {
  padding-left: 38px;
}

.form textarea {
  min-height: 140px;
  resize: vertical;
}

.form .hint {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.86rem;
}

.picker {
  display: grid;
  gap: 8px;
}

.picker__label {
  margin: 0;
  font-weight: 700;
}

.picker__chosen {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.picker__chosen:empty {
  display: none;
}

.picker__thumb {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 4px;
  background: #f6f8f8;
  flex: none;
}

.picker__chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  margin: 0;
  padding: 4px 8px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-weight: 600;
}

.picker__chip small,
.picker__results small {
  font-weight: 500;
  color: var(--muted);
}

.picker__results small {
  margin-left: auto;
}

.picker__chip button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
}

.picker__results {
  margin: 0;
  padding: 4px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  max-height: 240px;
  overflow: auto;
}

.picker__results button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.picker__results button.is-active,
.picker__results button:hover {
  background: #f6f8f8;
}

.picker__empty {
  padding: 8px 10px;
  color: var(--muted);
  font-weight: 500;
}

.cover {
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8f8;
}

.cover__photos {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.cover__photos img {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  height: 260px;
  object-fit: contain;
  border-radius: 4px;
}

.cover__empty {
  margin: 0;
  padding: 28px 16px 4px;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
}

.form .cover__edit {
  justify-self: center;
}

.pdf-box {
  display: grid;
  gap: 10px;
}

.pdf-box__title,
.pdf-box__empty {
  margin: 0;
}

.pdf-box__title {
  font-weight: 700;
}

.pdf-box__doc {
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f6f8f8;
  color: inherit;
  text-decoration: none;
}

.pdf-box__doc img {
  width: 28px;
  height: 35px;
  flex: none;
}

.pdf-box__doc span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.pdf-box__doc small {
  font-weight: 500;
  color: var(--muted);
}

.pdf-box__doc strong {
  overflow-wrap: anywhere;
}

.pdf-box__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.form .pdf-box__file {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.note,
.err {
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 14px;
}

.note {
  background: #e7f6ef;
  color: #0f4c45;
}

.err {
  background: #fff1ec;
  color: #9a3412;
}

.login {
  max-width: 420px;
  margin: 10vh auto;
}

@media (max-width: 720px) {
  .search-form {
    grid-template-columns: 1fr;
  }
  .cards {
    grid-template-columns: 1fr;
  }
  .admin-nav .who {
    margin-left: 0;
    width: 100%;
  }
}
