:root {
  --app-bg: #f6f8f5;
  --app-surface: #ffffff;
  --app-ink: #17201b;
  --app-muted: #637067;
  --app-line: #dce5de;
  --app-green: #1f7a4d;
  --app-green-dark: #155f3a;
  --app-teal: #1b7480;
  --app-amber: #b56b16;
  --app-red: #b13a3a;
  --app-shadow: 0 18px 45px rgba(28, 43, 34, 0.12);
}

html {
  font-size: 16px;
  min-height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  color: var(--app-ink);
  background: var(--app-bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

main {
  flex: 1;
}

a {
  color: var(--app-green-dark);
}

a:hover {
  color: var(--app-green);
}

.btn {
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-success {
  background: var(--app-green);
  border-color: var(--app-green);
}

.btn-success:hover,
.btn-success:focus {
  background: var(--app-green-dark);
  border-color: var(--app-green-dark);
}

.form-control,
.form-select {
  border-radius: 8px;
  border-color: #cad7cf;
  min-height: 46px;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus,
.btn:focus {
  border-color: var(--app-green);
  box-shadow: 0 0 0 0.22rem rgba(31, 122, 77, 0.18);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(246, 248, 245, 0.9);
  border-bottom: 1px solid rgba(220, 229, 222, 0.85);
  backdrop-filter: blur(14px);
}

.app-navbar {
  min-height: 72px;
}

.brand-lockup,
.admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--app-ink);
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--app-green);
  font-size: 0.9rem;
  font-weight: 800;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #2d3a32;
  font-weight: 600;
}

.site-footer {
  padding: 1.5rem 0;
  color: var(--app-muted);
  border-top: 1px solid var(--app-line);
  background: #ffffff;
}

.public-search-section {
  padding: .5rem 0 .5rem;
  background: #f4f8f5;
  border-bottom: 1px solid var(--app-line);
}

.eyebrow,
.admin-kicker {
  display: inline-flex;
  align-items: center;
  margin-bottom: 0.7rem;
  color: var(--app-green-dark);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.public-search-section h1 {
  max-width: 760px;
  margin: 0 0 1rem;
  font-size: clamp(2.3rem, 7vw, 4.8rem);
  line-height: 1.02;
  font-weight: 850;
}

.lead-copy {
  max-width: 620px;
  margin: 0 0 2rem;
  color: var(--app-muted);
  font-size: 1.12rem;
}

.search-only-wrap {
  justify-content: center;
}



.dashboard-search-title {
  display: block;
  margin-bottom: 0.85rem;
}

.chat-search-panel {
  display: block;
  width: 100%;
  padding: 1rem;
  border: 1px solid var(--app-line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--app-shadow);
}

.chat-search-panel .form-label {
  color: var(--app-muted);
  font-weight: 700;
}

.chat-search-top {
  margin-bottom: 1rem;
}

.chat-search-top .search-note,
.chat-results-summary .search-note {
  color: var(--app-muted);
  font-size: 0.95rem;
  margin: 0.35rem 0 0;
}

.chat-messages {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.chat-message {
  display: inline-flex;
  max-width: 100%;
  padding: 0.95rem 1rem;
  border-radius: 18px;
  background: #f1f6f3;
}

.dashboard-filter-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.chat-input-row {
  display: grid;
  gap: 1rem;
}

.chat-input-field {
  grid-column: 1 / -1;
}

.chat-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #f7fbf8;
  border: 1px solid rgba(16, 64, 39, 0.15);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  box-shadow: inset 0 1px 1.5px rgba(15, 53, 24, 0.06);
}

.chat-input {
  border: none;
  box-shadow: none;
  outline: none;
  background: transparent;
  flex: 1;
  min-height: 56px;
  font-size: 1rem;
  padding: 0.85rem 0;
  color: #21312a;
}

.chat-input::placeholder {
  color: #6b7c70;
  opacity: 1;
}

.chat-input:focus {
  box-shadow: none;
}

.chat-send-button {
  min-width: 56px;
  min-height: 56px;
  border-radius: 999px;
  padding: 0;
  background: var(--app-green);
  color: #ffffff;
  border: 1px solid transparent;
  box-shadow: 0 8px 18px rgba(7, 60, 30, 0.14);
}

.chat-send-button:hover,
.chat-send-button:focus {
  background: #22633f;
  color: #ffffff;
  border-color: transparent;
}

.chat-message.bot {
  align-self: flex-start;
  background: #eef7f3;
}

.chat-message.user {
  align-self: flex-end;
  background: #dff0e7;
  border: 1px solid rgba(31, 122, 77, 0.18);
}

.chat-message-content {
  line-height: 1.5;
}

.chat-results-section {
  padding: 1rem 0 2rem;
}

.chat-results-list {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.chat-results-item {
  padding: 1rem;
  border: 1px solid var(--app-line);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(31, 122, 77, 0.05);
}

.chat-results-item h3 {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
}

.chat-results-item p {
  margin: 0 0 0.85rem;
  color: var(--app-muted);
}

.chat-results-item a {
  color: var(--app-green-dark);
}

.chat-results-item a:hover {
  text-decoration: underline;
}

..dashboard-inline-search {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 0.85rem;
}

.dashboard-inline-search .filter-field {
  width: 100%;
}

.dashboard-inline-search .form-label {
  display: block;
  min-height: 20px;
  margin-bottom: 0.35rem;
  white-space: nowrap;
}

.dashboard-inline-search .form-select,
.dashboard-inline-search .form-control,
.dashboard-inline-search .btn {
  width: 100%;
}

.search-action-field {
  display: flex;
  align-items: end;
}

.search-action-field .btn {
  min-width: 112px;
  min-height: 46px;
}

.public-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.filter-field,
.search-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.public-filter-grid .form-label,
.search-field .form-label {
  display: block;
  margin-bottom: 0.35rem;
}

.clear-search-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.8rem;
  color: var(--app-muted);
  font-weight: 700;
  text-decoration: none;
}

.clear-search-link:hover {
  color: var(--app-green-dark);
}

.chat-search-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
}

.chat-avatar,
.book-card-icon,
.auth-icon,
.delete-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  color: var(--app-green-dark);
  background: #e7f4ec;
}

.library-snapshot {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.library-snapshot > div {
  min-height: 142px;
  padding: 1.25rem;
  border: 1px solid var(--app-line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 26px rgba(28, 43, 34, 0.08);
}

.library-snapshot span {
  display: block;
  font-size: 2.2rem;
  font-weight: 850;
  color: var(--app-green-dark);
}

.library-snapshot strong {
  color: var(--app-muted);
}

.results-section {
  padding: 3rem 0 4rem;
}

.results-heading,
.panel-title-row,
.admin-page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.results-heading h2,
.admin-page-heading h1,
.panel-title-row h2 {
  margin: 0;
  font-weight: 820;
}

.share-all-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-end;
}

.share-all-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0 1.5rem;
}

.share-all-text {
  color: var(--app-muted);
  margin: 0;
  flex: 1 1 100%;
}

.share-all-actions .btn.disabled,
.share-all-actions .btn[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.6;
}

.result-count {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--app-line);
  border-radius: 8px;
  color: var(--app-muted);
  background: #ffffff;
  font-weight: 700;
}

.book-results-grid {
  display: grid;
  gap: 0.5rem;
}

.chat-results-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1rem;
}

.chat-message {
  display: flex;
  max-width: 100%;
  border-radius: 18px;
  background: #f1f6f3;
  padding: 0.9rem;
  box-shadow: 0 8px 20px rgba(28, 43, 34, 0.04);
}

.chat-message.user {
  align-self: flex-end;
  background: #dff0e7;
  border: 1px solid rgba(31, 122, 77, 0.18);
}

.chat-message.bot {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid var(--app-line);
}

.chat-message-content {
  width: 100%;
  line-height: 1.5;
}

.chat-query,
.chat-message-content p {
  margin: 0;
  color: var(--app-ink);
  font-size: 0.95rem;
}

.result-message .chat-message-content {
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.result-icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #eff7f1;
  color: var(--app-green-dark);
}

.result-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.result-type {
  margin: 0.25rem 0 0;
  color: var(--app-muted);
  font-size: 0.85rem;
}

.result-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.result-meta-grid div {
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: #f7faf8;
}

.result-meta-grid span {
  display: block;
  color: var(--app-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.result-meta-grid strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.88rem;
}

.result-url {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  margin-top: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  background: #f1f6f3;
  color: #3e4c43;
  font-size: 0.85rem;
}

.result-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
}

.icon-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.icon-btn .bi {
  margin: 0;
}

.icon-btn.btn-outline-success {
  color: var(--app-green-dark);
  border-color: var(--app-green-dark);
}

.icon-btn.btn-outline-primary {
  color: #1f5dcc;
  border-color: #1f5dcc;
}

.icon-btn.btn-outline-dark {
  color: #2d3a32;
  border-color: #2d3a32;
}

.icon-btn.btn-success {
  background: var(--app-green);
  color: #ffffff;
  border-color: var(--app-green);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.results-table th,
.results-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #e5ece7;
  vertical-align: middle;
}

.results-table thead th {
  background: #f7faf8;
  color: var(--app-green-dark);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.results-table tbody tr:hover {
  background: #f4f8f5;
}

.result-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--app-ink);
}

.result-subtitle,
.result-url {
  margin: 0.15rem 0 0;
  color: var(--app-muted);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-url {
  color: #5d6f64;
}

.result-actions-cell {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.icon-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.icon-btn .bi {
  margin: 0;
}

.chat-results-list .book-result-card {
  min-height: auto;
  padding: 0.75rem;
  border-radius: 10px;
  box-shadow: none;
}

.book-result-card.compact {
  gap: 0.6rem;
  padding: 0.75rem;
}

.book-card-top.compact {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 0.6rem;
  align-items: center;
}

.book-card-top.compact h3 {
  font-size: 0.98rem;
  margin: 0;
}

.book-card-top.compact .book-type,
.book-card-top.compact .book-details {
  margin: 0;
  color: var(--app-muted);
  font-size: 0.82rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-card-top.compact .book-details {
  white-space: normal;
}

.book-url.compact {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  padding: 0.55rem;
  border-radius: 10px;
  color: #3e4c43;
  background: #f1f6f3;
  font-size: 0.82rem;
}

.book-actions.compact {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.book-actions.compact .icon-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.book-actions.compact .btn-outline-success,
.book-actions.compact .btn-outline-primary,
.book-actions.compact .btn-outline-dark,
.book-actions.compact .btn-success {
  padding: 0;
}

.book-result-card,
.admin-panel,
.admin-form-panel,
.auth-card {
  border: 1px solid var(--app-line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(28, 43, 34, 0.08);
}

.book-result-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.book-result-card:hover {
  transform: none;
}

.book-card-top {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 0.85rem;
  align-items: center;
}

.book-card-top h3 {
  margin: 0 0 0.3rem;
  font-size: 1.1rem;
  font-weight: 800;
}

.book-card-top p {
  margin: 0;
  color: var(--app-muted);
}

.book-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0;
}

.book-meta-grid div {
  min-width: 0;
  padding: 0.75rem;
  border-radius: 8px;
  background: #f7faf8;
}

.book-url {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  border-radius: 8px;
  color: #3e4c43;
  background: #f1f6f3;
  font-size: 0.9rem;
}

.book-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.book-actions .btn {
  flex: 1 1 auto;
  min-width: 110px;
  padding: 0.45rem 0.75rem;
  font-size: 0.88rem;
}

.book-card-top {
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 0.65rem;
}

.book-card-top h3 {
  font-size: 0.95rem;
}

.book-meta-grid {
  gap: 0.55rem;
}

.book-meta-grid div {
  padding: 0.55rem;
}

.book-url {
  padding: 0.6rem;
  font-size: 0.84rem;
}

.book-result-card {
  gap: 0.65rem;
  padding: 0.75rem;
}

.book-result-card:hover {
  border-color: rgba(31, 122, 77, 0.32);
  box-shadow: var(--app-shadow);
  transform: translateY(-3px);
}

.book-card-top {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.book-card-top h3 {
  margin: 0 0 0.3rem;
  font-size: 1.1rem;
  font-weight: 800;
}

.book-card-top p {
  margin: 0;
  color: var(--app-muted);
}

.book-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.book-meta-grid div {
  min-width: 0;
  padding: 0.65rem;
  border-radius: 8px;
  background: #f7faf8;
}

.book-meta-grid span,
.detail-grid span,
.detail-url span {
  display: block;
  color: var(--app-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.book-meta-grid strong,
.detail-grid strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
}

.book-url {
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
  margin-top: auto;
  padding: 0.75rem;
  border-radius: 8px;
  color: #3e4c43;
  background: #f1f6f3;
  font-size: 0.86rem;
}

.book-url span,
.admin-table a,
.detail-url a {
  overflow-wrap: anywhere;
}

.book-actions {
  display: flex;
  gap: 0.65rem;
  margin-top: 1rem;
}

.book-actions .btn {
  flex: 1 1 0;
}

.empty-state,
.admin-empty {
  padding: 3rem 1.5rem;
  border: 1px dashed #bdd0c4;
  border-radius: 8px;
  color: var(--app-muted);
  background: #ffffff;
  text-align: center;
}

.empty-state i {
  display: block;
  margin-bottom: 0.8rem;
  color: var(--app-green);
  font-size: 2rem;
}

.empty-state h3 {
  color: var(--app-ink);
  font-weight: 800;
}

.auth-page {
  background: #edf5f0;
}

.auth-shell {
  display: grid;
  min-height: calc(100vh - 148px);
  place-items: center;
  padding: 3rem 1rem;
}

.auth-card {
  width: min(100%, 440px);
  padding: 2rem;
}

.auth-card h1 {
  margin: 1rem 0 0.35rem;
  font-weight: 850;
}

.auth-card p {
  color: var(--app-muted);
}

.admin-body {
  background: #f3f6f4;
}

.admin-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  padding: 1.25rem;
  color: #ffffff;
  background: #1a3125;
}

.admin-brand {
  color: #ffffff;
  margin-bottom: 1.5rem;
}

.admin-menu {
  display: grid;
  gap: 0.45rem;
}

.admin-menu-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.78rem 0.85rem;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.admin-menu-link:hover,
.admin-menu-link.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  transform: translateX(2px);
}

.admin-sidebar-footer {
  margin-top: auto;
}

.admin-content {
  min-width: 0;
  padding: 1.25rem 1.5rem 2rem;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.25rem;
}

.admin-kicker {
  margin: 0;
}

.admin-alert {
  border-radius: 8px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  display: grid;
  min-height: 160px;
  align-content: space-between;
  padding: 1rem;
  border-radius: 8px;
  color: #ffffff;
  text-decoration: none;
  box-shadow: 0 16px 32px rgba(28, 43, 34, 0.14);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.stat-card:hover {
  color: #ffffff;
  box-shadow: var(--app-shadow);
  transform: translateY(-3px);
}

.stat-card span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
}

.stat-card strong {
  font-size: 2.35rem;
  line-height: 1;
}

.stat-card small {
  font-size: 1rem;
  font-weight: 700;
}

.stat-green { background: var(--app-green-dark); }
.stat-teal { background: var(--app-teal); }
.stat-amber { background: var(--app-amber); }
.stat-red { background: var(--app-red); }

.admin-panel,
.admin-form-panel {
  padding: 1.25rem;
}

.admin-table {
  margin-bottom: 0;
}

.admin-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.8rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--app-line);
}

.admin-filter-field {
  width: min(100%, 320px);
}

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

.admin-table thead th {
  border-bottom: 1px solid var(--app-line);
  color: var(--app-muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.admin-table td {
  vertical-align: middle;
}

.admin-table td span {
  display: block;
  color: var(--app-muted);
  font-size: 0.88rem;
}

.table-actions {
  white-space: nowrap;
}

.table-actions .btn {
  width: 36px;
  height: 36px;
  padding: 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.detail-grid > div,
.detail-url {
  padding: 1rem;
  border: 1px solid var(--app-line);
  border-radius: 8px;
  background: #f8faf9;
}

.section-subtitle {
  margin: 0 0 0.9rem;
  font-size: 1rem;
  font-weight: 800;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.chip-list span {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--app-line);
  border-radius: 8px;
  background: #f8faf9;
  font-weight: 700;
}

.admin-empty.compact {
  padding: 1.5rem;
}

.danger-panel {
  border-color: #efc6c6;
}

.delete-icon {
  color: #8f2525;
  background: #feecec;
}

.danger-panel h2 {
  margin-top: 1rem;
  font-weight: 820;
}

@media (prefers-reduced-motion: no-preference) {
  .book-result-card,
  .stat-card,
  .admin-panel,
  .auth-card {
    animation: rise-in 260ms ease both;
  }

  @keyframes rise-in {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

@media (max-width: 1199.98px) {
  .book-results-grid,
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-inline-search {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-action-field {
    grid-column: 1 / -1;
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 991.98px) {
  .admin-shell {
    display: block;
  }

  .admin-sidebar {
    display: none;
  }

  .admin-content {
    padding: 1rem;
  }
}

@media (max-width: 767.98px) {
  .public-search-section {
    padding: 3rem 0 2rem;
  }

  .chat-search-row {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .chat-search-row .btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .library-snapshot,
  .book-results-grid,
  .stats-grid,
  .detail-grid,
  .public-filter-grid,
  .dashboard-inline-search {
    grid-template-columns: 1fr;
  }

  .results-heading,
  .panel-title-row,
  .admin-page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .book-meta-grid {
    grid-template-columns: 1fr;
  }

  .book-actions {
    flex-direction: column;
  }

  .admin-form-panel {
    width: 100%;
  }
}
