/* Libriva's shared visual system, responsive layouts, and accessible components. */
:root {
  color-scheme: light;
  --navy: #12345a;
  --blue: #155cb4;
  --blue-light: #eaf2fd;
  --yellow: #f5c842;
  --ink: #182d45;
  --muted: #52657c;
  --line: #dbe3ed;
  --surface: #fff;
  --canvas: #f4f7fb;
  --danger: #a72532;
  --success: #146744;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
}
[hidden] {
  display: none !important;
}
a {
  color: var(--blue);
  text-underline-offset: 0.2em;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
summary {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}
:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  line-height: 1.2;
  letter-spacing: -0.035em;
  margin-bottom: 0.8rem;
}
h2 {
  font-size: 1.2rem;
  line-height: 1.4;
}
h3 {
  font-size: 1rem;
}
p:last-child {
  margin-bottom: 0;
}
small,
.muted {
  color: var(--muted);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  z-index: 20;
  top: 0.5rem;
  left: 0.5rem;
  transform: translateY(-200%);
  padding: 0.7rem 1rem;
  background: white;
  border: 2px solid var(--blue);
  border-radius: 0.4rem;
}
.skip-link:focus {
  transform: none;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 auto;
  border-radius: 0.7rem;
  background: var(--yellow);
  color: var(--navy);
  font-size: 1.5rem;
  font-weight: 800;
}
.brand strong {
  display: block;
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  line-height: 1.3;
}
.brand small {
  font-size: 0.72rem;
  color: inherit;
  opacity: 0.8;
}
.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  padding: 2rem 1.2rem;
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.sidebar .brand {
  padding: 0 0.5rem;
}
.nav-label {
  margin: 0 0.8rem 0.6rem;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: #b8cce4;
  text-transform: uppercase;
}
.nav-links {
  display: grid;
  gap: 0.35rem;
}
.nav-links a,
.nav-links summary {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 0.85rem;
  color: #e0eafb;
  text-decoration: none;
  border-radius: 0.5rem;
  font-size: 0.88rem;
  line-height: 1.5;
}
.nav-links a:hover,
.nav-links summary:hover {
  background: #234970;
}
.nav-links a[aria-current="page"] {
  background: var(--yellow);
  color: var(--navy);
  font-weight: 700;
}
.nav-icon {
  width: 1.2rem;
  text-align: center;
  flex: 0 0 auto;
  font-size: 1.05rem;
}
.nav-links summary {
  cursor: pointer;
  list-style: none;
}
.nav-links summary::-webkit-details-marker {
  display: none;
}
.nav-links summary::after {
  content: "+";
  margin-left: auto;
}
.nav-links details[open] summary::after {
  content: "−";
}
.nav-submenu {
  padding-left: 1.1rem;
  margin-left: 1rem;
  border-left: 1px solid #476585;
}
.nav-submenu a {
  font-size: 0.8rem;
}
.sidebar-note {
  margin-top: auto;
  padding: 1.1rem 0.8rem 0;
  border-top: 1px solid #426080;
  font-size: 0.78rem;
  color: #b8cce4;
}
.sidebar :focus-visible {
  outline-color: var(--yellow);
}
.workspace {
  min-width: 0;
}
.topbar {
  min-height: 88px;
  padding: 1rem 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.83rem;
}
.topbar-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.profile {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}
.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--blue-light);
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 700;
}
.profile-text {
  font-size: 0.8rem;
  min-width: 0;
  overflow-wrap: anywhere;
}
.profile-text strong,
.profile-text small {
  display: block;
}
.page-content {
  padding: 2.5rem;
  max-width: 1500px;
  margin: 0 auto;
}
.breadcrumb {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}
.page-heading {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
}
.eyebrow {
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.68rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}
.page-heading p {
  max-width: 38rem;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  min-width: 0;
}
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.section-head h2 {
  margin-bottom: 0.3rem;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.action-card {
  display: block;
  padding: 1.5rem;
  text-decoration: none;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
}
.action-card:hover {
  border-color: var(--blue);
  background: #fafcff;
}
.card-icon {
  display: inline-grid;
  place-items: center;
  background: var(--blue-light);
  color: var(--blue);
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 0.6rem;
  margin-bottom: 1rem;
}
.action-card p {
  color: var(--muted);
  font-size: 0.88rem;
}
.card-link {
  display: block;
  margin-top: 1.1rem;
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 600;
}
.report-shortcuts {
  margin-bottom: 1.5rem;
}
.report-shortcuts a[aria-current="location"] {
  border-color: var(--blue);
  background: var(--blue-light);
}
[data-report-panel] td {
  overflow-wrap: anywhere;
}
[data-report-panel] td:first-child {
  white-space: nowrap;
}
#monitoring-rows td:nth-child(2),
#history-rows td:nth-child(2) {
  min-width: 10rem;
}
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.1rem;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  background: var(--blue);
  color: white;
}
.button:hover {
  background: #104b93;
}
.button-secondary {
  color: var(--ink);
  background: white;
  border-color: var(--line);
}
.button-secondary:hover {
  background: var(--blue-light);
}
.button-quiet {
  background: transparent;
  color: var(--muted);
}
.button-quiet:hover {
  background: var(--blue-light);
  color: var(--blue);
}
.icon-button {
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  font-size: 1.2rem;
}
.menu-toggle {
  display: none;
}
.field {
  display: grid;
  align-content: start;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  min-width: 0;
}
label {
  font-size: 0.85rem;
  font-weight: 600;
}
input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #aab9cc;
  border-radius: 0.45rem;
  padding: 0.7rem 0.8rem;
  background: white;
  color: var(--ink);
}
input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--danger);
}
.field-hint,
.field-error {
  font-size: 0.78rem;
  margin: 0;
}
.field-hint {
  color: var(--muted);
}
.field-error {
  color: var(--danger);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 1rem;
}
fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.feedback {
  padding: 0.85rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  overflow-wrap: anywhere;
}
.feedback[data-tone="error"] {
  background: #fff0f1;
  border: 1px solid #e7a7ae;
  color: var(--danger);
}
.feedback[data-tone="success"] {
  background: #ebf8f1;
  border: 1px solid #96cdb2;
  color: var(--success);
}
#storage-feedback {
  margin: 1rem;
}
.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}
caption {
  padding: 1rem;
  text-align: left;
  color: var(--muted);
}
th,
td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th {
  background: #f4f7fb;
  white-space: nowrap;
  font-size: 0.75rem;
  color: var(--muted);
}
tbody tr:last-child td {
  border-bottom: 0;
}
.cover {
  display: block;
  width: 3rem;
  height: 4.2rem;
  object-fit: contain;
}
.cover-detail {
  max-width: 100%;
  max-height: 24rem;
  object-fit: contain;
}
.inventory-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 0 0 1.5rem;
}
.inventory-summary > div {
  padding: 1.1rem 1.4rem;
  background: white;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
}
.inventory-summary dt {
  color: var(--muted);
  font-size: 0.8rem;
}
.inventory-summary dd {
  margin: 0.25rem 0 0;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--navy);
  overflow-wrap: anywhere;
}
#inventory-rows td:nth-child(4) {
  min-width: 12rem;
  max-width: 22rem;
  overflow-wrap: anywhere;
}
.stock-amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.cover-placeholder {
  display: grid;
  place-items: center;
  text-align: center;
  width: 3rem;
  height: 4.2rem;
  padding: 0.3rem;
  border: 1px dashed #98acc5;
  border-radius: 0.25rem;
  color: var(--muted);
  background: var(--canvas);
  font-size: 0.65rem;
}
.cover-placeholder.cover-detail {
  width: 100%;
  min-height: 15rem;
  font-size: 0.85rem;
}
.book-dialog {
  width: min(92vw, 700px);
}
.book-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 1.5rem;
}
.book-detail img {
  display: block;
  margin: auto;
}
.book-detail dl {
  margin: 0;
  min-width: 0;
}
.book-detail dt {
  color: var(--muted);
  font-size: 0.75rem;
}
.book-detail dd {
  margin: 0.1rem 0 0.9rem;
  overflow-wrap: anywhere;
}
.tracking-empty {
  text-align: center;
  padding: 2.5rem 1.5rem;
  background: var(--blue-light);
}
.shipment-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.shipment-heading h2 {
  font-size: 1.5rem;
  overflow-wrap: anywhere;
}
.shipment-metadata {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.shipment-metadata dt {
  font-size: 0.75rem;
  color: var(--muted);
}
.shipment-metadata dd {
  margin: 0.25rem 0 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.shipment-timeline {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
}
.shipment-timeline li {
  position: relative;
  margin-left: 0.4rem;
  padding: 0 0 1.5rem 1.75rem;
  border-left: 2px solid var(--line);
  overflow-wrap: anywhere;
}
.shipment-timeline li::before {
  content: "";
  position: absolute;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--blue);
  border: 2px solid white;
  left: -0.44rem;
  top: 0.35rem;
}
.shipment-timeline li:last-child {
  padding-bottom: 0;
  border-left-color: transparent;
}
.shipment-timeline time {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.shipment-timeline p {
  margin: 0;
}
.badge {
  display: inline-block;
  border-radius: 99px;
  padding: 0.2rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-success {
  color: #146744;
  background: #e4f5eb;
}
.badge-warning {
  color: #79540a;
  background: #fff3cb;
}
.badge-danger {
  color: var(--danger);
  background: #ffe9ec;
}
.page-footer {
  margin-top: 2.5rem;
  color: var(--muted);
  font-size: 0.75rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}
dialog {
  width: min(92vw, 560px);
  max-height: 85dvh;
  overflow-y: auto;
  border: 1px solid var(--line);
  padding: 1.6rem;
  border-radius: 1rem;
  color: var(--ink);
  box-shadow: 0 24px 100px #102b4a40;
}
dialog::backdrop {
  background: #0d2335a6;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}
.modal-header h2 {
  margin: 0.3rem 0;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
body.modal-open {
  overflow: hidden;
}
.auth-layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  min-height: 100vh;
}
.auth-aside {
  background: var(--navy);
  color: white;
  padding: clamp(2rem, 5vw, 5rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 3rem;
}
.auth-aside h2 {
  font-size: clamp(2rem, 3vw, 3.3rem);
  line-height: 1.2;
  letter-spacing: -0.035em;
  max-width: 28rem;
}
.auth-aside p {
  color: #c4d6ec;
  max-width: 27rem;
}
.auth-intro {
  border-left: 3px solid var(--yellow);
  padding-left: 1rem;
}
.demo-access {
  padding: 1rem;
  margin: 1.5rem 0;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--blue-light);
}
.demo-access h2 {
  margin-bottom: 0.5rem;
}
.demo-access p {
  overflow-wrap: anywhere;
}
.demo-access .field-hint {
  margin-top: 0.75rem;
}
.auth-aside footer small {
  color: #c4d6ec;
}
.auth-aside .eyebrow {
  color: var(--yellow);
}
.auth-art {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  margin-bottom: 2rem;
  height: 5rem;
}
.auth-art span {
  display: block;
  width: 2.5rem;
  border: 1px solid #718cac;
  border-radius: 0.2rem;
  height: 90%;
  background: #294d74;
}
.auth-art span:nth-child(2) {
  height: 100%;
  background: var(--yellow);
  border-color: transparent;
  transform: rotate(-8deg);
  margin-inline: 0.4rem;
}
.auth-art span:nth-child(3) {
  height: 75%;
}
.auth-main {
  display: grid;
  align-content: center;
  padding: clamp(1.5rem, 5vw, 5rem);
  background: white;
}
.auth-content {
  width: 100%;
  max-width: 420px;
  margin-inline: auto;
}
.auth-content .button[type="submit"] {
  width: 100%;
}
.auth-recovery {
  display: flex;
  justify-content: flex-end;
  margin: -0.75rem 0 0.5rem;
}
.auth-register {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.85rem;
}
.auth-footer {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.75rem;
  color: var(--muted);
}
@media (max-width: 1000px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .page-content {
    padding: 1.5rem;
  }
  .topbar {
    padding: 1rem 1.5rem;
  }
  .topbar-label {
    display: none;
  }
  .profile-text small {
    max-width: 15rem;
  }
}
@media (max-width: 720px) {
  .app-shell {
    display: block;
  }
  .sidebar {
    padding: 1rem;
    gap: 1rem;
  }
  .sidebar-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .menu-toggle {
    display: inline-flex;
    color: white;
    border-color: #718cac;
  }
  .sidebar-note {
    display: none;
  }
  .sidebar nav:not(.is-open) {
    display: none;
  }
  .topbar {
    min-height: auto;
    padding: 0.9rem 1rem;
  }
  .topbar-actions {
    width: 100%;
    justify-content: space-between;
    gap: 0.5rem;
  }
  .profile {
    flex: 1;
  }
  .profile-text {
    font-size: 0.72rem;
  }
  .profile-text small {
    font-size: 0.68rem;
  }
  .page-content {
    padding: 1.5rem 1rem;
  }
  .page-heading {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .card-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .section-head {
    flex-wrap: wrap;
  }
  .book-detail {
    grid-template-columns: 1fr;
  }
  .shipment-metadata {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }
  .book-detail .cover-detail {
    max-height: 15rem;
  }
  .inventory-summary > div {
    padding: 0.9rem;
  }
  .panel {
    padding: 1rem;
  }
  .page-footer {
    flex-wrap: wrap;
  }
  .auth-layout {
    grid-template-columns: 1fr;
  }
  .auth-aside {
    padding: 1.5rem;
    gap: 1.5rem;
  }
  .auth-aside h2 {
    font-size: 1.8rem;
  }
  .auth-art,
  .auth-aside footer {
    display: none;
  }
  .auth-main {
    padding: 2rem 1.5rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
