:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #5d6a84;
  --line: #d6dfef;
  --brand: #0c8c7a;
  --brand-dark: #0a6f62;
  --danger: #a62e2e;
  --danger-dark: #7f2222;
  --shadow: 0 14px 30px rgba(11, 20, 34, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top right, #d5eef6 0%, rgba(213, 238, 246, 0) 40%),
    linear-gradient(180deg, #f8fbff, var(--bg));
  color: var(--ink);
}

.shell {
  width: min(100%, 960px);
  margin: 0 auto;
  padding: 0 1rem;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(8px);
}

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

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-size: 0.75rem;
}

.site-title {
  margin: 0.15rem 0 0;
  font-size: 1.4rem;
}

.site-nav {
  display: flex;
  gap: 0.7rem;
}

.nav-link {
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  padding: 0.35rem 0.55rem;
  border-radius: 0.45rem;
}

.nav-link:hover {
  background: #e7edf9;
}

.content-shell {
  padding-top: 1.35rem;
  padding-bottom: 2.5rem;
}

.hero {
  margin-bottom: 1.25rem;
}

.hero-kicker {
  color: var(--brand-dark);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
  margin: 0;
}

.hero h2 {
  margin: 0.35rem 0 0.55rem;
  font-size: 1.95rem;
}

.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 65ch;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 1rem;
  padding: 1rem;
}

.auth-panel {
  max-width: 440px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-actions form {
  margin: 0;
}

.count {
  color: var(--muted);
  font-size: 0.95rem;
}

.search-form {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}

.search-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--muted);
}

.search-form input[type="search"] {
  min-width: 260px;
  border: 1px solid #b9c6de;
  border-radius: 0.55rem;
  padding: 0.53rem 0.62rem;
  font: inherit;
}

.sort-link {
  text-decoration: none;
  color: var(--ink);
  font-weight: 650;
}

.sort-link.active {
  color: var(--brand-dark);
}

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

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

.book-table th,
.book-table td {
  border-bottom: 1px solid var(--line);
  padding: 0.7rem 0.3rem;
  text-align: left;
  vertical-align: top;
}

.actions-col {
  text-align: right;
  white-space: nowrap;
}

.actions-col form {
  display: inline;
}

.stack {
  display: grid;
  gap: 0.9rem;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.field input {
  width: 100%;
  border: 1px solid #b9c6de;
  border-radius: 0.55rem;
  padding: 0.6rem 0.65rem;
  font: inherit;
}

.field select {
  width: 100%;
  border: 1px solid #b9c6de;
  border-radius: 0.55rem;
  padding: 0.6rem 0.65rem;
  font: inherit;
  background: #fff;
}

.field input:focus {
  border-color: #4387e6;
  outline: 2px solid rgba(67, 135, 230, 0.18);
  outline-offset: 1px;
}

.field select:focus {
  border-color: #4387e6;
  outline: 2px solid rgba(67, 135, 230, 0.18);
  outline-offset: 1px;
}

.status-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  border: 1px solid transparent;
}

.status-in_library {
  color: #12643a;
  background: #e1f6ea;
  border-color: #9ed8b5;
}

.status-lent {
  color: #8b2020;
  background: #fbe8e8;
  border-color: #e9b1b1;
}

.button,
button,
input[type="submit"] {
  display: inline-block;
  border: 0;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  border-radius: 0.55rem;
  padding: 0.45rem 0.75rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.button:hover,
button:hover,
input[type="submit"]:hover {
  background: var(--brand-dark);
}

.button-secondary {
  background: #eef2fb;
  color: var(--ink);
}

.button-secondary:hover {
  background: #dde6fa;
}

.button-danger {
  background: var(--danger);
}

.button-danger:hover {
  background: var(--danger-dark);
}

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

.flash {
  border-radius: 0.65rem;
  padding: 0.7rem 0.8rem;
  margin: 0 0 0.95rem;
  font-weight: 600;
}

.flash-notice {
  background: #e2f7f3;
  color: #0d6356;
  border: 1px solid #a7ddd5;
}

.flash-alert {
  background: #fde9e9;
  color: #8e2b2b;
  border: 1px solid #f3baba;
}

.error-box {
  border: 1px solid #f3baba;
  border-radius: 0.7rem;
  background: #fff1f1;
  padding: 0.7rem;
}

.error-box h3 {
  margin: 0;
  font-size: 0.95rem;
}

.error-box ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

@media (max-width: 700px) {
  .header-shell,
  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .actions-col {
    text-align: left;
    white-space: normal;
  }

  .hero h2 {
    font-size: 1.6rem;
  }

  .search-form input[type="search"] {
    min-width: 100%;
  }
}
