:root {
  --bg-top: #eef6ff;
  --bg-mid: #f7fbff;
  --bg-bottom: #edf2f7;
  --card: rgba(255, 255, 255, 0.93);
  --line: #d7e2ee;
  --line-strong: #c4d4e4;
  --text: #1a2432;
  --muted: #5c6f84;
  --brand: #1563b8;
  --brand-dark: #0f4d94;
  --accent: #1f8f8a;
  --danger: #b01f3d;
  --shadow-soft: 0 8px 24px rgba(16, 47, 79, 0.08);
  --shadow-strong: 0 16px 38px rgba(16, 47, 79, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: "Avenir Next", Avenir, "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 420px at -12% -10%, rgba(21, 99, 184, 0.22), transparent 60%),
    radial-gradient(900px 320px at 110% -10%, rgba(31, 143, 138, 0.14), transparent 55%),
    linear-gradient(180deg, var(--bg-top), var(--bg-mid) 44%, var(--bg-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
  background: linear-gradient(110deg, rgba(14, 71, 133, 0.88), rgba(19, 105, 188, 0.82));
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 28px rgba(6, 29, 53, 0.24);
}

.topbar-head {
  display: contents;
}

.brand-wrap {
  min-width: 260px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-decoration: none;
  font-size: 1.2rem;
}

.brand-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.32);
  flex: 0 0 auto;
}

.brand-home svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-sub {
  margin: 2px 0 0;
  color: rgba(235, 245, 255, 0.9);
  font-size: 0.86rem;
}

.app-version-chip-wrap {
  margin-top: 6px;
}

.app-version-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.26);
  color: rgba(245, 250, 255, 0.96);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.release-notes-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 12px 0 18px;
}

.release-notes-list {
  display: grid;
  gap: 10px;
}

.release-note-item {
  border: 1px solid #d8e3ef;
  border-radius: 14px;
  background: #f8fbff;
  padding: 12px 14px;
  color: #284669;
  line-height: 1.45;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mobile-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.14);
  color: #f7fbff;
  cursor: pointer;
  padding: 0;
}

.mobile-nav-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #f7fbff;
  text-decoration: none;
  font-weight: 650;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.main-nav a:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.38);
}

.main-nav a.active {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.45);
}

.nav-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.nav-ico svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.container {
  max-width: 1680px;
  margin: 24px auto;
  padding: 0 20px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-soft);
  animation: rise-in 320ms ease-out;
  overflow-x: auto;
}

.panel h1,
.panel h2 {
  margin-top: 0;
  letter-spacing: 0.01em;
}

.hidden {
  display: none !important;
}

.hint {
  color: var(--muted);
  margin-top: -6px;
  margin-bottom: 12px;
}

.heading-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.bulk-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 4px 0 12px;
}

.bulk-check-all {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 650;
}

.bulk-check-all input,
.col-select input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.col-select {
  width: 44px;
  text-align: center;
  vertical-align: middle;
}

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

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.meta-grid > div,
.meta-item {
  background: rgba(246, 251, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}

.meta-item.is-verified {
  border-color: #2b9a49;
  box-shadow: inset 0 0 0 1px rgba(43, 154, 73, 0.12);
  position: relative;
}

.meta-item.is-verified::after {
  content: "✓";
  position: absolute;
  top: 8px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #2b9a49;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.86rem;
}

.verification-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.verification-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
  transition: box-shadow .16s ease, border-color .16s ease;
}

.meta-item[data-verify-jump] {
  cursor: pointer;
}

.meta-item[data-verify-jump]:hover {
  box-shadow: inset 0 0 0 1px rgba(21, 99, 184, 0.16);
}

.verification-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.verification-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.verification-badge.inline-badge {
  width: 18px;
  height: 18px;
  font-size: 0.72rem;
  vertical-align: middle;
  margin-left: 6px;
}

.verification-badge.ok {
  background: #2b9a49;
  color: #fff;
}

.verification-badge.manual {
  background: #e5a11f;
  color: #fff;
}

.verification-badge.warn,
.verification-badge.error {
  background: #c53b3b;
  color: #fff;
}

.verification-card.verification-ok {
  border-color: #2b9a49;
}

.verification-card.verification-manual {
  border-color: #d9b15a;
}

.verification-card.verification-warn,
.verification-card.verification-error {
  border-color: #c53b3b;
}

.verification-reason-title {
  margin: 6px 0 4px;
  font-size: 0.84rem;
  font-weight: 700;
  color: #40607f;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.verification-message {
  line-height: 1.45;
}

.verification-feedback {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #e6eef6;
}

.verification-card.is-collapsed .verification-reason-title,
.verification-card.is-collapsed .verification-message,
.verification-card.is-collapsed .verification-matches,
.verification-card.is-collapsed .verification-feedback {
  display: none;
}

.verification-feedback-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.verification-feedback-help {
  margin: 0 0 10px;
}

.verification-feedback-btn.is-active {
  background: #eef5fd;
  border-color: #8db2d6;
  color: #123d66;
}

.verification-feedback-note {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.verification-feedback-note span {
  font-size: 0.9rem;
  font-weight: 600;
  color: #35516d;
}

.verification-feedback-bottom {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.verification-feedback-state {
  margin: 0;
}

.verification-feedback-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.verification-feedback-badge.agree {
  background: #e8f7ec;
  color: #1f7c3a;
}

.verification-feedback-badge.manual {
  background: #fff2d9;
  color: #9b6500;
}

.verification-feedback-badge.disagree {
  background: #ffe3e3;
  color: #a92b2b;
}

.meta-item.status-ok {
  border-color: #2b9a49;
}

.meta-item.status-manual {
  border-color: #d9b15a;
}

.meta-item.status-warn,
.meta-item.status-error {
  border-color: #c53b3b;
}

.verification-matches {
  margin-top: 8px;
  font-size: 0.9rem;
  line-height: 1.35;
  color: #334;
}

.search-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  margin-bottom: 16px;
}

.search-row input {
  flex: 1;
  width: min(560px, 100%);
}

.search-highlight {
  background: #fff176;
  color: #111;
  border-radius: 3px;
  padding: 0 1px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 12px;
}

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

.book-pages {
  overflow: visible;
}

.book-a4-wrap {
  margin-top: 8px;
  overflow: hidden;
  position: relative;
  min-height: var(--book-wrap-height, 760px);
  height: var(--book-wrap-height, 760px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0 18px;
}

.book-reader-shell {
  position: relative;
}

.book-prefill-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 10px 12px;
  margin: 6px 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #fcfeff, #f5f9fe);
}

.book-prefill-panel .actions {
  align-self: end;
}

.book-picker-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.book-picker-display {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  background: #f8fbff;
}

.picker-launch-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.picker-launch-row .book-picker-display {
  flex: 1 1 auto;
}

.picker-launch-btn {
  flex: 0 0 auto;
  min-height: 44px;
  min-width: 92px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid #c9d7e6;
  background: linear-gradient(180deg, #ffffff, #eef5fd);
  color: #234568;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.picker-fallback {
  margin-top: 8px;
  margin-bottom: 8px;
}

.circuits-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(180deg, #fcfeff, #f5f9fe);
}

.circuits-panel h3,
.circuit-card h4 {
  margin: 0;
  color: #204467;
}

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

.circuit-card {
  border: 1px solid #d9e5f1;
  border-radius: 14px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(22, 57, 92, 0.06);
}

.compact-grid {
  gap: 10px 12px;
}

.danger-lite {
  background: linear-gradient(180deg, #fff7f8, #ffe7eb);
  border-color: #e2b1bc;
  color: #8a2440;
  box-shadow: none;
}

.meta-stack {
  display: grid;
  gap: 6px;
  color: #25425f;
}

.evidence-open-trigger {
  cursor: pointer;
  border-style: dashed;
  border-color: #8fb0cf;
  text-align: center;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: #234568;
}

.picker-trigger {
  min-height: 44px;
  white-space: nowrap;
}

.book-a4-stage {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 22px;
  min-width: 0;
  width: var(--book-stage-width, 794px);
  height: var(--book-stage-height, 1123px);
  transform: scale(var(--book-scale, 1));
  transform-origin: top center;
  transition: transform 0.18s ease;
}

body.book-reader-pinching .book-a4-stage,
body.book-reader-pinching .book-sheet,
body.book-reader-pinching .sheet-cover {
  transition: none !important;
}

.book-sheet {
  width: 794px;
  height: 1123px;
  min-height: 1123px;
  background: #fff;
  border: 1px solid #ced9e3;
  box-shadow: 0 16px 30px rgba(15, 48, 80, 0.12);
  padding: 34px 42px 54px;
  display: none;
  position: relative;
  flex: 0 0 auto;
}

.book-sheet.is-active {
  display: block;
}

.book-sheet.is-turning {
  animation: book-sheet-in 0.28s ease;
}

.book-a4-stage.is-spread {
  justify-content: flex-start;
}

@keyframes book-sheet-in {
  0% {
    opacity: 0.72;
    transform: translateX(18px) scale(0.992);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.sheet-page-no {
  position: absolute;
  bottom: 12px;
  right: 24px;
  color: #111;
  font-size: 0.9rem;
  margin: 0;
}

.sheet-page-no.is-left {
  left: 24px;
  right: auto;
}

.sheet-page-no.is-right {
  right: 24px;
  left: auto;
}

.sheet-page-no.is-hidden {
  display: none;
}

.book-page-nav {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 10px;
  width: min(100%, var(--book-rendered-width, 794px));
  margin-left: auto;
  margin-right: auto;
}

.book-stage-arrow {
  position: absolute;
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
  z-index: 4;
  width: 60px;
  min-width: 60px;
  max-width: 60px;
  height: 96px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #111;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: auto;
  transition: opacity 0.6s ease;
  outline: none;
  box-shadow: none;
  appearance: none;
}

.book-stage-arrow svg {
  width: 36px;
  height: 36px;
  padding: 0;
  box-sizing: border-box;
  border-radius: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  opacity: 0;
  transition: opacity 0.6s ease, transform 0.18s ease;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.18));
}

.book-stage-arrow:disabled {
  opacity: 0 !important;
  pointer-events: none;
}

.book-stage-arrow-left {
  left: max(8px, env(safe-area-inset-left));
  justify-content: flex-start;
  padding-left: 6px;
}

.book-stage-arrow-right {
  right: max(8px, env(safe-area-inset-right));
  justify-content: flex-end;
  padding-right: 6px;
}

.book-page-nav .icon-btn {
  width: 42px;
  height: 42px;
}

.book-page-mid {
  display: block;
  position: relative;
  padding-top: 36px;
}

.book-page-slider {
  width: 100%;
  accent-color: #1b68bc;
  cursor: pointer;
}

.book-page-counter {
  min-height: 36px;
  border: 1px solid rgba(17, 17, 17, 0.14);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.96);
  color: #1f3f61;
  font-weight: 650;
  letter-spacing: 0.01em;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 8px 18px rgba(20, 42, 68, 0.12);
  white-space: nowrap;
}

body.book-reader-mode {
  overflow: hidden;
}

body.book-reader-mode .topbar,
body.book-reader-mode .footer,
body.book-reader-mode .flash-wrap,
body.book-reader-mode .view-switch,
body.book-reader-mode > .container > .panel:not(.book-pages) {
  display: none !important;
}

body.book-reader-mode .container {
  max-width: none;
  margin: 0;
  padding: 0;
}

body.book-reader-mode .book-pages {
  position: fixed;
  inset: 0;
  z-index: 40;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  background: linear-gradient(180deg, #f7fbff, #edf4fb);
}

body.book-reader-mode .book-reader-heading,
body.book-reader-mode .book-reader-hint {
  display: none;
}

body.book-reader-mode .book-reader-shell {
  position: absolute;
  inset: 0 0 0 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--reader-top-reserve, 0px) 10px var(--reader-bottom-reserve, 0px);
}

body.book-reader-mode .book-a4-wrap {
  width: 100%;
  height: calc(100% - var(--reader-top-reserve, 0px) - var(--reader-bottom-reserve, 0px));
  min-height: 0;
  margin-top: 0;
  padding: 0;
  align-items: flex-start;
  justify-content: center;
  overflow: visible;
}

body.book-reader-mode .book-page-nav {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 45;
  width: min(96vw, var(--book-rendered-width, 794px));
  opacity: 0;
  transition: opacity 0.6s ease;
}

body.book-reader-mode.book-reader-guides .book-page-nav,
body.book-reader-mode .book-page-nav:hover,
body.book-reader-mode .book-page-nav:focus-within {
  opacity: 1;
}

body.book-reader-mode.book-reader-guides .book-stage-arrow,
.book-a4-wrap:hover .book-stage-arrow,
.book-stage-arrow:focus-visible {
  opacity: 1;
}

body.book-reader-mode.book-reader-guides .book-stage-arrow svg,
.book-a4-wrap:hover .book-stage-arrow svg,
.book-stage-arrow:focus-visible svg {
  opacity: 1;
  transform: scale(1.02);
}

body.book-reader-mode .book-stage-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 46;
}

body.book-reader-mode .book-stage-arrow-left {
  left: 10px;
}

body.book-reader-mode .book-stage-arrow-right {
  right: 10px;
}

body.book-reader-mode .book-pages > .actions {
  position: fixed;
  top: 8px;
  right: 10px;
  z-index: 46;
  margin: 0 !important;
}

body.book-reader-mode .book-pages > .actions .action-link,
body.book-reader-mode .book-pages > .actions a[href*="verify"],
body.book-reader-mode .book-pages > .actions a[href*="export"],
body.book-reader-mode .book-pages > .actions button[type="submit"] {
  display: none !important;
}

body.book-reader-mode #mode-book-back {
  min-height: 42px;
}

@page {
  size: A4;
  margin: 10mm;
}

@media print {
  body.book-print-mode * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body.book-print-mode .book-sheet,
  body.book-print-mode .book-sheet input,
  body.book-print-mode .book-sheet textarea,
  body.book-print-mode .book-sheet select {
    font-size: 12px !important;
    line-height: 1.2 !important;
  }

  body.book-print-mode {
    background: #fff;
  }

  body.book-print-mode .topbar,
  body.book-print-mode .footer,
  body.book-print-mode .flash-wrap,
  body.book-print-mode .view-switch,
  body.book-print-mode .heading-row,
  body.book-print-mode #book-main-form,
  body.book-print-mode #book-page-prev,
  body.book-print-mode #book-page-next,
  body.book-print-mode .book-page-nav,
  body.book-print-mode #mode-book-back,
  body.book-print-mode .app-modal {
    display: none !important;
  }

  body.book-print-mode .container,
  body.book-print-mode .panel,
  body.book-print-mode .book-pages {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    max-width: none !important;
  }

  body.book-print-mode section.panel:not(#book-pages-mode) {
    display: none !important;
  }

  body.book-print-mode .book-pages > h2,
  body.book-print-mode .book-pages > .hint {
    display: none !important;
  }

  body.book-print-mode .book-pages > .actions {
    display: none !important;
  }

  body.book-print-mode .book-a4-wrap {
    overflow: visible !important;
    margin: 0 !important;
  }

  body.book-print-mode .book-a4-stage {
    display: block !important;
    min-width: 0 !important;
    break-inside: auto !important;
    page-break-inside: auto !important;
  }

  body.book-print-mode .book-a4-stage.print-all-pages .book-sheet,
  body.book-print-mode .book-a4-stage .book-sheet.is-active {
    display: block !important;
    width: 178mm !important;
    height: 252mm !important;
    min-height: 252mm !important;
    margin: 0 auto !important;
    padding: 14px 24px 20px !important;
    box-sizing: border-box !important;
    border: 0 !important;
    box-shadow: none !important;
    overflow: hidden !important;
    break-inside: avoid;
    page-break-inside: avoid;
    break-before: page;
    page-break-before: always;
    break-after: auto;
    page-break-after: auto;
  }

  body.book-print-mode .book-a4-stage .book-sheet:first-child {
    break-before: auto;
    page-break-before: auto;
  }

  body.book-print-mode .book-sheet .sheet-page-no {
    bottom: -4px !important;
  }

  body.book-print-mode .book-sheet .cover-title {
    margin-top: 72px !important;
  }

  body.book-print-mode .book-sheet .cover-subtitle {
    margin-bottom: 24px !important;
  }

  body.book-print-mode .book-sheet .cover-footnote {
    font-size: 0.88rem !important;
    line-height: 1.28 !important;
  }

  body.book-print-mode .book-sheet .sheet-manual h3 {
    font-size: 1.28rem !important;
    margin: 0 0 4px !important;
    line-height: 1.2 !important;
  }

  body.book-print-mode .book-sheet .manual-note {
    font-size: 0.78rem !important;
    margin: 0 0 4px !important;
    line-height: 1.2 !important;
  }

  body.book-print-mode .book-sheet .manual-block {
    margin: 5px 0 !important;
  }

  body.book-print-mode .book-sheet .manual-block strong {
    font-size: 0.88rem !important;
    margin-bottom: 1px !important;
    line-height: 1.2 !important;
  }

  body.book-print-mode .book-sheet .manual-block p {
    font-size: 0.76rem !important;
    line-height: 1.22 !important;
    margin: 0 !important;
  }

  body.book-print-mode #book-location-display-data {
    min-height: 40px !important;
    max-height: 56px !important;
    padding-top: 4px !important;
    padding-bottom: 4px !important;
    overflow: hidden !important;
    resize: none !important;
  }

  body.book-print-mode .records-actions,
  body.book-print-mode .action-link,
  body.book-print-mode .action-btn {
    display: none !important;
  }

  body.book-print-mode .book-sheet .print-empty {
    color: transparent !important;
    caret-color: transparent !important;
    text-shadow: none !important;
  }

  body.book-print-mode .book-sheet .print-empty::placeholder {
    color: transparent !important;
  }

  body.book-print-mode input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
  }

  body.book-print-mode input[type="number"]::-webkit-outer-spin-button,
  body.book-print-mode input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }
}

.sheet-cover {
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
}

.cover-top-right {
  align-self: flex-end;
  width: 212px;
  border: 1px solid #a7b6c4;
  border-radius: 12px;
  padding: 10px;
  overflow: hidden;
}

.cover-top-right input {
  min-height: 40px;
}

.cover-top-right select {
  min-height: 40px;
  margin-bottom: 6px;
}

.cover-mini-label {
  font-size: 0.86rem;
  text-align: center;
  margin-bottom: 6px;
  color: #111;
}

.cover-title {
  margin: 120px 0 0;
  text-align: center;
  letter-spacing: 0.01em;
  font-size: 3rem;
  font-weight: 730;
  color: #111;
}

.cover-subtitle {
  margin: 12px 0 54px;
  text-align: center;
  font-size: 2rem;
  color: #111;
}

.cover-fields {
  display: grid;
  gap: 12px;
}

.cover-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 12px;
  align-items: center;
}

.cover-row-multi {
  align-items: center;
}

.cover-label {
  font-size: 1.2rem;
  color: #111;
}

.cover-row input,
.cover-row textarea {
  border: 2px solid #111;
  border-radius: 12px;
  min-height: 56px;
  font-size: 1.05rem;
}

.cover-footnote {
  margin-top: auto;
  text-align: center;
  color: #111;
  font-size: 0.94rem;
}

.sheet-manual h3 {
  margin-top: 0;
  text-align: center;
  font-size: 2rem;
  color: #111;
}

.manual-note {
  margin-top: -6px;
  text-align: center;
  font-size: 0.95rem;
  color: #111;
}

.manual-block {
  margin: 12px 0;
}

.manual-block strong {
  display: block;
  margin-bottom: 2px;
  font-size: 1.08rem;
  color: #111;
}

.manual-block p {
  margin: 0;
  color: #111;
  line-height: 1.44;
}

.sheet-data h3 {
  margin: 14px 0 0;
  text-align: center;
  font-size: 2.1rem;
  color: #111;
}

.sheet-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  border: 1px solid #111;
  border-bottom: none;
  margin-top: 8px;
}

.sheet-label {
  border-bottom: 1px solid #111;
  border-right: 1px solid #111;
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  font-size: 1rem;
  color: #111;
}

.sheet-grid > input,
.sheet-grid > textarea,
.sheet-grid > .sheet-combined {
  border-bottom: 1px solid #111;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
  min-height: 48px;
}

.sheet-grid > input,
.sheet-grid > textarea {
  padding: 8px 10px;
}

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

.sheet-combined.amount-compact {
  grid-template-columns: 1fr 170px;
}

.sheet-combined input,
.sheet-combined select {
  border: none;
  border-radius: 0;
  min-height: 46px;
}

.sheet-combined > * + * {
  border-left: 1px solid #111;
}

.amount-field {
  min-height: 46px;
  position: relative;
}

.amount-input {
  width: 100%;
  height: 100%;
  text-align: right;
  padding-right: 36px;
}

.amount-input[type="number"]::-webkit-outer-spin-button,
.amount-input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.amount-input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.amount-unit {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #4c6278;
  font-weight: 620;
  pointer-events: none;
  background: transparent;
}

.sheet-notes {
  margin: 8px 0 0;
  color: #5f6f7f;
  font-size: 0.91rem;
}

.sheet-notes-page label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  color: #4c5f73;
  font-weight: 560;
}

.sheet-help-text {
  font-weight: 450;
  color: #66798d;
  font-size: 0.92rem;
  line-height: 1.35;
}

.sheet-notes-page textarea {
  min-height: 0;
  border: 1px solid #bac9d7;
  border-radius: 0;
}

.sheet-notes-page {
  height: 100%;
  display: grid;
  grid-template-rows: 1fr 1fr 1fr;
  gap: 12px;
}

.sheet-notes-page label textarea {
  flex: 1 1 auto;
  height: 100%;
}

.records-page h3,
.sheet-important-page h3 {
  margin: 0 0 10px;
  text-align: center;
  font-size: 1.38rem;
  color: #111;
}

.records-page {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.records-table {
  border: 1px solid #111;
  border-bottom: none;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.records-head,
.records-row {
  display: grid;
  grid-template-columns: 82px 1.18fr 1.82fr 72px 72px 72px;
}

.records-tail {
  display: grid;
  grid-template-columns: 82px 1.18fr 1.82fr 72px 72px 72px;
  flex: 1 1 auto;
  min-height: 0;
}

.records-head > div,
.records-row > div {
  border-right: 1px solid #111;
  border-bottom: 1px solid #111;
  padding: 6px 7px;
  font-size: 0.82rem;
  line-height: 1.2;
  min-height: 66px;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  vertical-align: top;
}

.records-head > div {
  font-weight: 700;
  background: #fff;
  color: #111;
  font-size: 0.8rem;
  line-height: 1.1;
  padding-top: 8px;
  padding-bottom: 8px;
}

.records-head > div:nth-child(1),
.records-head > div:nth-child(2),
.records-head > div:nth-child(3) {
  font-size: 0.94rem;
  line-height: 1.16;
}

.records-head > div:nth-child(4),
.records-head > div:nth-child(5),
.records-head > div:nth-child(6) {
  font-size: 0.82rem;
  line-height: 1.08;
}

.records-row > div:last-child,
.records-head > div:last-child,
.records-tail > div:last-child {
  border-right: none;
}

.records-tail > div {
  border-right: 1px solid #111;
  border-bottom: 1px solid #111;
  min-height: 100%;
}

.records-row > div:nth-child(3) {
  white-space: pre-wrap;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  overflow: visible;
}

.records-row > div:nth-child(2) {
  min-height: 126px;
}

.records-head > div:nth-child(1),
.records-row > div:nth-child(1),
.records-head > div:nth-child(4),
.records-head > div:nth-child(5),
.records-head > div:nth-child(6),
.records-row > div:nth-child(4),
.records-row > div:nth-child(5),
.records-row > div:nth-child(6) {
  text-align: center;
}

.records-row.is-empty > div {
  border-bottom: none;
}

.records-row.is-struck > div {
  position: relative;
}

.records-row.is-struck > div::after {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  top: 50%;
  border-top: 1px solid #111;
  transform: rotate(-6deg);
  transform-origin: center;
  pointer-events: none;
}

.record-cell-input {
  width: 100%;
  min-height: 28px;
  border: none;
  border-radius: 0;
  padding: 4px 5px;
  font-size: 0.82rem;
  background: #fff;
}

.record-cell-input:focus {
  outline: 1px solid #8cb3d9;
  box-shadow: none;
}

.record-cell-text {
  min-height: 38px;
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  resize: none;
}

.record-cell-text-view {
  min-height: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  width: 100%;
  margin: 0;
  padding: 0;
  text-indent: 0;
  line-height: 1.2;
}

.record-next-wrap {
  margin-top: 4px;
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 6px;
  align-items: center;
  font-size: 0.74rem;
  color: #5a6f84;
}

.record-next-text {
  display: block;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed #c8d6e3;
  font-size: 0.68rem;
  line-height: 1.15;
  color: #5a6f84;
  white-space: normal;
  overflow-wrap: anywhere;
}

.record-cell-num {
  text-align: right;
}

.record-cell-date {
  text-align: center;
}

.records-important-note {
  margin-top: 8px;
  padding-top: 10px;
}

.records-important-note label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #4c5f73;
  font-weight: 560;
}

.records-important-note textarea {
  min-height: 140px;
  border: 1px solid #bac9d7;
  border-radius: 0;
}

.sheet-important-page label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 14px;
  font-weight: 560;
  color: #475f74;
}

.sheet-important-page textarea {
  border-radius: 0;
  border: 1px solid #bac9d7;
}

  .records-actions {
    margin-bottom: 8px;
  }

  .entry-modal-card {
    height: calc(100vh - 12px);
    max-height: calc(100vh - 12px);
  }

  .manual-entry-form {
    grid-template-columns: 1fr !important;
    gap: 9px;
  }

  .manual-entry-form label {
    margin: 0;
  }

  .manual-entry-form input,
  .manual-entry-form select,
  .manual-entry-form textarea {
    width: 100%;
  }

  .manual-entry-form textarea {
    min-height: 120px;
  }

.entry-modal-card {
  width: min(1120px, calc(100% - 24px));
  height: min(92vh, 960px);
  max-height: calc(100vh - 24px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.manual-entry-shell {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  overflow: hidden;
}

.manual-entry-form {
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  gap: 10px 12px;
}

.manual-entry-actions {
  position: relative;
  background: #fff;
  padding-top: 8px;
  padding-bottom: 2px;
  border-top: 1px solid #e2eaf3;
  box-shadow: 0 -8px 18px rgba(19, 43, 74, 0.06);
}

.manual-entry-form textarea {
  min-height: 110px;
}

.ocr-debug-card {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #cfe0f0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
}

.ocr-debug-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.ocr-debug-grid > div {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #d7e4f1;
  background: #f8fbff;
  font-size: 0.95rem;
  line-height: 1.35;
}

.ocr-debug-grid > div.ocr-uncertain {
  border-color: #d66b6b;
  background: #fff3f3;
  color: #8e1f1f;
}

.ocr-uncertain-field {
  border-color: inherit !important;
  color: inherit !important;
  background: inherit !important;
  box-shadow: none !important;
}

.ocr-debug-text {
  margin-top: 12px;
}

.ocr-debug-text summary {
  cursor: pointer;
  font-weight: 650;
  color: #29527a;
}

.ocr-debug-text pre {
  margin: 10px 0 0;
  padding: 12px;
  max-height: 240px;
  overflow: auto;
  border-radius: 12px;
  background: #0f1d2b;
  color: #eaf3ff;
  font-size: 0.84rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.ocr-review-card {
  width: min(980px, calc(100% - 24px));
}

.ocr-review-progress {
  margin-left: auto;
  padding: 6px 12px;
  border-radius: 999px;
  background: #eef5ff;
  color: #2c547d;
  font-weight: 700;
  font-size: 0.9rem;
}

.ocr-review-body,
.ocr-review-step {
  display: grid;
  gap: 12px;
}

.ocr-review-meta {
  display: grid;
  gap: 4px;
}

.ocr-review-meta-title {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #67809a;
}

.ocr-review-label {
  font-size: 1rem;
  font-weight: 750;
  color: #24486d;
}

.ocr-review-crop {
  padding: 12px 14px;
  border-radius: 14px;
  background: #f9fbfe;
  border: 1px solid #d8e6f3;
}

.ocr-review-crop-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  color: #274768;
}

.ocr-review-crop img {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 10px;
  background: white;
  border: 1px solid #d4dfeb;
}

.ocr-review-crop-missing {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px dashed #d5c1a1;
  background: #fff9ef;
  color: #7a5c1e;
  font-weight: 600;
}

.ocr-manual-card {
  width: min(1580px, calc(100% - 20px));
  max-height: calc(100vh - 20px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ocr-manual-card-fullscreen {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
}

.ocr-manual-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.ocr-manual-toolbar label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  color: #274768;
}

.ocr-manual-toolbar select {
  min-width: 180px;
}

.ocr-manual-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
  align-items: stretch;
  min-height: 0;
  flex: 1 1 auto;
}

.ocr-manual-side {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ocr-manual-page-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ocr-manual-page-picker .icon-btn {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
}

.ocr-manual-page-count {
  min-width: 56px;
  text-align: center;
  font-weight: 700;
  color: #274768;
}

.ocr-manual-canvas-wrap {
  border: 1px solid #d8e6f3;
  border-radius: 16px;
  background: #f8fbff;
  padding: 6px;
  overflow: hidden;
  max-height: none;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  position: relative;
  touch-action: none;
}

.ocr-manual-image-actions {
  margin-top: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.ocr-manual-canvas {
  position: relative;
  display: inline-block;
  line-height: 0;
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transform-origin: top left;
  will-change: transform;
}

.ocr-manual-canvas img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  border: 1px solid #d4dfeb;
  background: white;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  object-fit: contain;
  touch-action: none;
}

.ocr-manual-selection {
  position: absolute;
  border: 2px solid #2f77cc;
  background: rgba(47, 119, 204, 0.12);
  border-radius: 8px;
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(9, 32, 56, 0.10);
}

.ocr-manual-detected {
  position: absolute;
  border: 3px solid #ff9f1c;
  background: rgba(255, 159, 28, 0.14);
  border-radius: 8px;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9) inset;
}

.ocr-manual-readout {
  padding: 12px 14px;
  border-radius: 14px;
  background: #f6faff;
  border: 1px solid #d8e6f3;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ocr-manual-readout textarea {
  display: block;
  width: 100%;
  min-height: 96px;
  margin-top: 8px;
  resize: vertical;
  border: 1px solid #cfe0ef;
  border-radius: 12px;
  padding: 12px 14px;
  background: white;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.45;
}

@media (max-width: 980px) {
  .book-a4-stage,
  .book-a4-stage.is-spread {
    gap: 0;
    justify-content: center;
  }

  .book-a4-wrap {
    padding: 0;
  }

  .book-stage-arrow {
    display: none;
  }

  .ocr-manual-body {
    grid-template-columns: 1fr;
  }

  .ocr-manual-canvas-wrap,
  .ocr-manual-readout {
    min-height: auto;
    max-height: none;
  }

  .ocr-manual-canvas-wrap {
    min-height: min(62dvh, 720px);
  }
}

.scan-workbench-page {
  display: grid;
  gap: 14px;
  height: 100%;
}

.scan-workbench-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.scan-workbench-panel {
  padding: 14px;
}

.scan-workbench-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.scan-workbench-toolbar label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  color: #274768;
}

.scan-workbench-field {
  font-weight: 700;
  color: #274768;
}

.scan-workbench-toolbar .ghost.is-active {
  background: rgba(21, 95, 173, 0.12);
  border-color: #6d98c8;
  color: #155fad;
}

.scan-workbench-stage {
  position: relative;
  min-height: min(76dvh, 980px);
  overflow: hidden;
  border: 1px solid #d8e6f3;
  border-radius: 18px;
  background: #f5f9ff;
  touch-action: none;
  overscroll-behavior: none;
}

.scan-workbench-canvas {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  will-change: transform;
  user-select: none;
  -webkit-user-select: none;
}

.scan-workbench-canvas img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 14px;
  background: white;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.scan-workbench-box {
  position: absolute;
  border: 3px solid #ff9f1c;
  background: rgba(255, 159, 28, 0.14);
  border-radius: 8px;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9) inset;
}

.scan-workbench-selection {
  position: absolute;
  border: 3px solid #2f77cc;
  background: rgba(47, 119, 204, 0.14);
  border-radius: 8px;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9) inset;
}

.scan-workbench-readout {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #d8e6f3;
  border-radius: 16px;
  background: #f8fbff;
}

.scan-workbench-readout textarea {
  display: block;
  width: 100%;
  margin-top: 8px;
  min-height: 90px;
  resize: vertical;
  border: 1px solid #cfe0ef;
  border-radius: 12px;
  padding: 12px 14px;
  background: white;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.9rem;
}

.scan-workbench-readout-actions {
  margin-top: 10px;
}

.page-scan_workbench {
  overflow: hidden;
}

.page-scan_workbench .container {
  max-width: none;
  height: calc(100dvh - 88px);
  overflow: hidden;
  padding-bottom: 12px;
}

@media (max-width: 980px) {
  .scan-workbench-page {
    gap: 8px;
  }

  .scan-workbench-top {
    flex-direction: column;
    gap: 8px;
  }

  .scan-workbench-panel {
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .scan-workbench-stage {
    min-height: calc(100dvh - 168px);
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .page-scan_workbench .container {
    height: calc(100dvh - 74px);
    padding: 8px 0 8px;
  }

  .scan-workbench-toolbar {
    padding: 0 10px;
    gap: 8px;
  }

  .scan-workbench-readout {
    margin-top: 8px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    padding: 10px;
  }

  .scan-workbench-readout textarea {
    min-height: 72px;
  }
}

.app-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
}

html.app-modal-lock,
body.app-modal-lock {
  overflow: hidden;
  overscroll-behavior: none;
}

.app-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 29, 47, 0.36);
}

.app-modal-card {
  position: relative;
  width: min(680px, calc(100% - 24px));
  max-height: min(78vh, 820px);
  margin: 7vh auto 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 48px rgba(13, 34, 59, 0.25);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-sizing: border-box;
  overflow: hidden;
}

.evidence-modal-card {
  width: min(560px, calc(100% - 24px));
  max-height: min(72vh, 760px);
}

#evidence-modal-main {
  display: grid;
  gap: 16px;
}

#evidence-modal-main .app-modal-head {
  margin-bottom: 2px;
}

#evidence-modal-main label {
  display: grid;
  gap: 8px;
}

.customer-modal-card {
  width: min(640px, calc(100% - 24px));
  max-height: min(78vh, 760px);
}

#customer-modal-main {
  display: grid;
  gap: 16px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

#customer-modal-main .app-modal-head {
  margin-bottom: 2px;
}

#customer-modal-main label {
  display: grid;
  gap: 8px;
}

#customer-modal-main.customer-modal-location-only {
  gap: 14px;
}

.customer-open-trigger {
  cursor: pointer;
  background: #f7fbff;
  text-align: center;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: #234568;
}

#book-location-display-data {
  min-height: 48px;
  line-height: 1.2;
  padding: 8px 10px;
}

.modal-inline-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.modal-inline-row-wide {
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: start;
}

#customer-modal-customer-results,
#customer-modal-location-results {
  min-height: 0;
  max-height: min(24vh, 240px);
}

#customer-modal-owner-name,
#customer-modal-owner-address,
#customer-modal-owner-phone {
  background: #f8fbff;
}

.customer-modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
  position: sticky;
  bottom: 0;
  background: #fff;
  padding-top: 8px;
}

.customer-modal-actions .ghost,
.customer-modal-actions button {
  min-height: 46px;
}

.technician-update-panel {
  display: grid;
  gap: 14px;
}

.technician-update-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #d8e6f3;
  border-radius: 14px;
  background: #f8fbff;
}

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

.technician-update-box {
  border: 1px solid #dbe6f2;
  border-radius: 14px;
  background: #fff;
  padding: 12px 14px;
  display: grid;
  gap: 6px;
}

.technician-update-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.technician-update-source {
  margin: 0;
}

@media (max-width: 760px) {
  .technician-update-grid,
  .technician-update-form-grid {
    grid-template-columns: 1fr;
  }
}

.modal-inline-row > * {
  min-width: 0;
}

.plus-bubble {
  width: 34px;
  height: 34px;
  min-height: 34px;
  border-radius: 999px;
  padding: 0;
  font-size: 1.3rem;
  line-height: 1;
  font-weight: 700;
  border: 1px solid #2f8f57;
  background: linear-gradient(135deg, #3bb96b, #2da956);
  color: #fff;
  box-shadow: 0 6px 14px rgba(39, 131, 77, 0.24);
  justify-self: end;
}

.plus-bubble:hover {
  filter: brightness(1.05);
}

.books-panel-head {
  align-items: center;
  margin-bottom: 10px;
}

.mobile-home-hero {
  display: none;
}

.mobile-home-copy h1 {
  margin-bottom: 6px;
}

.mobile-home-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.mobile-home-stat {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(240,247,255,0.96));
}

.mobile-home-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.mobile-home-stat strong {
  display: block;
  font-size: 1.45rem;
  margin-top: 6px;
}

.mobile-home-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.mobile-quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 92px;
  padding: 12px 10px;
  text-decoration: none;
  text-align: center;
  color: var(--brand-dark);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
}

.mobile-quick-action svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mobile-quick-action span {
  font-weight: 800;
  font-size: 0.9rem;
  line-height: 1.15;
}

.mobile-quick-action-primary {
  color: #fff;
  border-color: rgba(21, 99, 184, 0.16);
  background: linear-gradient(180deg, #1a72cf, #155fad);
  box-shadow: 0 12px 26px rgba(21, 95, 173, 0.28);
}

.scan-wizard-hero {
  background: linear-gradient(180deg, rgba(247, 251, 255, 0.98), rgba(235, 244, 253, 0.98));
}

.scan-ios-hint {
  border-color: rgba(208, 168, 67, 0.34);
  background: linear-gradient(180deg, rgba(255, 250, 236, 0.98), rgba(255, 245, 217, 0.98));
}

.scan-ios-fallback {
  border-color: rgba(21, 99, 184, 0.22);
  background: linear-gradient(180deg, rgba(247, 250, 255, 0.98), rgba(255, 255, 255, 0.98));
}

.scan-ios-native-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.scan-ios-native-field {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(35, 72, 111, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
}

.scan-ios-native-field span {
  font-weight: 700;
  color: #23486f;
}

.scan-ios-native-field input[type="file"] {
  width: 100%;
  font: inherit;
}

.scan-simple-hero {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
}

.scan-simple-panel {
  max-width: 760px;
}

.scan-simple-form {
  display: grid;
  gap: 16px;
}

.scan-simple-field {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid rgba(35, 72, 111, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
}

.scan-simple-field span {
  font-weight: 800;
  color: #23486f;
}

.scan-simple-field small {
  color: #597490;
}

.scan-simple-field input[type="file"] {
  width: 100%;
  font: inherit;
}

.scan-wizard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.scan-wizard-card {
  margin-bottom: 0;
}

.scan-wizard-card-primary {
  border-color: rgba(21, 99, 184, 0.28);
  box-shadow: 0 16px 36px rgba(21, 95, 173, 0.12);
}

.scan-wizard-card-head {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

.scan-wizard-card-head h2 {
  margin: 0 0 6px;
}

.scan-wizard-card-head p {
  margin: 0;
  color: var(--muted);
}

.scan-wizard-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-dark);
  background: linear-gradient(180deg, rgba(21, 99, 184, 0.12), rgba(31, 143, 138, 0.08));
  border: 1px solid rgba(21, 99, 184, 0.15);
}

.scan-wizard-icon svg,
.scan-wizard-trigger svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scan-wizard-form {
  display: grid;
  gap: 12px;
}

.scan-wizard-choice-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.scan-wizard-trigger {
  min-height: 124px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 18px;
  border: 1px dashed rgba(21, 99, 184, 0.35);
  background: linear-gradient(180deg, rgba(21, 99, 184, 0.08), rgba(255, 255, 255, 0.92));
  color: var(--brand-dark);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.scan-wizard-trigger-secondary {
  min-height: 92px;
  border-style: solid;
  background: linear-gradient(180deg, rgba(241, 247, 255, 0.96), rgba(255, 255, 255, 0.98));
  color: #23486f;
}

@media (max-width: 680px) {
  .scan-wizard-choice-stack {
    grid-template-columns: 1fr;
  }

  .scan-ios-native-grid {
    grid-template-columns: 1fr;
  }

  .scan-simple-hero {
    display: grid;
  }
}

.scan-selection-panel {
  margin-bottom: 16px;
  transition: box-shadow 0.22s ease, border-color 0.22s ease, transform 0.22s ease;
}

.scan-selection-panel.is-highlighted {
  border-color: rgba(21, 99, 184, 0.36);
  box-shadow: 0 20px 44px rgba(21, 95, 173, 0.14);
  transform: translateY(-2px);
}

.scan-selection-actions {
  align-items: center;
  flex-wrap: wrap;
}

.scan-selection-feedback {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(21, 99, 184, 0.1);
  border: 1px solid rgba(21, 99, 184, 0.18);
  color: #1e5da8;
  font-weight: 700;
}

.scan-cover-check {
  margin-bottom: 16px;
}

.scan-pages-check {
  margin-bottom: 16px;
}

.scan-cover-check-state {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  font-weight: 800;
  color: var(--brand-dark);
}

.scan-cover-check-state.is-loading {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.scan-cover-check-state.is-loading::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(21, 99, 184, 0.18);
  border-top-color: #1e5da8;
  animation: scan-spin 0.8s linear infinite;
}

.scan-cover-check-state.is-ok {
  color: #1c6d36;
  border-color: rgba(43, 154, 73, 0.22);
  background: rgba(43, 154, 73, 0.08);
}

.scan-cover-check-state.is-warn {
  color: #835800;
  border-color: rgba(196, 132, 0, 0.22);
  background: rgba(196, 132, 0, 0.08);
}

.scan-cover-check-result {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.scan-cover-check-summary {
  font-weight: 800;
  font-size: 1.02rem;
}

.scan-cover-check-reasoning {
  color: var(--muted);
}

.scan-cover-check-mzp {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(248, 251, 255, 0.92);
  color: var(--brand-dark);
  font-weight: 700;
}

.scan-cover-check-mzp.is-ok {
  color: #1c6d36;
  border-color: rgba(43, 154, 73, 0.22);
  background: rgba(43, 154, 73, 0.08);
}

.scan-cover-check-mzp.is-warn {
  color: #835800;
  border-color: rgba(196, 132, 0, 0.22);
  background: rgba(196, 132, 0, 0.08);
}

.scan-cover-check-suggestions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.scan-pages-check-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.scan-cover-suggestion-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: rgba(248, 251, 255, 0.92);
}

.scan-cover-suggestion-card strong {
  display: block;
  margin-bottom: 8px;
}

.scan-cover-suggestion-values {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.scan-cover-suggestion-card small {
  display: block;
  margin-top: 8px;
  color: #1e5da8;
  font-weight: 700;
}

.scan-cover-suggestion-card button {
  margin-top: 10px;
}

.scan-pages-check-grid {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.scan-page-check-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(248, 251, 255, 0.92);
  display: grid;
  gap: 12px;
}

.scan-page-check-card h3 {
  margin: 0;
}

.scan-page-order-hint {
  margin: 4px 0 0;
  color: var(--muted);
}

.scan-page-kind {
  align-self: start;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(21, 99, 184, 0.08);
  border: 1px solid rgba(21, 99, 184, 0.16);
  color: var(--brand-dark);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.78rem;
}

.scan-selection-quality {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.scan-quality-good,
.scan-quality-warn {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.94rem;
}

.scan-quality-good {
  background: rgba(43, 154, 73, 0.08);
  border: 1px solid rgba(43, 154, 73, 0.18);
  color: #1c6d36;
}

.scan-quality-warn {
  background: rgba(196, 132, 0, 0.08);
  border: 1px solid rgba(196, 132, 0, 0.18);
  color: #835800;
}

.scan-selection-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.scan-selection-card {
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(248, 251, 255, 0.92);
}

.scan-selection-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.scan-selection-title-wrap {
  display: grid;
  gap: 8px;
}

.scan-selection-page-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(21, 99, 184, 0.12);
  border: 1px solid rgba(21, 99, 184, 0.18);
  color: var(--brand-dark);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.scan-selection-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.scan-selection-tools .icon-btn {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
}

#scan-selection-add-photo {
  border-color: rgba(21, 99, 184, 0.24);
  color: var(--brand-dark);
}

.scan-selection-card-head strong {
  font-size: 0.95rem;
  line-height: 1.25;
}

.scan-selection-meta,
.scan-selection-dimensions {
  display: block;
  color: var(--muted);
  margin-top: 6px;
}

.scan-selection-kind-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.scan-selection-kind-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(21, 99, 184, 0.08);
  border: 1px solid rgba(21, 99, 184, 0.16);
  color: var(--brand-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

.scan-selection-kind-badge.is-loading {
  gap: 8px;
}

.scan-selection-kind-pos {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.scan-inline-spinner {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(21, 99, 184, 0.18);
  border-top-color: #1e5da8;
  animation: scan-spin 0.8s linear infinite;
}

@keyframes scan-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.scan-selection-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 12px;
  margin-top: 10px;
  border: 1px solid var(--line);
  background: #eef3f9;
  transition: transform 0.18s ease;
}

.scan-selection-media-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.95fr) minmax(260px, 1.05fr);
  gap: 14px;
  align-items: start;
  margin-top: 10px;
}

.scan-selection-preview-wrap {
  position: relative;
  cursor: zoom-in;
}

.scan-selection-preview-wrap img {
  margin-top: 0;
}

.scan-selection-preview-controls {
  display: none;
}

.scan-selection-preview-wrap.is-expanded {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(13, 26, 44, 0.92);
  cursor: zoom-out;
  overflow: hidden;
  touch-action: none;
}

.scan-selection-preview-wrap.is-expanded img {
  width: auto;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  aspect-ratio: auto;
  object-fit: contain;
  border-radius: 16px;
  border-color: rgba(255, 255, 255, 0.2);
  background: transparent;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.scan-selection-preview-wrap.is-expanded.is-draggable {
  cursor: grab;
}

.scan-selection-preview-wrap.is-expanded.is-dragging {
  cursor: grabbing;
}

.scan-selection-preview-wrap.is-expanded .scan-selection-preview-controls {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  display: flex;
  gap: 8px;
}

.scan-selection-preview-controls button {
  min-width: 48px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  backdrop-filter: blur(12px);
}

.scan-entry-editor {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
}

.scan-entry-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.scan-entry-editor strong {
  display: block;
  color: var(--brand-dark);
}

.scan-entry-editor-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.scan-entry-editor-group {
  display: grid;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(21, 99, 184, 0.18);
}

.scan-entry-editor-group:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.scan-entry-editor-group-title {
  font-size: 0.95rem;
  color: var(--brand-dark);
}

.scan-entry-editor-field {
  display: grid;
  gap: 6px;
}

.scan-entry-editor-field span {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--brand-dark);
}

.scan-entry-editor-field input,
.scan-entry-editor-field textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
}

.scan-entry-editor-field textarea {
  min-height: 92px;
  resize: vertical;
}

.scan-entry-editor-source {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.scan-entry-editor-source-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(21, 99, 184, 0.08);
  border: 1px solid rgba(21, 99, 184, 0.16);
  color: var(--brand-dark);
  font-size: 0.8rem;
  font-weight: 700;
}

.scan-entry-editor-source-chip.is-ai {
  background: rgba(123, 97, 255, 0.08);
  border-color: rgba(123, 97, 255, 0.16);
  color: #5141a0;
}

.scan-entry-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 980px) {
  .scan-selection-media-row {
    grid-template-columns: 1fr;
  }
}

.scan-selection-crop-note {
  display: block;
  margin-top: 8px;
  color: #1e5da8;
  font-weight: 700;
}

.scan-crop-card {
  width: min(760px, calc(100vw - 32px));
}

.scan-crop-stage {
  position: relative;
  margin-top: 10px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #eef3f9;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  min-height: 280px;
}

.scan-crop-stage img {
  width: 100%;
  display: block;
  max-height: 72vh;
  object-fit: contain;
  background: #eef3f9;
  pointer-events: none;
}

.scan-crop-selection {
  position: absolute;
  border: 2px solid #155fad;
  background: rgba(21, 95, 173, 0.14);
  box-shadow: 0 0 0 9999px rgba(10, 25, 49, 0.22);
  border-radius: 10px;
}

.scan-crop-actions {
  justify-content: flex-end;
  margin-top: 14px;
  flex-wrap: wrap;
}

.scan-wizard-tips h2 {
  margin-bottom: 12px;
}

.scan-wizard-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.scan-wizard-steps > div {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: rgba(247, 251, 255, 0.82);
}

.scan-wizard-steps > div strong {
  display: block;
  margin-bottom: 6px;
}

.scan-wizard-steps > div p {
  margin: 0;
  color: var(--muted);
}

.analytics-head p {
  max-width: 880px;
}

.analytics-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.analytics-stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: var(--shadow-soft);
}

.analytics-stat-card strong {
  display: block;
  font-size: clamp(1.5rem, 2.8vw, 2rem);
  line-height: 1.1;
  margin-top: 6px;
}

.analytics-stat-card small {
  display: block;
  color: var(--muted);
  margin-top: 6px;
}

.analytics-stat-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.analytics-card {
  margin-bottom: 0;
}

.analytics-card-wide {
  grid-column: 1 / -1;
}

.analytics-table {
  width: 100%;
}

.analytics-table th,
.analytics-table td {
  white-space: normal;
}

.refrigerant-modal-card {
  width: min(560px, calc(100% - 24px));
}

.pdf-preview-card {
  width: min(1120px, calc(100% - 24px));
  max-height: min(90vh, 980px);
  min-height: min(82vh, 920px);
}

.pdf-preview-frame-wrap {
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, #f8fbff, #eef4fb);
}

.pdf-preview-frame {
  width: 100%;
  height: 100%;
  min-height: min(76vh, 980px);
  border: 0;
  background: #d7e1ec;
}

.pdf-preview-card .actions {
  flex: 0 0 auto;
  margin-top: 0;
}

.scan-progress-card {
  width: min(560px, calc(100% - 24px));
}

.scan-check-overlay-card {
  width: min(420px, calc(100% - 24px));
}

.scan-check-overlay-body {
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
  padding: 8px 4px;
}

.scan-check-overlay-body h3 {
  margin: 0;
}

.scan-check-overlay-spinner {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 4px solid rgba(21, 99, 184, 0.16);
  border-top-color: #1e5da8;
  animation: scan-spin 0.8s linear infinite;
}

.scan-progress-body {
  display: grid;
  gap: 14px;
}

.scan-progress-bar {
  height: 14px;
  border-radius: 999px;
  background: #e7eef6;
  overflow: hidden;
  border: 1px solid #d2deea;
}

.scan-progress-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.18), rgba(255,255,255,0.02)),
    linear-gradient(90deg, #1b78d7, #2ca9dd);
  background-size: 180px 100%, 100% 100%;
  animation: scan-progress-shimmer 1.1s linear infinite;
  box-shadow: 0 0 18px rgba(29, 123, 214, 0.28);
}

.scan-progress-steps {
  display: grid;
  gap: 8px;
}

.scan-progress-step {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #d7e4f1;
  background: #f8fbff;
  color: #60758a;
  font-weight: 600;
}

.scan-progress-step.is-active {
  border-color: #8cc0f0;
  background: #eef6ff;
  color: #24527d;
}

.scan-progress-step.is-done {
  border-color: #a8ddbc;
  background: #f2fbf4;
  color: #2f6a47;
}

@keyframes scan-progress-shimmer {
  0% {
    background-position: -180px 0, 0 0;
  }
  100% {
    background-position: 260px 0, 0 0;
  }
}

.refrigerant-open-trigger {
  cursor: pointer;
  background: #f7fbff;
}

.modal-editor-frame {
  width: 100%;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.app-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.app-modal-head h3 {
  margin: 0;
  color: #2d4763;
}

.picker-options {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: auto;
  max-height: min(58vh, 540px);
  display: grid;
  gap: 4px;
  padding: 4px;
  background: #fbfdff;
}

.picker-option {
  text-align: left;
  border: 1px solid transparent;
  background: #fff;
  color: #213c58;
  font-weight: 560;
  border-radius: 8px;
  padding: 9px 10px;
  box-shadow: none;
}

.picker-option:hover {
  border-color: #c2d6ea;
  background: #eef5ff;
}

.picker-choice-list {
  min-height: 160px;
}

.picker-choice-list-compact {
  min-height: 0;
  max-height: min(30vh, 300px);
}

.modal-compact-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(220px, 1.1fr);
  gap: 14px;
  align-items: end;
}

.evidence-modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.evidence-modal-actions .ghost,
.evidence-modal-actions button {
  min-height: 46px;
}

.picker-choice-button {
  display: grid;
  gap: 3px;
}

.picker-option.is-selected,
.picker-choice-button.is-selected {
  border-color: #79aee2;
  background: linear-gradient(180deg, #edf6ff, #dfeeff);
  box-shadow: inset 0 0 0 1px rgba(52, 119, 193, 0.15);
}

.picker-option-title {
  font-weight: 700;
  color: #1f4267;
}

.picker-option-sub {
  color: #516f8f;
  font-size: 0.94rem;
}

.picker-option-meta {
  color: #7690aa;
  font-size: 0.85rem;
}

.picker-empty {
  color: #6a7f95;
  padding: 9px 10px;
}

.page-card {
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 250, 255, 0.96));
  box-shadow: var(--shadow-soft);
}

.page-card h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  color: #204467;
}

.full {
  grid-column: 1 / -1;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 560;
  color: #23364d;
}

input,
select,
textarea,
button,
a.ghost {
  font: inherit;
  font-weight: 400;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

input,
select,
textarea {
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input,
select {
  min-height: 44px;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 36px;
  background-image:
    linear-gradient(45deg, transparent 50%, #466483 50%),
    linear-gradient(135deg, #466483 50%, transparent 50%);
  background-position:
    calc(100% - 20px) calc(50% - 2px),
    calc(100% - 14px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #78a8d8;
  box-shadow: 0 0 0 3px rgba(21, 99, 184, 0.14);
  outline: none;
}

textarea {
  resize: vertical;
}

.big-combo {
  min-height: 47px;
  padding: 11px 12px;
  font-size: 1.02rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.app-modal-card input,
.app-modal-card select,
.app-modal-card textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

button {
  background: linear-gradient(135deg, var(--brand), #2579d4);
  border-color: var(--brand-dark);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(15, 77, 148, 0.22);
  transition: transform 0.15s ease, filter 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

button.danger {
  background: linear-gradient(135deg, var(--danger), #d44763);
  border-color: #8f1a32;
  box-shadow: 0 6px 16px rgba(143, 26, 50, 0.24);
}

.actions:not(td) {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.actions:not(td) form {
  margin: 0;
}

.action-link,
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #1f3f63;
  text-decoration: none;
  font-weight: 620;
  box-shadow: none;
}

.action-btn {
  cursor: pointer;
}

.action-link:hover,
.action-btn:hover {
  transform: translateY(-1px);
  background: #f5f9fe;
}

.action-link svg,
.action-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.action-btn.danger {
  background: #fff4f6;
  color: #a6213d;
  border-color: #efb9c4;
}

.action-btn.danger:hover {
  background: #ffecef;
}

.row-hidden-link {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.icon-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

a {
  color: var(--brand);
}

a.ghost {
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--line-strong);
  color: #1f3f63;
}

button.ghost {
  background: #fff;
  color: #1f3f63;
  border: 1px solid var(--line-strong);
  box-shadow: none;
}

button.ghost:hover {
  transform: translateY(-1px);
  background: #f6f9fd;
}

.view-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fafdff, #f2f7fc);
}

.book-topbar {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

body.book-reader-mode .book-topbar {
  display: none !important;
}

.book-topbar-menu {
  position: relative;
  display: block;
}

.book-reader-actions {
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.book-reader-menu {
  position: relative;
}

.book-reader-inline-menu {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(10px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
}

.book-reader-inline-menu .ghost {
  margin: 0;
}

.book-topbar-dropdown.book-reader-inline-menu {
  position: absolute;
  right: calc(100% + 10px);
  top: 0;
  min-width: max-content;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 8px 10px;
}

.book-reader-menu.is-open .book-reader-inline-menu,
.book-reader-inline-menu.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
}

.book-topbar-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(19, 55, 94, 0.16);
  z-index: 40;
}

.mode-btn.icon-only {
  min-width: 46px;
  padding-inline: 12px;
}

.mode-btn {
  min-width: 158px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #2d4663;
  box-shadow: none;
}

.mode-btn .mode-ico {
  width: 18px;
  height: 18px;
  display: inline-flex;
}

.mode-btn .mode-ico svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mode-btn.active {
  background: linear-gradient(135deg, var(--brand), #2579d4);
  color: #fff;
  border-color: var(--brand-dark);
  box-shadow: 0 6px 16px rgba(15, 77, 148, 0.22);
}

table {
  width: 100%;
  min-width: 1280px;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  vertical-align: top;
}

th.col-revision,
td.col-revision {
  min-width: 180px;
}

th.col-completion,
td.col-completion {
  min-width: 150px;
}

th.col-actions,
td.col-actions {
  width: 132px;
  min-width: 132px;
  white-space: nowrap;
}

td.col-actions.actions {
  display: table-cell;
  vertical-align: middle;
  white-space: nowrap;
}

table td.actions > a,
table td.actions > .action-link,
table td.actions > .action-btn,
table td.actions > form {
  display: inline-flex;
  vertical-align: middle;
  margin-right: 6px;
}

table td.actions > form {
  margin: 0;
}

table td.actions > :last-child {
  margin-right: 0;
}

.table-action-strip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.table-action-strip form {
  margin: 0;
  display: inline-flex;
}

tr:last-child td {
  border-bottom: none;
}

th {
  background: linear-gradient(180deg, #edf5ff, #e3eefb);
  color: #284563;
  font-weight: 700;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 1;
}

th.sortable {
  cursor: pointer;
  user-select: none;
}

.th-sort {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sort-arrow {
  color: #7b8ea4;
  font-size: 0.86rem;
  line-height: 1;
}

th.sortable.asc .sort-arrow,
th.sortable.desc .sort-arrow {
  color: #1d4f84;
  font-weight: 800;
}

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

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover td {
  background: #f1f7ff;
}

.book-row-link-cell {
  cursor: pointer;
}

.revision-wrap {
  display: grid;
  gap: 4px;
}

.completion-wrap {
  display: grid;
  gap: 6px;
}

.completion-pill {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 28px;
  min-width: 112px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid #cfdae6;
  background: #f5f8fc;
  color: #355069;
  font-weight: 700;
  white-space: nowrap;
}

.completion-pill strong {
  font-size: 0.95rem;
}

.completion-pill span:last-child {
  color: #6a7d91;
  font-size: 0.78rem;
  font-weight: 600;
}

.completion-high {
  border-color: #bfe4cf;
  background: #edf9f2;
  color: #226546;
}

.completion-mid {
  border-color: #ffd18d;
  background: #fff5e7;
  color: #935d06;
}

.completion-low {
  border-color: #f1b3bf;
  background: #fff0f3;
  color: #a52440;
}

.completion-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #e5edf6;
  overflow: hidden;
}

.completion-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2c8ee5, #48c196);
}

.revision-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid #c7d5e5;
  background: #f6f9fd;
  color: #314d68;
  font-weight: 700;
  white-space: nowrap;
}

.revision-pill strong {
  letter-spacing: 0.04em;
}

.revision-date {
  color: #60758b;
  font-size: 0.78rem;
}

.revision-ok {
  border-color: #bfe4cf;
  background: #edf9f2;
  color: #226546;
}

.revision-warn-30 {
  border-color: #ffd18d;
  background: #fff5e7;
  color: #935d06;
}

.revision-danger-14,
.revision-critical-7,
.revision-critical-3,
.revision-due-today,
.revision-overdue {
  border-color: #f1b3bf;
  background: #fff0f3;
  color: #a52440;
}

.revision-none {
  border-color: #d4dfeb;
  background: #f4f7fb;
  color: #5f7388;
  font-weight: 600;
}

.revision-overdue.is-blink {
  animation: overdue-blink 1s steps(2, end) infinite;
}

@keyframes overdue-blink {
  0%,
  45% {
    background: #fff0f3;
    color: #a52440;
  }
  46%,
  100% {
    background: #ffdfe6;
    color: #7d132a;
  }
}

.flash-wrap {
  margin-bottom: 12px;
}

.flash {
  padding: 11px 12px;
  border-radius: 10px;
  margin-bottom: 7px;
  border-left: 5px solid transparent;
}

.flash.success {
  background: #e6f8ef;
  border: 1px solid #b6e5cc;
  border-left-color: #2f9965;
}

.flash.error {
  background: #ffe9ee;
  border: 1px solid #ffc3cf;
  border-left-color: #b11d3d;
}

.missing-detector {
  color: var(--danger);
  border-color: var(--danger);
  background: #fff3f5;
  font-weight: 700;
}

.footer {
  text-align: center;
  color: var(--muted);
  padding: 18px 16px 24px;
  font-size: 0.92rem;
}

.mobile-bottom-nav {
  display: none;
}

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

@media (max-width: 980px) {
  body {
    padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  }

  .topbar {
    position: sticky;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    flex-direction: column;
    overflow: visible;
  }

  .topbar-head {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .brand-wrap {
    min-width: 0;
    flex: 1 1 auto;
  }

  .mobile-nav-toggle {
    display: inline-flex;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: calc(100% - 4px);
    right: 10px;
    z-index: 40;
    width: min(340px, calc(100vw - 20px));
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    padding: 10px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: linear-gradient(160deg, rgba(17, 91, 163, 0.97), rgba(10, 58, 113, 0.96));
    box-shadow: 0 18px 40px rgba(5, 24, 44, 0.34);
    backdrop-filter: blur(8px);
    flex-direction: column;
    gap: 8px;
  }

  .topbar.nav-open .main-nav {
    display: flex;
  }

  .main-nav a {
    width: 100%;
    min-height: 44px;
    justify-content: flex-start;
    white-space: normal;
    border-color: rgba(255, 255, 255, 0.34);
    background: rgba(255, 255, 255, 0.08);
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 55;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.58);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
    box-shadow: 0 12px 34px rgba(16, 47, 79, 0.18);
  }

  .mobile-bottom-nav a {
    min-height: 56px;
    padding: 8px 6px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border-radius: 14px;
    color: var(--brand-dark);
    text-decoration: none;
    font-size: 0.76rem;
    font-weight: 700;
    text-align: center;
  }

  .mobile-bottom-nav a.active {
    background: rgba(21, 99, 184, 0.11);
    color: var(--brand-dark);
  }

  .mobile-bottom-nav .nav-ico {
    width: 22px;
    height: 22px;
  }

  .mobile-bottom-nav .nav-ico svg {
    width: 20px;
    height: 20px;
  }

  .mobile-bottom-nav-primary {
    background: linear-gradient(180deg, #1b73cf, #155fad);
    color: #fff !important;
    box-shadow: 0 8px 18px rgba(21, 95, 173, 0.28);
  }

  body.book-reader-mode .mobile-bottom-nav {
    display: none;
  }

  body.book-reader-mode {
    padding-bottom: 0;
  }
}

@media (max-width: 760px) {
  .mobile-home-hero {
    display: block;
  }

  .scan-wizard-grid,
  .scan-wizard-steps,
  .scan-selection-grid {
    grid-template-columns: 1fr;
  }

  .scan-crop-card {
    width: min(100vw - 16px, 680px);
  }

  .scan-crop-stage {
    min-height: 220px;
  }

  .scan-crop-stage img {
    max-height: 58vh;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .modal-compact-grid {
    grid-template-columns: 1fr;
  }

  #book-main-form,
  #book-main-form.form-grid,
  #book-main-form > *,
  #book-main-form label,
  #book-main-form .actions,
  #book-main-form .book-picker-row,
  #book-main-form .sheet-combined,
  #book-main-form input,
  #book-main-form select,
  #book-main-form textarea,
  #book-main-form button,
  #book-main-form a.action-link,
  #book-main-form a.ghost {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  #book-main-form {
    width: 100%;
    overflow-x: hidden;
  }

#book-main-form .actions {
  width: 100%;
}

.autosave-status {
  margin-left: auto;
  font-size: 0.94rem;
  color: #607289;
}

.autosave-status.is-saving {
  color: #1e5da8;
}

.autosave-status.is-saved {
  color: #2f8f51;
}

.autosave-status.is-error {
  color: #b03b4b;
}

.autosave-status.is-idle {
  color: #6f8199;
}

  .autosave-status {
    width: 100%;
    margin-left: 0;
  }

  .pages-grid {
    grid-template-columns: 1fr;
  }

  .container {
    margin: 12px auto;
    padding: 0 8px;
  }

  .panel {
    border-radius: 12px;
    padding: 12px;
  }

  .search-row {
    flex-direction: column;
  }

  .search-row button {
    width: 100%;
  }

  .view-switch {
    width: 100%;
    gap: 6px;
  }

  .book-topbar {
    align-items: stretch;
  }

  .mode-btn {
    flex: 1 1 0;
    justify-content: center;
    padding: 8px 10px;
  }

  table {
    width: 100%;
    min-width: 0;
    border: 0;
  }

  table thead {
    display: none;
  }

  table tbody,
  table tr,
  table td {
    display: block;
    width: 100%;
  }

  table tr {
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
  }

  table td {
    display: grid;
    grid-template-columns: minmax(112px, 42%) 1fr;
    align-items: start;
    gap: 8px;
    border: 0;
    border-bottom: 1px solid #e2ebf4;
    padding: 8px 10px;
    font-size: 0.88rem;
  }

  table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: #35516d;
  }

  table td.actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: nowrap;
    border-bottom: 0;
  }

  table td.col-revision,
  table td.col-completion,
  table td.col-actions {
    width: 100%;
    min-width: 0;
    white-space: normal;
  }

  table td.actions::before {
    display: none;
  }

  table td.actions form {
    display: inline-flex;
    width: auto;
    flex: 0 0 auto;
  }

  table td.actions > button,
  table td.actions > a,
  table td.actions > .action-link,
  table td.actions > .action-btn,
  table td.actions > form {
    width: auto;
    flex: 0 0 auto;
  }

  table td.actions .icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid #cad8e7;
    background: linear-gradient(180deg, #ffffff, #edf4fb);
    box-shadow: 0 2px 6px rgba(20, 59, 96, 0.12);
  }

  table td.actions .icon-btn svg {
    width: 17px;
    height: 17px;
  }

  table td.actions .icon-btn.danger {
    border-color: #efb9c4;
    background: linear-gradient(180deg, #fff6f8, #ffeef2);
  }

  .table-action-strip {
    display: inline-flex;
    width: auto;
    gap: 6px;
    flex-wrap: nowrap;
  }

  .revision-wrap {
    gap: 3px;
  }

  .revision-pill {
    min-height: 26px;
    padding: 2px 7px;
    font-size: 0.84rem;
  }

  .revision-date {
    font-size: 0.74rem;
  }

  .book-sheet {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 0;
    padding: 16px 14px 30px;
  }

  .book-a4-wrap {
    overflow-x: hidden;
    padding: 0;
  }

  .book-a4-stage {
    min-width: 0;
  }

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

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

  .cover-top-right {
    width: min(46%, 184px);
    align-self: flex-end;
  }

  .cover-title {
    margin-top: 42px;
    font-size: 1.7rem;
  }

  .cover-subtitle {
    font-size: 1.26rem;
    margin-bottom: 24px;
  }

  .cover-fields {
    width: min(78%, 520px);
    margin: 0 auto;
    gap: 10px;
  }

  .cover-row {
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
  }

  .cover-label {
    font-size: 0.92rem;
    line-height: 1.15;
  }

  .cover-row input,
  .cover-row textarea {
    min-height: 44px;
    font-size: 0.95rem;
  }

  .cover-row[data-year],
  .cover-row.year-of-manufacture {
    grid-template-columns: 118px minmax(0, 160px);
  }

  .sheet-manual h3,
  .sheet-data h3 {
    font-size: 1.4rem;
  }

  .sheet-grid {
    grid-template-columns: 1fr;
  }

  .sheet-label {
    border-right: none;
    border-bottom: none;
    padding-bottom: 2px;
    min-height: 0;
  }

  .sheet-grid > input,
  .sheet-grid > textarea,
  .sheet-grid > .sheet-combined {
    border-top: none;
    border-left: 1px solid #111;
    border-right: 1px solid #111;
    border-bottom: 1px solid #111;
  }

  .sheet-combined {
    grid-template-columns: 1fr;
  }

  .sheet-combined input + input {
    border-left: none;
    border-top: 1px solid #111;
  }

  .records-table {
    overflow: hidden;
  }

  .records-head,
  .records-row,
  .records-tail {
    grid-template-columns: 60px minmax(62px, 0.74fr) minmax(84px, 0.86fr) 58px 58px 58px;
  }

  .records-head > div,
  .records-row > div {
    padding: 4px 5px;
    font-size: 0.72rem;
    min-height: 34px;
  }

  .records-head > div {
    font-size: 0.68rem;
    line-height: 1.05;
  }

  .app-modal-card {
    width: calc(100% - 12px);
    max-height: 90vh;
    margin: 3vh auto 0;
    border-radius: 12px;
  }

  .ocr-review-progress {
    width: 100%;
    margin-left: 0;
    text-align: center;
  }

  .pdf-preview-card {
    max-height: 94vh;
    padding: 10px;
  }

  .pdf-preview-frame {
    height: 70vh;
  }

  .actions:not(td) {
    gap: 6px;
  }

  .actions:not(td) > button,
  .actions:not(td) > a,
  .actions:not(td) > .action-link,
  .actions:not(td) > .action-btn,
  .actions:not(td) > form {
    width: 100%;
  }

  .actions:not(td) > form > button {
    width: 100%;
  }

  table td.actions > button,
  table td.actions > a,
  table td.actions > .action-link,
  table td.actions > .action-btn,
  table td.actions > form,
  table td.actions > form > button {
    width: auto;
  }
}

@media (max-width: 520px) {
  body {
    padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  }

  .mobile-home-stats,
  .mobile-home-actions {
    grid-template-columns: 1fr;
  }

  .brand {
    font-size: 1.06rem;
  }

  .brand-sub {
    display: none;
  }

  .app-version-chip-wrap {
    margin-top: 4px;
  }

  .app-version-chip {
    font-size: 0.7rem;
    padding: 3px 8px;
  }

  .main-nav {
    width: calc(100vw - 16px);
    right: 8px;
    top: calc(100% - 2px);
    border-radius: 14px;
    padding: 8px;
  }

  .main-nav a {
    padding: 9px 10px;
    font-size: 0.9rem;
    min-height: 42px;
  }

  .mobile-bottom-nav {
    left: 8px;
    right: 8px;
    gap: 6px;
    padding: 7px;
    border-radius: 18px;
  }

  .mobile-bottom-nav a {
    min-height: 54px;
    padding: 7px 4px;
    font-size: 0.72rem;
  }

  input,
  select {
    min-height: 42px;
  }

  .book-page-nav {
    grid-template-columns: 36px 1fr 36px;
    gap: 6px;
  }

  .book-page-nav .icon-btn {
    width: 36px;
    height: 36px;
    padding: 6px;
  }

  .book-page-counter {
    min-height: 36px;
    font-size: 0.9rem;
  }

  .cover-top-right {
    width: min(58%, 248px);
    padding: 15px 15px 12px;
  }

  .cover-mini-label {
    font-size: 0.96rem;
    margin-bottom: 8px;
  }

  .cover-top-right input {
    min-height: 50px;
    font-size: 1.14rem;
  }

  .cover-title {
    margin-top: 78px;
    font-size: 3.05rem;
    line-height: 1.06;
  }

  .cover-subtitle {
    margin-top: 14px;
    margin-bottom: 46px;
    font-size: 1.68rem;
  }

  .cover-fields {
    width: min(97%, 520px);
    gap: 18px;
  }

  .cover-row {
    grid-template-columns: 138px minmax(0, 1fr);
    gap: 14px;
  }

  .cover-label {
    font-size: 1.2rem;
    line-height: 1.08;
  }

  .cover-row input,
  .cover-row textarea {
    min-height: 66px;
    font-size: 1.28rem;
    border-radius: 13px;
    padding-left: 18px;
    padding-right: 18px;
  }

  .cover-footnote {
    font-size: 1.06rem;
    line-height: 1.24;
  }

  body.book-reader-mode.book-reader-cover.book-reader-cover-focus .book-a4-wrap {
    overflow-y: auto;
    overflow-x: hidden;
  }

  body.book-reader-mode.book-reader-cover .sheet-cover {
    transition: transform 0.22s ease;
  }

  body.book-reader-mode.book-reader-cover.book-reader-cover-focus .sheet-cover {
    transform: none;
    transform-origin: top center;
  }

  body.book-reader-mode.book-reader-cover.book-reader-cover-focus .cover-fields,
  body.book-reader-mode.book-reader-cover.book-reader-cover-focus .cover-top-right {
    filter: saturate(1.04);
  }

  body.book-reader-mode.book-reader-cover.book-reader-cover-focus .is-focus-zoom {
    position: relative;
    z-index: 2;
    transform: scale(1.18);
    transform-origin: center;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
    box-shadow: 0 10px 26px rgba(15, 48, 80, 0.16);
    background: rgba(255, 255, 255, 0.96);
    border-radius: 14px;
  }

body.book-reader-mode.book-reader-cover.book-reader-cover-focus .is-focus-zoom input,
body.book-reader-mode.book-reader-cover.book-reader-cover-focus .is-focus-zoom textarea,
body.book-reader-mode.book-reader-cover.book-reader-cover-focus .is-focus-zoom select {
  font-size: 1.46rem;
  min-height: 72px;
  border-width: 3px;
  box-shadow: 0 0 0 3px rgba(44, 99, 164, 0.16);
}

body.book-reader-mode.book-reader-cover.book-reader-cover-focus .is-focus-zoom .cover-label {
  font-size: 1.26rem;
}

body.book-reader-mode.book-reader-field-focus .is-field-focus {
  position: relative;
  z-index: 3;
  transform: scale(1.14);
  transform-origin: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
  box-shadow: 0 12px 28px rgba(15, 48, 80, 0.16);
  background: rgba(255, 255, 255, 0.98);
  border-radius: 10px;
}

body.book-reader-mode.book-reader-field-focus .is-field-focus input,
body.book-reader-mode.book-reader-field-focus .is-field-focus textarea,
body.book-reader-mode.book-reader-field-focus .is-field-focus select {
  font-size: 1.08rem !important;
  box-shadow: 0 0 0 2px rgba(44, 99, 164, 0.12);
}
}

@media (max-width: 980px) {
  body.book-reader-mode.book-reader-cover .book-pages {
    inset: 0;
  }

  body.book-reader-mode.book-reader-cover .book-reader-shell {
    inset: 0;
    padding: var(--reader-top-reserve, 0px) 0 var(--reader-bottom-reserve, 0px);
    align-items: flex-start;
    justify-content: center;
  }

  body.book-reader-mode.book-reader-cover .book-a4-wrap {
    width: 100vw;
    height: calc(100dvh - var(--reader-top-reserve, 0px) - var(--reader-bottom-reserve, 0px));
    min-height: calc(100dvh - var(--reader-top-reserve, 0px) - var(--reader-bottom-reserve, 0px));
    padding-top: var(--mobile-cover-top-gap, 0px);
    box-sizing: border-box;
    justify-content: center;
    align-items: flex-start;
  }

  body.book-reader-mode.book-reader-cover .book-a4-stage {
    width: 794px !important;
    height: 1123px !important;
    min-width: 794px !important;
    min-height: 1123px !important;
    justify-content: center;
  }

  body.book-reader-mode.book-reader-cover .book-sheet[data-page="1"] {
    width: 794px !important;
    max-width: none !important;
    height: 1123px !important;
    min-height: 1123px !important;
    flex: 0 0 794px !important;
  }

  body.book-reader-mode.book-reader-cover .book-a4-stage {
    transform-origin: top center;
  }

  body.book-reader-mode.book-reader-cover .book-sheet {
    padding: 6px 4px 10px;
  }

  body.book-reader-mode.book-reader-cover .book-pages > .actions {
    top: calc(env(safe-area-inset-top, 0px) + 4px);
    right: 4px;
  }

  body.book-reader-mode.book-reader-cover #mode-book-back {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 0.9rem;
    border-radius: 12px;
  }

  body.book-reader-mode.book-reader-cover .book-page-nav {
    width: min(100vw - 2px, calc(var(--book-rendered-width, 794px) + 8px));
    bottom: calc(env(safe-area-inset-bottom, 0px) + var(--reader-viewport-bottom, 0px) + 2px);
  }

  body.book-reader-mode .book-reader-shell {
    inset: 0 0 0 0;
    padding: 0;
    align-items: flex-start;
  }

  body.book-reader-mode .book-page-nav {
    opacity: 0;
    width: min(100vw - 4px, calc(var(--book-rendered-width, 794px) + 12px));
    bottom: calc(env(safe-area-inset-bottom, 0px) + var(--reader-viewport-bottom, 0px) + 2px);
  }

  body.book-reader-mode .book-stage-arrow {
    display: inline-flex;
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    height: 74px;
  }

  body.book-reader-mode .book-a4-wrap {
    padding: 0;
    width: 100vw;
    height: calc(100% - var(--reader-top-reserve, 0px) - var(--reader-bottom-reserve, 0px));
    min-height: 0;
    align-items: flex-start !important;
    justify-content: center;
    overflow: visible;
  }

  body.book-reader-mode .book-a4-wrap.is-cover {
    justify-content: center;
  }

  body.book-reader-mode .book-a4-stage:not(.is-spread) {
    width: 794px !important;
    height: 1123px !important;
    min-width: 794px !important;
    min-height: 1123px !important;
    justify-content: center;
  }

  body.book-reader-mode .book-a4-stage:not(.is-spread) .book-sheet.is-active {
    width: 794px !important;
    max-width: none !important;
    height: 1123px !important;
    min-height: 1123px !important;
    flex: 0 0 794px !important;
  }

  body.book-reader-mode .book-sheet {
    padding: 8px 6px 14px;
    box-shadow: 0 10px 22px rgba(15, 48, 80, 0.1);
  }

  body.book-reader-mode .book-pages > .actions {
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    right: 8px;
  }

  body.book-reader-mode .book-stage-arrow-left {
    left: 4px;
  }

  body.book-reader-mode .book-stage-arrow-right {
    right: 4px;
  }

  body.book-reader-mode:not(.book-reader-cover) .book-sheet {
    padding: 20px 18px 34px;
  }

  body.book-reader-mode:not(.book-reader-cover) .book-a4-wrap {
    padding-top: var(--mobile-cover-top-gap, 0px) !important;
    box-sizing: border-box;
  }

  body.book-reader-mode.book-reader-cover.book-reader-cover-focus .is-focus-zoom {
    transform: scale(1.18) !important;
  }

  body.book-reader-mode.book-reader-field-focus .is-field-focus {
    position: relative;
    z-index: 6;
    transform: scale(1.14);
    transform-origin: center center;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
    box-shadow: 0 14px 28px rgba(20, 52, 98, 0.18);
    background: rgba(255, 255, 255, 0.98);
    border-radius: 10px;
  }

  body.book-reader-mode.book-reader-field-focus .is-field-focus input,
  body.book-reader-mode.book-reader-field-focus .is-field-focus textarea,
  body.book-reader-mode.book-reader-field-focus .is-field-focus select {
    font-size: 1.08rem !important;
  }

  body.book-reader-mode:not(.book-reader-cover) .sheet-manual h3,
  body.book-reader-mode:not(.book-reader-cover) .sheet-data h3 {
    font-size: 1.8rem;
    line-height: 1.08;
  }

  body.book-reader-mode:not(.book-reader-cover) .manual-note {
    font-size: 1rem;
    line-height: 1.3;
  }

  body.book-reader-mode:not(.book-reader-cover) .manual-block {
    margin: 14px 0;
  }

  body.book-reader-mode:not(.book-reader-cover) .manual-block strong {
    font-size: 1.18rem;
    margin-bottom: 4px;
  }

  body.book-reader-mode:not(.book-reader-cover) .manual-block p {
    font-size: 1rem;
    line-height: 1.5;
  }

  body.book-reader-mode:not(.book-reader-cover) .sheet-grid {
    grid-template-columns: 0.95fr 1.12fr;
  }

  body.book-reader-mode:not(.book-reader-cover) .sheet-label {
    min-height: 56px;
    padding: 10px 12px;
    font-size: 1.02rem;
    border-right: 1px solid #111;
    border-bottom: 1px solid #111;
  }

  body.book-reader-mode:not(.book-reader-cover) .sheet-grid > input,
  body.book-reader-mode:not(.book-reader-cover) .sheet-grid > textarea,
  body.book-reader-mode:not(.book-reader-cover) .sheet-grid > .sheet-combined {
    min-height: 56px;
    font-size: 1.02rem;
    border-top: none;
    border-left: none;
    border-right: none;
    border-bottom: 1px solid #111;
  }

  body.book-reader-mode:not(.book-reader-cover) .sheet-grid > input,
  body.book-reader-mode:not(.book-reader-cover) .sheet-grid > textarea {
    padding: 10px 12px;
  }

  body.book-reader-mode:not(.book-reader-cover) .sheet-combined {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.book-reader-mode:not(.book-reader-cover) .sheet-combined.amount-compact {
    grid-template-columns: 1fr 146px;
  }

  body.book-reader-mode:not(.book-reader-cover) .sheet-combined input + input,
  body.book-reader-mode:not(.book-reader-cover) .sheet-combined > * + * {
    border-top: none;
    border-left: 1px solid #111;
  }

  body.book-reader-mode:not(.book-reader-cover) .amount-field,
  body.book-reader-mode:not(.book-reader-cover) .sheet-combined input,
  body.book-reader-mode:not(.book-reader-cover) .sheet-combined select {
    min-height: 54px;
    font-size: 1.02rem;
  }

  body.book-reader-mode:not(.book-reader-cover) .sheet-notes,
  body.book-reader-mode:not(.book-reader-cover) .sheet-help-text {
    font-size: 0.96rem;
    line-height: 1.35;
  }

  body.book-reader-mode:not(.book-reader-cover) .records-page h3,
  body.book-reader-mode:not(.book-reader-cover) .sheet-important-page h3 {
    font-size: 1.62rem;
  }

  body.book-reader-mode:not(.book-reader-cover) .records-head,
  body.book-reader-mode:not(.book-reader-cover) .records-row,
  body.book-reader-mode:not(.book-reader-cover) .records-tail {
    grid-template-columns: 70px minmax(84px, 0.92fr) minmax(118px, 1.24fr) 62px 62px 62px;
  }

  body.book-reader-mode:not(.book-reader-cover) .records-head > div,
  body.book-reader-mode:not(.book-reader-cover) .records-row > div {
    padding: 5px 6px;
    font-size: 0.8rem;
    min-height: 42px;
  }

  body.book-reader-mode:not(.book-reader-cover) .records-head > div {
    font-size: 0.76rem;
    line-height: 1.08;
  }

body.book-reader-mode:not(.book-reader-cover) .sheet-notes-page {
  gap: 14px;
}
}

@media (max-width: 860px) {
  .analytics-summary-grid,
  .analytics-grid {
    grid-template-columns: 1fr;
  }
}

.topbar-user {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 10px;
}

.topbar-user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  color: #284261;
  font-size: 0.92rem;
}

.topbar-user-meta strong {
  font-size: 0.96rem;
}

.compact-btn {
  padding: 8px 14px;
  min-height: auto;
}

.auth-nav {
  justify-content: flex-end;
}

.auth-panel {
  max-width: 760px;
  margin: 28px auto;
}

.auth-form {
  gap: 14px 16px;
}

.auth-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 860px) {
  .topbar-user {
    margin-top: 12px;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .topbar-user-meta {
    align-items: flex-start;
  }

  .auth-panel {
    margin: 12px 0 24px;
  }
}

.workflow-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  border: 1px solid #cbd8ea;
  background: #eef4fb;
  color: #244366;
}

.workflow-draft {
  background: #eef4fb;
  color: #244366;
  border-color: #cbd8ea;
}

.workflow-pending_approval {
  background: #fff4da;
  color: #7a5700;
  border-color: #f1d48a;
}

.workflow-approved {
  background: #e7f7ea;
  color: #20603a;
  border-color: #9bd0a5;
}

.workflow-needs_changes {
  background: #ffe8e6;
  color: #8a2d21;
  border-color: #e7a198;
}

.is-readonly-preview {
  background: #f6f8fb !important;
  color: #284261 !important;
  cursor: default !important;
}

.book-workflow-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0 0;
}

.book-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.book-photo-card {
  border: 1px solid #d5e2f0;
  border-radius: 18px;
  background: #f8fbff;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.book-photo-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid #cfdced;
  background: #fff;
}

.book-photo-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.book-photo-meta span {
  color: #587493;
  font-size: 0.86rem;
}

.pending-books-table td {
  vertical-align: top;
}

.approval-preview-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 180px;
}

.approval-preview-item {
  width: 92px;
  text-decoration: none;
  color: #27486e;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.approval-preview-item img {
  width: 92px;
  height: 72px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid #cfdced;
  background: #fff;
  box-shadow: 0 10px 24px rgba(28, 64, 108, 0.08);
}

.approval-preview-item span,
.approval-preview-empty {
  font-size: 0.8rem;
  line-height: 1.25;
  color: #587493;
}

.approval-preview-empty {
  display: inline-flex;
  align-items: center;
  min-height: 72px;
  padding: 0 10px;
  border: 1px dashed #c7d7ea;
  border-radius: 12px;
  background: #f8fbff;
}

.approval-summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.approval-summary-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: #eef4fb;
  border: 1px solid #d2deec;
  color: #36587d;
  font-size: 0.84rem;
  font-weight: 700;
}

.approval-secondary-line {
  margin-top: 8px;
  color: #587493;
  font-size: 0.84rem;
}

.approval-note-inline {
  margin-top: 8px;
  padding: 8px 10px;
  border-left: 3px solid #d0a843;
  background: #fff8e8;
  border-radius: 10px;
  color: #6d5420;
  font-size: 0.84rem;
}

.approval-health-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.approval-health-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef4fb;
  border: 1px solid #cfdced;
  color: #34567d;
  font-size: 0.76rem;
  font-weight: 700;
}

.approval-health-badge.is-good {
  background: #e7f7ea;
  border-color: #9bd0a5;
  color: #20603a;
}

.approval-health-badge.is-warn {
  background: #fff3dc;
  border-color: #f0cf81;
  color: #7a5700;
}

.scan-checklist-panel {
  border: 1px solid #d6e1ef;
  background: linear-gradient(180deg, #fbfdff, #f1f7fd);
}

.scan-checklist-summary {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 700;
  color: #33577b;
  background: #eef4fb;
  border: 1px solid #d4dfec;
}

.scan-checklist-summary.is-pending {
  background: #fff5e3;
  border-color: #f0d18f;
  color: #805a06;
}

.scan-checklist-summary.is-ready {
  background: #e8f7ec;
  border-color: #9fd0ab;
  color: #1f633a;
}

.scan-checklist-list {
  display: grid;
  gap: 10px;
}

.scan-checklist-item {
  border: 1px solid #d7e1ed;
  border-radius: 14px;
  background: #fff;
  padding: 12px 14px;
}

.scan-checklist-item.status-missing {
  border-color: #efc483;
  background: #fffaf1;
}

.scan-checklist-item.status-review {
  border-color: #d6dded;
  background: #f7faff;
}

.scan-checklist-item.status-confirmed {
  border-color: #a8d0b2;
  background: #f4fbf6;
}

.scan-checklist-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.scan-checklist-value {
  margin-top: 4px;
  color: #34567d;
  font-size: 0.95rem;
}

.scan-checklist-empty {
  color: #8a5a00;
  font-style: italic;
}

.scan-checklist-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eef4fb;
  border: 1px solid #d2dceb;
  color: #365a80;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.scan-checklist-note {
  margin-top: 8px;
  color: #486786;
  font-size: 0.88rem;
}

.scan-checklist-source {
  margin-top: 8px;
  color: #6a7f98;
  font-size: 0.8rem;
}

.scan-checklist-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.book-photo-gps {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f3f8fd;
  border: 1px solid #d5e2ef;
  color: #34567d;
  font-size: 0.84rem;
}

.book-photo-gps a {
  margin-left: 8px;
  font-weight: 700;
}

.qr-device-hero {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 360px);
  gap: 24px;
  align-items: start;
}

.qr-device-kicker {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e9f3ff;
  color: #1c5ea8;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.qr-device-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.qr-device-meta > div {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #d8e4ef;
  background: #f9fcff;
  color: #284768;
}

.qr-device-code-card,
.qr-device-admin-card {
  border: 1px solid #d8e4ef;
  border-radius: 18px;
  background: linear-gradient(180deg, #fdfefe 0%, #f3f8fd 100%);
  padding: 18px;
}

.qr-device-code-image,
.qr-device-admin-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #d8e4ef;
  min-height: 220px;
}

.qr-device-code-image svg,
.qr-device-admin-preview svg {
  width: 100%;
  max-width: 220px;
  height: auto;
}

.qr-device-code-actions,
.qr-device-admin-card .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.qr-public-entry-list,
.qr-doc-list {
  display: grid;
  gap: 14px;
}

.qr-public-entry-card {
  border: 1px solid #d8e4ef;
  border-radius: 16px;
  padding: 16px;
  background: #fbfdff;
}

.qr-public-entry-head,
.qr-public-entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  margin-bottom: 10px;
}

.qr-public-entry-head span,
.qr-public-entry-meta span {
  color: #567391;
}

.qr-doc-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid #d8e4ef;
  border-radius: 16px;
  background: #fbfdff;
  color: inherit;
  text-decoration: none;
}

.qr-doc-item:hover {
  border-color: #8bb5e5;
  background: #f4f9ff;
}

@media (min-width: 901px) {
  .scan-mobile-only {
    display: none;
  }
}

@media (max-width: 900px) {
  .qr-device-hero {
    grid-template-columns: 1fr;
  }

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

  .scan-checklist-head {
    flex-direction: column;
  }

  .pending-books-table thead {
    display: none;
  }

  .pending-books-table,
  .pending-books-table tbody,
  .pending-books-table tr,
  .pending-books-table td {
    display: block;
    width: 100%;
  }

  .pending-books-table tr {
    border: 1px solid #d5e2f0;
    border-radius: 18px;
    background: #fbfdff;
    padding: 14px;
    margin-bottom: 14px;
  }

  .pending-books-table td {
    border: 0;
    padding: 6px 0;
  }

  .pending-books-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: #587493;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .pending-books-table td.actions::before {
    content: "Akce";
  }
}

.transfer-debug-panel {
  margin-top: 12px;
  border-style: dashed;
}

.transfer-debug-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 14px;
}

.transfer-debug-grid > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid #d7e3f3;
  border-radius: 10px;
  background: #f8fbff;
}

.transfer-debug-grid strong {
  color: #20466f;
  font-size: 12px;
}

.transfer-debug-grid span {
  color: #17324f;
  font-size: 14px;
  min-height: 20px;
}
