:root {
  --purple: #7b6bb0;
  --purple-dark: #5e4f8c;
  --purple-soft: #cfc4e8;
  --teal: #3aa6a0;
  --teal-dark: #2d8580;
  --pink: #e891b0;
  --pink-soft: #f7d6e3;
  --bg: #f4eefb;
  --text: #1f1a2e;
  --muted: #5c5670;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(63, 48, 110, 0.08);
  --font: "Segoe UI", "Trebuchet MS", "Gill Sans", sans-serif;
  --display: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-body {
  flex: 1;
  display: flex;
  width: 100%;
  align-items: stretch;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.site-header,
.site-footer {
  background: var(--purple);
  color: #fff;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
}

.header-inner,
.footer-inner,
.container {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
}

.logo-mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
  background: #fff;
  flex-shrink: 0;
  display: block;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
}

.nav a,
.nav button.linkish {
  color: #fff;
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  opacity: 0.95;
}

.nav a:hover,
.nav button.linkish:hover {
  text-decoration: underline;
}

.nav a.nav-dashboard {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}

.staff-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--purple-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
  min-height: 100%;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.sidebar-nav a {
  color: #fff;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  font-weight: 600;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(0, 0, 0, 0.22);
}

.sidebar-contact {
  color: #fff;
  padding: 1rem 1.1rem;
  margin-top: auto;
  opacity: 0.95;
}

.staff-content {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0 0.5rem;
}

.main {
  flex: 1;
  padding: 1.75rem 0 2rem;
  width: 100%;
}

.site-footer {
  margin-top: auto;
  flex-shrink: 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  font-size: 0.95rem;
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
}

.has-staff-sidebar .footer-inner {
  width: calc(100% - 2rem);
  max-width: none;
  padding-left: calc(220px + 1rem);
}

.password-field {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
}

.password-wrap {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.password-wrap input {
  flex: 1;
}

.password-toggle {
  border: 1px solid var(--purple-soft);
  background: #fff;
  color: var(--purple-dark);
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

button.linkish-dark {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--purple-dark);
  cursor: pointer;
  text-align: left;
}

button.linkish-dark:hover {
  text-decoration: underline;
}

tbody tr.row-selected {
  background: #f0ebf8;
}

tr.copies-dropdown-row > td {
  background: #f7f4fc;
  padding: 0.75rem 1rem 1rem;
  border-bottom: 2px solid var(--purple-soft);
}

.copies-dropdown {
  animation: dropIn 0.18s ease;
}

@keyframes dropIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.loan-card {
  border: 2px solid var(--purple-soft);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  background: #fff;
}

.loan-card h3 {
  margin: 0 0 0.5rem;
}

.search-suggest {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  max-height: 240px;
  overflow: auto;
  box-shadow: var(--shadow);
}

.search-suggest li button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  font: inherit;
}

.search-suggest li button:hover {
  background: var(--purple-soft);
}

.table-pink thead {
  background: var(--pink);
}

.table-pink {
  border: 2px solid var(--pink);
}

.page-search {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0 0 1rem;
}

.page-search input {
  flex: 1;
  min-width: min(280px, 100%);
  background: #fff;
  color: var(--text);
  border: 1px solid #cfc8dd;
}

.page-search input::placeholder {
  color: var(--muted);
}

.inline-edit-row > td {
  background: #f7f5fb;
  padding: 0.75rem;
}

.inline-book-form {
  margin: 0;
}

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.toolbar-row input {
  min-width: min(360px, 100%);
  background: var(--teal);
  color: #fff;
  border: 0;
  border-radius: 999px;
}

.toolbar-row input::placeholder {
  color: rgba(255, 255, 255, 0.85);
}

@media (max-width: 800px) {
  .app-body {
    flex-direction: column;
  }

  .staff-sidebar {
    width: 100%;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar-nav a {
    border-bottom: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.18);
  }

  .has-staff-sidebar .footer-inner {
    padding-left: 1rem;
  }
}

.hero-search {
  background:
    linear-gradient(180deg, rgba(31, 26, 46, 0.55), rgba(31, 26, 46, 0.42)),
    url("/heroimage.jpg") center / cover no-repeat;
  border-radius: calc(var(--radius) + 4px);
  padding: 3.25rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
  color: #fff;
}

.hero-search h1 {
  font-family: var(--display);
  margin: 0 0 0.35rem;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  color: #fff;
}

.hero-search p {
  margin: 0 0 1.25rem;
  color: rgba(255, 255, 255, 0.92);
}

.search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}

.search-row input,
input,
select,
textarea {
  border: 1px solid #cfc8dd;
  border-radius: 999px;
  padding: 0.7rem 1rem;
  font: inherit;
  background: #fff;
}

.search-row input {
  min-width: min(420px, 100%);
  background: var(--teal);
  color: #fff;
  border: 0;
}

.search-row input::placeholder {
  color: rgba(255, 255, 255, 0.85);
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1.2rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--purple);
  color: #fff;
  text-decoration: none;
  display: inline-block;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn:hover {
  background: var(--purple-dark);
  transform: translateY(-1px);
}

.btn.teal {
  background: var(--teal);
}

.btn.teal:hover {
  background: var(--teal-dark);
}

.btn.ghost {
  background: transparent;
  color: var(--purple-dark);
  border: 1px solid var(--purple-soft);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.popular-links {
  margin-top: 0.9rem;
  color: var(--muted);
}

.hero-search .popular-links {
  color: rgba(255, 255, 255, 0.92);
}

.popular-links a {
  color: var(--purple-dark);
  margin-left: 0.55rem;
  font-weight: 600;
}

.hero-search .popular-links a {
  color: #fff;
}

.quick-grid,
.book-grid,
.stat-grid,
.split-grid {
  display: grid;
  gap: 1rem;
}

.quick-grid {
  grid-template-columns: repeat(4, 1fr);
  margin: 1.5rem 0;
}

.book-grid {
  grid-template-columns: repeat(4, 1fr);
}

.stat-grid {
  grid-template-columns: repeat(3, 1fr);
}

.split-grid {
  grid-template-columns: 1fr 1fr;
  margin-top: 1.5rem;
}

.member-list-panel {
  display: flex;
  flex-direction: column;
  height: 28rem;
  max-height: 28rem;
  overflow: hidden;
}

.member-list-panel h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}

.member-scroll-list {
  list-style: none;
  margin: 0;
  padding: 0 0.25rem 0 0;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.member-list-item {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(61, 42, 92, 0.12);
  background: #fff;
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  display: block;
  font: inherit;
  line-height: 1.35;
}

.member-list-item:hover,
.member-list-item.selected {
  border-color: var(--purple);
  background: #f7f4fc;
}

.member-list-name {
  font-weight: 700;
  color: var(--purple-dark, #2d1b4e);
}

.member-list-meta {
  font-weight: 400;
  font-size: 0.9em;
}

.card,
.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem;
}

.quick-card {
  background: var(--purple-soft);
  border-radius: var(--radius);
  padding: 1.25rem 1.1rem;
  min-height: 88px;
  display: flex;
  align-items: center;
  transition: transform 0.18s ease;
}

.quick-card:hover {
  transform: translateY(-3px);
}

.quick-card strong {
  font-size: 1.05rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin: 1.5rem 0 0.8rem;
}

.section-head h2 {
  margin: 0;
  font-family: var(--display);
}

.book-card {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.cover {
  aspect-ratio: 3 / 4;
  background:
    linear-gradient(160deg, var(--purple-soft), #9bb7e8 55%, var(--teal));
  display: grid;
  place-items: center;
  color: #fff;
  font-family: var(--display);
  text-align: center;
  padding: 1rem;
  overflow: hidden;
}

.cover.has-image {
  padding: 0;
  background: #ddd;
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-thumb {
  width: 48px;
  aspect-ratio: 3 / 4;
  padding: 0.2rem;
  font-size: 0.55rem;
  border-radius: 6px;
}

.cover-preview {
  width: 120px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.cover-preview img {
  width: 100%;
  display: block;
}

.book-card .body {
  padding: 0.9rem;
}

.book-card h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.muted {
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--teal);
  color: #fff;
}

.pill.danger,
.pill.overdue {
  background: var(--pink);
}

.pill.warn {
  background: #d4a017;
}

.pill.hold {
  background: var(--purple);
}

.notice-box {
  background: var(--purple-soft);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.alert-banner {
  background: var(--pink-soft);
  border: 1px solid var(--pink);
  color: #7a2948;
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1rem 0;
}

.stat-card {
  background: var(--teal);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.2rem;
}

.stat-card .value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.8rem 1rem;
  text-align: left;
}

thead {
  background: var(--purple);
  color: #fff;
}

tbody tr:nth-child(even) {
  background: #faf8ff;
}

.form {
  display: grid;
  gap: 0.85rem;
  max-width: 480px;
}

.form.wide {
  max-width: 720px;
}

.form label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
}

.form label.checkbox-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
}

.form label.checkbox-row input[type='checkbox'] {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  flex-shrink: 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.error {
  background: #ffe5e8;
  color: #8a1f2d;
  border-radius: 10px;
  padding: 0.75rem 1rem;
}

.success {
  background: #e5f8f1;
  color: #17664d;
  border-radius: 10px;
  padding: 0.75rem 1rem;
}

.toast-viewport {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.65rem;
  width: min(420px, calc(100vw - 2rem));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(28, 20, 45, 0.22);
  animation: toastIn 0.22s ease;
  font-weight: 600;
  line-height: 1.35;
}

.toast p {
  margin: 0;
  flex: 1;
}

.toast-success {
  background: #17664d;
  color: #fff;
}

.toast-error {
  background: #8a1f2d;
  color: #fff;
}

.toast-info {
  background: var(--purple-dark, #3d2a5c);
  color: #fff;
}

.toast-close {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
  padding: 0;
}

.toast-close:hover {
  opacity: 1;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0;
}

.page-title {
  font-family: var(--display);
  margin: 0 0 1rem;
}

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

.auth-panel {
  max-width: 460px;
  margin: 0 auto;
}

.demo-logins {
  font-family: var(--font);
}

@media (max-width: 900px) {
  .quick-grid,
  .book-grid,
  .stat-grid,
  .split-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .quick-grid,
  .book-grid,
  .stat-grid,
  .split-grid {
    grid-template-columns: 1fr;
  }

  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .brand {
    font-size: 1rem;
  }
}
