body {
  font-family: system-ui, sans-serif;
  background: #181c23;
  color: #fff;
  margin: 0;
}
.app-flex {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 235px;
  background: #20232a;
  box-shadow: 2px 0 20px #0002;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  z-index: 10;
}
.sidebar h2 {
  margin: 0;
  padding: 32px 0 18px 35px;
  font-size: 1.4em;
  color: #82b6ff;
}
.menu {
  list-style: none;
  margin: 0;
  padding: 20px 0 0 0;
}
.menu li {
  padding: 15px 0 15px 35px;
  font-size: 1.09em;
  color: #bbc9e3;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.13s, border 0.14s;
  margin-bottom: 3px;
  user-select: none;
}
.menu li.active,
.menu li:hover {
  background: #253050;
  color: #fff;
  border-left: 3px solid #307afe;
}
.menu li.disabled,
.menu li.disabled:hover {
  color: #555c6d !important;
  background: none !important;
  cursor: default;
  border-left: 3px solid transparent;
}
.content-flex {
  flex: 1;
  background: #181c23;
}
@media (max-width: 820px) {
  .sidebar {
    width: 100px;
  }
  .sidebar h2 {
    display: none;
  }
  .menu li,
  .menu li.active {
    padding-left: 16px;
    font-size: 1.04em;
  }
}
.container {
  margin: 30px auto;
  width: 98%;
  max-width: 1200px;
}
.warning {
  margin: 30px 0 18px 0;
  font-size: 1.3em;
  color: #ffc800;
  background: #28230e;
  padding: 16px 20px;
  border-radius: 9px;
  font-weight: bold;
  text-align: center;
  border: 2px solid #ffb600;
}
.logout-btn {
  float: right;
  background: #b72e2e;
  color: #fff;
  border: none;
  padding: 8px 14px;
  font-weight: bold;
  border-radius: 7px;
  cursor: pointer;
  display: none;
}
.banners-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 34px 24px;
}
.banner-block {
  background: #232730;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 12px 16px 12px;
  box-shadow: 0 4px 18px #0002;
  min-height: 360px;
  position: relative;
}
.banner-block.drag-over {
  border: 2.5px dashed #5bffbb;
  background: #202431;
}
.banner-img {
  width: 260px;
  height: 177px;
  object-fit: cover;
  border-radius: 9px;
  border: 2.5px solid #232730;
  background: #111;
  margin-bottom: 10px;
}
.banner-btn {
  margin: 5px 0 10px 0;
  background: #3a56d0;
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 8px 18px;
  font-size: 1em;
  cursor: pointer;
}
.banner-btn:active {
  background: #2441a5;
}
.banner-del {
  background: #ee4141 !important;
  margin-left: 12px;
}
.banner-del:active {
  background: #a51515 !important;
}
.banner-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.banner-link-inp {
  width: -webkit-fill-available;
  font-size: 1.04em;
  border-radius: 6px;
  padding: 7px 10px;
  background: #181b20;
  color: #fff;
  border: none;
  margin-bottom: 8px;
  margin-top: 10px;
}
.save-btn {
  background: #2bdf96;
  color: #131a11;
  font-weight: bold;
  border: none;
  border-radius: 7px;
  padding: 8px 17px;
  font-size: 1em;
  margin-bottom: 7px;
}
.save-btn:active {
  background: #1d9b6d;
}
.msg {
  color: #5bffbb;
  font-size: 1.05em;
  margin: 5px 0 0 0;
}
.error {
  color: #ff495b;
}
.add-btn {
  margin: 38px auto 0 auto;
  background: #2551ff;
  color: #fff;
  font-weight: bold;
  border: none;
  border-radius: 9px;
  padding: 16px 38px;
  font-size: 1.17em;
  display: block;
  cursor: pointer;
}
.add-btn:active {
  background: #1430bb;
}
.hidden {
  display: none;
}
.banner-drag {
  cursor: move;
  font-size: 1.2em;
  position: absolute;
  top: 8px;
  left: 10px;
  color: #7ce1b7;
  opacity: 0.85;
}
.banner-img-file {
  font-size: 0.93em;
  width: 250px;
  word-break: break-all;
  margin-bottom: 7px;
  text-align: center;
}
@media (max-width: 1100px) {
  .banners-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .banner-img {
    width: 100%;
    max-width: 260px;
    height: 177px;
  }
}
@media (max-width: 750px) {
  .banners-grid {
    grid-template-columns: 1fr;
  }
  .banner-img {
    width: 100%;
    max-width: 100%;
    height: 180px;
  }
  .container {
    max-width: 97vw;
  }
}

.books-accordion {
  background: #222a33;
  border-radius: 18px;
  margin-bottom: 18px;
  box-shadow: 0 2px 12px #0003;
  overflow: hidden;
  transition: box-shadow .2s;
  border: 1.5px solid #2a3240;
}
.books-accordion.open {
  box-shadow: 0 4px 22px #0007;
  border-color: #467bff;
}
.books-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 20px 34px 20px 28px;
  font-size: 1.18em;
  font-weight: 500;
  background: #222a33;
  transition: background .18s;
  border-bottom: 1.5px solid #253040;
}
.books-accordion-header:hover {
  background: #283042;
}
.books-accordion-header span:last-child {
  font-size: 1.5em;
  color: #6de1b8;
}
.books-accordion-content {
  padding: 28px 38px 18px 38px;
  background: #232730;
  display: none;
  animation: fadeIn .28s;
}
.books-accordion.open .books-accordion-content {
  display: block;
}
.books-category-flex {
  display: flex;
  gap: 40px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.books-category-img-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 200px;
  max-width: 220px;
  margin-right: 15px;
}
.books-category-img {
  width: 190px;
  height: 128px;
  border-radius: 12px;
  object-fit: cover;
  margin-bottom: 14px;
  background: #111;
  border: 2.5px solid #232730;
  box-shadow: 0 2px 10px #0002;
}
.books-category-inputs {
  flex: 1;
  min-width: 270px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 14px 22px;
}
.books-category-input-label {
  grid-column: 1 / 2;
  font-size: 1em;
  color: #b5d8ff;
  margin-bottom: 4px;
}
.books-category-input {
  grid-column: 1 / 5;
  width: 100%;
  border-radius: 7px;
  padding: 7px 10px;
  background: #181b20;
  color: #fff;
  border: 1.5px solid #313544;
  font-size: 1.07em;
  margin-bottom: 6px;
}
.books-category-actions {
  grid-column: 1 / 5;
  display: flex;
  gap: 14px;
  margin-top: 6px;
}
.books-books-title {
  font-size: 1.11em;
  color: #8ec7ff;
  margin: 18px 0 13px 0;
  letter-spacing: 0.02em;
}
.books-list {
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.books-book-block {
  display: flex;
  align-items: flex-start;
  background: #181b20;
  border-radius: 10px;
  box-shadow: 0 2px 8px #0002;
  padding: 18px 18px 17px 18px;
  gap: 20px;
}
.books-book-img {
  width: 80px;
  height: 110px;
  border-radius: 8px;
  object-fit: cover;
  margin-right: 12px;
  border: 1.7px solid #222;
  background: #111;
}
.books-book-fields {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 14px;
}
.books-book-label {
  font-size: .98em;
  color: #aac6de;
  margin-bottom: 2px;
  display: block;
}
.books-book-input, .books-book-textarea {
  width: 98%;
  border-radius: 6px;
  padding: 7px 10px;
  background: #181b20;
  color: #fff;
  border: 1.5px solid #313544;
  font-size: 1em;
  margin-bottom: 2px;
}
.books-book-textarea {
  min-height: 120px;
  max-height: 120px;
  resize: vertical;
  font-family: inherit;
  white-space: pre-line;
}
.books-book-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 135px;
  align-items: flex-end;
}
.books-btn, .save-btn {
  background: #307afe;
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 7px 17px;
  font-size: .98em;
  cursor: pointer;
  transition: background .13s;
  margin-bottom: 2px;
  width: 120px;
  max-width: 100%;
}
.books-btn:active, .save-btn:active { background: #1d5ae1; }
.banner-del { background: #ee4141 !important; }
.banner-del:active { background: #a51515 !important;}
@media (max-width: 1000px) {
  .books-category-flex, .books-list { flex-direction: column; gap: 19px;}
  .books-category-img-block { margin:0; align-items: flex-start;}
  .books-category-img { width: 120px; height: 78px;}
  .books-book-img { width: 54px; height: 74px; }
}
@media (max-width: 700px) {
  .books-accordion-content { padding: 10px 4vw 6px 4vw;}
  .books-category-inputs { grid-template-columns: 1fr; }
  .books-book-fields { grid-template-columns: 1fr; }
}
@keyframes fadeIn { from { opacity: 0;} to { opacity: 1;} }

.segmented-control {
  display: flex;
  margin-bottom: 8px;
  border-radius: 7px;
  overflow: hidden;
  background: #21242c;
  width: fit-content;
  border: 1.5px solid #313544;
}
.segmented-control-btn {
  padding: 7px 18px;
  border: none;
  background: none;
  color: #bbc9e3;
  font-weight: 500;
  font-size: 1em;
  cursor: pointer;
  outline: none;
  transition: background .12s, color .12s;
}
.segmented-control-btn.active {
  background: #307afe;
  color: #fff;
}
.segmented-control-btn:not(:last-child) {
  border-right: 1.5px solid #313544;
}

.file-input-hidden {
  display: none;
}

.custom-upload-btn {
  display: inline-block;
  padding: 8px 18px;
  background: #23242a;
  color: #fff;
  border-radius: 7px;
  cursor: pointer;
  border: 1.5px solid #313544;
  font-size: 1em;
  transition: background 0.18s;
}
.custom-upload-btn:hover {
  background: #313144;
}

.file-upload-filename {
  font-size: .96em;
  color: #b3bac7;
}
