:root {
  --ink: #17201b;
  --muted: #647067;
  --paper: #fbfaf5;
  --panel: #ffffff;
  --line: #d9ded5;
  --leaf: #2d7050;
  --leaf-dark: #21523b;
  --sun: #f4c15d;
  --sky: #dcebf2;
  --rose: #c76b5a;
  --shadow: 0 18px 45px rgba(23, 32, 27, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(220, 235, 242, 0.65), transparent 38%),
    linear-gradient(315deg, rgba(244, 193, 93, 0.2), transparent 34%),
    var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(18px, 4vw, 52px);
  border-bottom: 1px solid var(--line);
  background: rgba(251, 250, 245, 0.88);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.account-chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  padding: 9px 11px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 2px solid var(--ink);
  background: var(--sun);
  color: var(--ink);
  font-weight: 900;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  line-height: 1;
}

.brand p,
.section-heading p,
.detail-head p,
.book-card p,
label,
.label-copy,
.label-url {
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.tab,
.label-actions button,
#seed-button {
  min-height: 40px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  padding: 0 14px;
  cursor: pointer;
}

.tab.is-active,
.label-actions button:not(:disabled):hover,
#seed-button:hover {
  border-color: var(--line);
  background: var(--sky);
}

main {
  width: min(1160px, calc(100% - 32px));
  margin: 34px auto 72px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.75fr);
  gap: 22px;
  align-items: start;
}

.panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 28px);
}

.narrow-panel {
  max-width: 820px;
  margin: 0 auto 22px;
}

.section-heading {
  margin-bottom: 22px;
}

.eyebrow {
  color: var(--leaf);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h2 {
  margin-top: 4px;
  font-size: clamp(1.6rem, 4vw, 2.35rem);
  line-height: 1.05;
}

form {
  display: grid;
  gap: 17px;
}

label {
  display: grid;
  gap: 7px;
  font-size: 0.88rem;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  min-height: 46px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px rgba(45, 112, 80, 0.12);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.primary-action {
  min-height: 48px;
  border: 0;
  background: var(--leaf);
  color: #fff;
  font-weight: 850;
  cursor: pointer;
}

.primary-action:hover {
  background: var(--leaf-dark);
}

.book-label {
  display: grid;
  gap: 10px;
  min-height: 330px;
  align-content: center;
  padding: 28px;
  border: 2px dashed var(--leaf);
  background:
    linear-gradient(rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.9)),
    repeating-linear-gradient(0deg, transparent 0, transparent 18px, rgba(45, 112, 80, 0.12) 19px);
  text-align: center;
}

.label-qr {
  justify-self: center;
  width: 116px;
  height: 116px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 7px;
}

.label-kicker {
  color: var(--rose);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
}

.book-label h3 {
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  line-height: 1.08;
}

.tracking-code {
  justify-self: center;
  width: min(100%, 290px);
  margin-top: 10px;
  padding: 14px 18px;
  border: 2px solid var(--ink);
  background: var(--sun);
  font-size: clamp(1.2rem, 4vw, 1.65rem);
  font-weight: 950;
  letter-spacing: 0.04em;
}

.label-url {
  overflow-wrap: anywhere;
  font-weight: 800;
}

.label-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.label-actions button,
#seed-button {
  border-color: var(--line);
  background: #fff;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.lookup-row {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.book-detail {
  margin-top: 22px;
}

.detail-head,
.library-header,
.book-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.detail-head {
  align-items: start;
  margin-bottom: 22px;
}

.code-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--sky);
  padding: 8px 10px;
  font-weight: 900;
}

.checkin-form {
  padding: 18px;
  background: #f7faf5;
  border: 1px solid var(--line);
}

.timeline {
  list-style: none;
  display: grid;
  gap: 14px;
  margin: 24px 0 0;
  padding: 0;
}

.timeline li {
  position: relative;
  padding: 16px 16px 16px 44px;
  border: 1px solid var(--line);
  background: #fff;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 21px;
  width: 12px;
  height: 12px;
  background: var(--rose);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--rose);
}

.timeline strong {
  display: block;
}

.timeline span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 3px;
}

.book-list {
  display: grid;
  gap: 12px;
}

.book-card {
  align-items: center;
  border: 1px solid var(--line);
  background: #fff;
  padding: 16px;
}

.book-card button {
  min-height: 38px;
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 0 12px;
  cursor: pointer;
}

.empty-state {
  padding: 32px;
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
}

.status-banner {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: #fff8df;
  color: #6f5313;
  font-weight: 750;
}

.profile-panel {
  margin-top: 22px;
}

.profile-actions,
.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.profile-actions button,
.admin-row button {
  min-height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 14px;
  cursor: pointer;
}

.admin-list {
  display: grid;
  gap: 12px;
}

.admin-row {
  border: 1px solid var(--line);
  background: #fff;
  padding: 14px;
}

.admin-row select {
  width: 150px;
}

@media (max-width: 820px) {
  .topbar,
  .detail-head,
  .library-header,
  .profile-actions,
  .admin-row {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .split-layout,
  .field-grid,
  .lookup-row {
    grid-template-columns: 1fr;
  }

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

@media print {
  body * {
    visibility: hidden;
  }

  #print-label,
  #print-label * {
    visibility: visible;
  }

  #print-label {
    position: fixed;
    inset: 0;
    width: 4in;
    height: 5in;
    margin: auto;
    box-shadow: none;
  }
}
