:root {
  color: #181818;
  background: #fff;
  font-family: Inter, "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 400;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: #fff;
}

a,
button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.shell {
  width: min(100% - 48px, 1240px);
  margin: 0 auto;
  padding: 24px 0 72px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 72px;
}

.brand {
  color: #151515;
  font-size: 0.88rem;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #777;
  font-size: 0.78rem;
}

.search input {
  width: min(28vw, 320px);
  border: 0;
  border-bottom: 1px solid #cfcac2;
  border-radius: 0;
  padding: 7px 0;
  color: #151515;
  background: transparent;
  outline: none;
}

.search input:focus {
  border-color: #151515;
}

.add-button,
.save-button,
.delete-button,
.icon-button,
.menu-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.add-button,
.export-button,
.save-button {
  border: 1px solid #d8d3ca;
  border-radius: 5px;
  padding: 7px 12px;
  background: #faf8f2;
}

.index-table {
  border-top: 1px solid #d9d5cf;
}

.index-head,
.index-row {
  display: grid;
  grid-template-columns: 72px minmax(300px, 1fr) minmax(220px, 0.45fr) minmax(180px, 0.42fr);
  gap: 18px;
  align-items: center;
}

.index-table.is-admin .index-head,
.index-table.is-admin .index-row {
  grid-template-columns: 72px minmax(300px, 1fr) minmax(220px, 0.45fr) minmax(180px, 0.42fr) 36px;
}

.index-head {
  min-height: 34px;
  color: #8a877f;
  border-bottom: 1px solid #e4e0da;
  font-size: 0.72rem;
}

.index-row {
  position: relative;
  min-height: 46px;
  border-bottom: 1px solid #e4e0da;
  color: #222;
  transition: background-color 120ms ease, border-color 120ms ease;
  cursor: pointer;
}

.index-row:hover,
.index-row:focus-visible {
  border-color: #d3ccc0;
  background: #fbfaf7;
  outline: none;
}

.cell {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.number {
  color: #666;
  font-size: 0.82rem;
}

.title {
  font-size: 0.96rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.note {
  color: #68645d;
  font-size: 0.82rem;
}

.tags span {
  color: #737067;
  font-size: 0.78rem;
}

.tags span::before {
  content: "#";
  color: #bbb4a8;
}

.menu-button {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  color: #777;
  line-height: 1;
}

.menu-button:hover,
.menu-button:focus-visible {
  background: #efebe3;
  outline: none;
}

.empty {
  margin: 0;
  padding: 38px 0;
  color: #777;
}

.hover-preview {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 20;
  overflow: hidden;
  border: 1px solid rgba(35, 35, 35, 0.13);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.16);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  will-change: transform, opacity;
}

.hover-preview.is-visible {
  opacity: 1;
}

.hover-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #f3f0ea;
}

.preview-caption {
  display: flex;
  align-items: center;
  min-height: 54px;
  padding: 0 14px;
  border-top: 1px solid #ebe7df;
  color: #222;
  background: rgba(255, 255, 255, 0.94);
}

.preview-caption strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
  font-weight: 440;
}

.item-dialog {
  width: min(720px, calc(100% - 32px));
  border: 1px solid #d8d3ca;
  border-radius: 8px;
  padding: 0;
  background: #fff;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.2);
}

.item-dialog::backdrop {
  background: rgba(245, 243, 238, 0.7);
}

.item-dialog form {
  padding: 22px;
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.dialog-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 460;
}

.icon-button {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  font-size: 1.2rem;
}

.icon-button:hover {
  background: #f2eee7;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 24px 0;
}

.form-grid label {
  display: grid;
  gap: 6px;
  color: #777;
  font-size: 0.76rem;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.form-grid input,
.form-grid textarea {
  width: 100%;
  border: 1px solid #d8d3ca;
  border-radius: 5px;
  padding: 9px 10px;
  color: #181818;
  background: #fff;
  outline: none;
}

.form-grid input:focus,
.form-grid textarea:focus {
  border-color: #1d1d1d;
}

.auto-image-button {
  border: 1px solid #d8d3ca;
  border-radius: 5px;
  padding: 9px 12px;
  color: #333;
  background: #faf8f2;
  cursor: pointer;
  text-align: center;
}

.delete-button {
  color: #8e3c31;
}

@media (max-width: 780px) {
  .shell {
    width: calc(100% - 28px);
    padding-top: 16px;
  }

  .topbar,
  .actions {
    display: block;
  }

  .actions {
    justify-content: space-between;
    margin-top: 18px;
  }

  .search input {
    width: 48vw;
  }

  .index-table {
    overflow-x: auto;
  }

  .index-head,
  .index-row {
    grid-template-columns: 54px minmax(220px, 1fr) 170px 160px;
    min-width: 640px;
  }

  .index-table.is-admin .index-head,
  .index-table.is-admin .index-row {
    grid-template-columns: 54px minmax(220px, 1fr) 170px 160px 36px;
    min-width: 680px;
  }

  .hover-preview {
    display: none;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}
