:root {
  --bg: #f1f7f4;
  --surface: #ffffff;
  --surface-soft: #f4f8f5;
  --ink: #1e2a24;
  --ink-soft: #4d6055;
  --line: #cfe0d6;
  --line-strong: #9dc3b2;
  --primary: #0b7a58;
  --primary-strong: #075640;
  --danger: #b4542a;
  --danger-soft: #fff4ef;
  --content-max: 1760px;
  --split-gap: 28px;
  --radius: 16px;
  --shadow: 0 12px 26px rgba(18, 56, 40, 0.11);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: auto;
  font-family: "Chivo", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 8% 6%, #e8faf1 0%, transparent 42%),
    radial-gradient(circle at 94% 88%, #eaf3ff 0%, transparent 34%), var(--bg);
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.2) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.32;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: 100vw;
  min-height: calc(100vh - 2px);
  height: calc(100vh - 2px);
  margin: 0;
  padding: 1px 4px;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  gap: 6px;
  overflow-x: hidden;
  overflow-y: auto;
}

.topbar,
.control-deck,
.summary,
.status {
  width: min(1980px, 100%);
  margin: 0 auto;
}

.topbar,
.control-deck,
.summary,
.status,
.panel {
  background: color-mix(in srgb, var(--surface) 95%, #effaf4 5%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.topbar {
  width: min(var(--content-max), 100%);
  padding: 11px 14px;
}

.topbar h1 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.25rem, 1.75vw, 1.75rem);
  text-align: center;
}

.control-deck {
  width: min(var(--content-max), 100%);
  margin: 0 auto;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-areas: "uploads uploads safety action";
  gap: 12px;
}

.upload-grid {
  grid-area: uploads;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.upload-dropzone {
  position: relative;
  border: 2px dashed var(--line-strong);
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fdf9, #eff7f2);
  min-height: 102px;
  padding: 10px;
  display: grid;
  align-content: start;
  gap: 5px;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease,
    background 150ms ease;
}

.upload-dropzone:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(20, 73, 52, 0.11);
}

.upload-dropzone.drag-active {
  border-color: var(--primary);
  background: linear-gradient(180deg, #f3fef8, #e6f9ef);
  box-shadow: 0 0 0 3px rgba(11, 122, 88, 0.16), 0 12px 22px rgba(11, 122, 88, 0.18);
  transform: translateY(-2px) scale(1.01);
}

.upload-dropzone.has-file {
  border-style: solid;
}

.upload-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-kicker {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #366652;
  font-family: "Space Grotesk", sans-serif;
}

.upload-main {
  font-size: 0.94rem;
  font-weight: 600;
}

.upload-cta {
  justify-self: start;
  border: 1px solid #9bc8b6;
  background: #eef9f4;
  color: #165c46;
  border-radius: 8px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
}

.upload-cta-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #dff3ea;
  border: 1px solid #9bc8b6;
  font-size: 0.86rem;
  line-height: 1;
  flex: 0 0 auto;
}

.upload-file {
  margin-top: auto;
  border: 1px solid #c9ddd2;
  border-radius: 8px;
  background: #fff;
  padding: 7px 8px;
  color: #3b5b4d;
  font-size: 0.83rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-grid {
  grid-area: action;
  display: grid;
  gap: 8px;
  align-content: stretch;
  grid-auto-rows: 1fr;
}

.safety-zone {
  grid-area: safety;
  border: 1px solid #e4ccc2;
  background: linear-gradient(180deg, #fff9f6, #fff3ee);
  border-radius: 14px;
  padding: 10px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
  gap: 8px;
}

.safety-zone p {
  margin: 0;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: "Space Grotesk", sans-serif;
  color: #8e4f31;
}

.safety-zone button {
  align-self: center;
  width: 100%;
}

.action-grid button {
  width: 100%;
}

button {
  border: 1px solid transparent;
  border-radius: 10px;
  min-height: 48px;
  padding: 10px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, background-color 120ms ease, box-shadow 120ms ease,
    border-color 120ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

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

.button-icon {
  font-size: 1rem;
  line-height: 1;
}

button.action {
  border-color: #97c6b3;
  background: #ecf9f3;
  color: #13604a;
}

button.primary {
  background: var(--primary);
  color: #fff;
}

button.primary:hover:not(:disabled) {
  background: var(--primary-strong);
}

button.ghost {
  border-color: #e0bfae;
  background: #fff5f0;
  color: #8d4a2a;
}

.summary {
  padding: 4px 6px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.summary > div {
  border: 1px solid #d7e5dc;
  border-radius: 10px;
  background: #f9fdfa;
  padding: 5px 6px;
  font-size: 0.76rem;
}

.status {
  min-height: 28px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  color: #375649;
  font-size: 0.76rem;
}

.status.warn {
  color: var(--danger);
  border-color: #ebc2b0;
  background: #fff9f6;
}

.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;
}

.info-strip {
  display: grid;
  grid-template-columns: minmax(240px, max-content) minmax(0, 1fr);
  gap: 8px;
}

.info-pill {
  min-height: 28px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 94%, #effaf4 6%);
  box-shadow: var(--shadow);
  color: #375649;
  font-size: 0.76rem;
}

.workspace {
  min-height: 0;
  height: clamp(1040px, 96vh, 1280px);
  display: block;
  overflow: hidden;
}

.panel {
  min-height: 0;
  overflow: hidden;
  padding: 6px;
}

.panel-doc {
  width: min(var(--content-max), 100%);
  margin: 0 auto;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.compare-layout {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(420px, 0.92fr) minmax(0, 1.08fr);
  gap: var(--split-gap);
}

.proof-column,
.doc-column {
  min-height: 0;
  display: grid;
  gap: 10px;
  grid-template-rows: auto auto minmax(0, 1fr);
  scroll-margin-top: 8px;
  padding: 12px;
  border: 1px solid #cfe0d6;
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 96%, #eef8f2 4%);
  box-shadow: var(--shadow);
}

.panel-subtitle {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: #577063;
}

.panel-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  padding: 2px 4px 0;
}

.panel-title-row h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.08rem, 1.1vw, 1.4rem);
  letter-spacing: -0.02em;
}

.doc-title-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.doc-title-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: nowrap;
  min-width: max-content;
}

.panel-head {
  display: block;
  padding: 16px 18px;
  border: 1px solid #d8e5de;
  border-radius: 18px;
  background:
    radial-gradient(circle at top left, rgba(235, 250, 242, 0.9), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 250, 246, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 10px 22px rgba(22, 58, 42, 0.06);
}

.doc-zoom-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  justify-content: flex-end;
}

.proof-head {
  margin-bottom: 0;
}

.proof-search {
  width: 100%;
}

.doc-head {
  margin-bottom: 0;
}

.toolbar-search-block,
.doc-search {
  min-width: 0;
  display: grid;
  gap: 8px;
  align-content: start;
}

.doc-search {
  width: 100%;
}

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

.toolbar-inline-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
}

.toolbar-inline-actions .mini-btn {
  min-width: 96px;
  min-height: 44px;
  border-radius: 12px;
}

.proof-toolbar-actions {
  justify-content: flex-end;
}

.doc-page-controls {
  justify-content: flex-end;
}

.doc-rotate-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.doc-rotate-controls .mini-btn {
  min-width: 46px;
  min-height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
}

.rotate-icon {
  display: inline-block;
  font-size: 1.34rem;
  line-height: 1;
  font-weight: 500;
  opacity: 0.86;
}

.rotate-icon-left {
  transform: rotate(-90deg);
}

.rotate-icon-right {
  transform: rotate(90deg);
}

.toolbar-search-label {
  display: grid;
  font-size: 0.71rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #3a6252;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
}

.toolbar-search-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #bfd9cc;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  padding: 0 14px;
  color: #24372f;
  font: inherit;
  font-size: 0.95rem;
  letter-spacing: normal;
  text-transform: none;
}

.toolbar-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(11, 122, 88, 0.14);
}

.search-summary {
  font-size: 0.78rem;
  color: #4f675c;
  min-height: 1em;
}

.zoom-label {
  min-width: 58px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #2a4d3f;
  border: 1px solid #c8ddd3;
  border-radius: 7px;
  background: #f8fcfa;
  padding: 4px 6px;
  font-family: "Space Grotesk", sans-serif;
}

.zoom-btn {
  min-height: 36px;
  min-width: 42px;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid #9fcab8;
  background: #eef9f4;
  color: #1a5b46;
  font-size: 0.8rem;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
}

.library-wrap {
  border: 1px solid #cedfd6;
  border-radius: 12px;
  padding: 8px;
  background: linear-gradient(180deg, #fbfffc, #f0f8f3);
  height: 100%;
  display: grid;
  gap: 8px;
  grid-template-rows: auto minmax(0, 1fr);
  box-shadow: 0 7px 15px rgba(22, 58, 42, 0.1);
}

.extracted-panel {
  min-height: 0;
}

.barcode-library {
  max-height: none;
  min-height: 0;
  height: 100%;
  overflow: auto;
  padding-right: 4px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(560px, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 10px;
}

.barcode-library.empty::before {
  content: "Sem códigos extraídos.";
  border: 1px dashed #b8d4c7;
  border-radius: 9px;
  background: #fbfffd;
  color: #5a7266;
  text-align: center;
  padding: 14px;
  display: block;
}

.barcode-library.loading {
  display: block;
}

.barcode-loading {
  border: 1px dashed #9dc9b7;
  border-radius: 10px;
  background: linear-gradient(180deg, #f7fffa, #edf9f2);
  color: #2a5c49;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 78px;
  font-weight: 700;
  font-size: 0.9rem;
}

.loader-dot {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 3px solid rgba(11, 122, 88, 0.22);
  border-top-color: #0b7a58;
  animation: spinLoader 0.8s linear infinite;
}

@keyframes spinLoader {
  to {
    transform: rotate(360deg);
  }
}

.barcode-item {
  border: 1px solid #bbd8ca;
  border-radius: 10px;
  background: #fff;
  padding: 14px;
  position: relative;
  display: grid;
  grid-template-columns: 184px minmax(0, 1fr);
  gap: 14px 16px;
  align-items: stretch;
  cursor: grab;
}

.barcode-item.selected {
  border-color: #0a8b66;
  background: linear-gradient(180deg, #f1fff8, #e6f9ef);
  box-shadow: 0 0 0 3px rgba(10, 139, 102, 0.28), 0 10px 18px rgba(10, 74, 54, 0.2);
}

.barcode-item.selected::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
  background: linear-gradient(180deg, #0aa072, #087a58);
}

.barcode-item img {
  width: 184px;
  height: 118px;
  border: 1px solid #d5e5dd;
  border-radius: 6px;
  object-fit: contain;
  background: #fff;
  align-self: start;
}

.barcode-body {
  min-width: 0;
  display: grid;
  gap: 10px;
  align-content: start;
}

.barcode-identifiers,
.barcode-content-grid {
  display: grid;
  gap: 10px;
}

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

.barcode-content-grid {
  grid-template-columns: 1fr;
}

.barcode-field {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #dfeae4;
  border-radius: 10px;
  background: linear-gradient(180deg, #fbfefc, #f5faf7);
}

.barcode-field.wide {
  grid-column: 1 / -1;
}

.barcode-field-label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #5c7468;
  font-family: "Space Grotesk", sans-serif;
}

.barcode-field-value {
  display: block;
  color: #213a30;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: normal;
  overflow: visible;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.barcode-field-value.muted {
  font-size: 0.84rem;
  font-weight: 600;
  color: #324b40;
}

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

.barcode-stat {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #eef7f2;
  border: 1px solid #d6e7de;
}

.barcode-stat-value {
  display: block;
  margin-top: 4px;
  color: #244337;
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.28;
  white-space: normal;
  overflow-wrap: anywhere;
}

.mini-btn {
  border: 1px solid #b7d5c8;
  background: #f4fbf7;
  color: #1d5543;
  min-height: 30px;
  font-size: 0.72rem;
  padding: 4px 8px;
  border-radius: 6px;
}

.mini-btn.warn {
  border-color: #e2bfac;
  background: #fff6f1;
  color: #91491f;
}

.pages {
  min-height: 0;
  height: 100%;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid #ccddd4;
  background: linear-gradient(180deg, #f9fdfb, #edf7f1);
  padding: 4px;
}

.doc-pages {
  min-height: 0;
}

.page-card {
  border: 1px solid #cbddd2;
  border-radius: 12px;
  background: #fff;
  margin-bottom: 6px;
  overflow: hidden;
  animation: liftIn 240ms ease both;
}

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

.page-head {
  padding: 5px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, #f4faf7, #edf6f2);
  border-bottom: 1px solid #d9e7df;
  font-size: 0.78rem;
  color: #355447;
}

.page-head-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-stage {
  position: relative;
  margin: 3px auto;
  background: #ffffff;
  border: 1px solid #dfeae4;
}

.doc-pages .page-stage-shell {
  position: relative;
  margin: 3px auto;
}

.doc-pages .page-stage {
  position: absolute;
  inset: 0 auto auto 0;
  margin: 0;
  transform-origin: top left;
}

.page-stage.active-crop {
  outline: 2px solid rgba(8, 112, 83, 0.42);
  outline-offset: 3px;
}

.page-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.proof-pages .page-card.search-hit {
  border-color: #a9ccb9;
  box-shadow: 0 10px 18px rgba(34, 85, 63, 0.12);
}

.proof-pages .page-card.search-current {
  border-color: #0a8b66;
  box-shadow: 0 0 0 3px rgba(10, 139, 102, 0.18), 0 10px 18px rgba(10, 74, 54, 0.18);
}

.doc-pages .page-card.search-hit {
  border-color: #d9c99f;
  box-shadow: 0 10px 18px rgba(126, 97, 34, 0.1);
}

.doc-pages .page-card.search-current {
  border-color: #d88b2b;
  box-shadow: 0 0 0 3px rgba(216, 139, 43, 0.18), 0 10px 18px rgba(125, 79, 24, 0.15);
}

.page-hit-label {
  max-width: 250px;
  border-radius: 999px;
  background: #f8ece0;
  color: #86522c;
  padding: 2px 8px;
  font-size: 0.72rem;
  border: 1px solid #e4c7ae;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-overlay,
.placements-layer,
.proof-search-layer,
.proof-selection-layer {
  position: absolute;
  inset: 0;
}

.page-overlay.drop-ready {
  background: rgba(10, 125, 92, 0.14);
}

.selection-box {
  position: absolute;
  border: 2px dashed #0d7a5b;
  background: rgba(12, 163, 118, 0.16);
  pointer-events: none;
}

.proof-search-layer {
  pointer-events: none;
}

.proof-search-highlight {
  position: absolute;
  border-radius: 8px;
  background: rgba(255, 211, 97, 0.34);
  box-shadow: inset 0 0 0 1px rgba(189, 131, 10, 0.55);
  pointer-events: none;
  z-index: 1;
}

.proof-search-highlight.current {
  background: rgba(255, 176, 66, 0.42);
  box-shadow: inset 0 0 0 2px rgba(191, 102, 11, 0.72);
}

.doc-search-highlight {
  position: absolute;
  border-radius: 6px;
  background: rgba(255, 213, 92, 0.24);
  box-shadow: inset 0 0 0 1px rgba(165, 117, 18, 0.42);
  pointer-events: none;
  z-index: 2;
}

.doc-search-highlight.current {
  background: rgba(255, 170, 54, 0.34);
  box-shadow: inset 0 0 0 2px rgba(185, 100, 17, 0.62);
}

.proof-hotspot {
  position: absolute;
  border: 2px solid rgba(8, 112, 83, 0.52);
  border-radius: 10px;
  background: rgba(9, 128, 95, 0.08);
  box-shadow: 0 8px 16px rgba(13, 62, 46, 0.14);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease,
    background 120ms ease;
  z-index: 3;
}

.proof-hotspot:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(13, 62, 46, 0.18);
}

.proof-hotspot.selected {
  border-color: #2f76ff;
  background: rgba(47, 118, 255, 0.16);
  box-shadow: 0 0 0 3px rgba(47, 118, 255, 0.22), 0 12px 22px rgba(23, 66, 163, 0.24);
}

.proof-hotspot-label {
  position: absolute;
  left: 8px;
  top: 8px;
  max-width: calc(100% - 16px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(156, 199, 181, 0.92);
  padding: 2px 7px;
  font-size: 0.7rem;
  color: #194f3d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.placement {
  position: absolute;
  border: 1px solid rgba(4, 55, 41, 0.45);
  border-radius: 7px;
  box-shadow: 0 8px 16px rgba(9, 46, 34, 0.24);
  overflow: visible;
  cursor: move;
  touch-action: none;
  background: #fff;
  transform-origin: center center;
  display: grid;
  align-items: stretch;
  gap: 2px;
  padding: 5px 6px 6px;
}

.placement img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  pointer-events: none;
  border-radius: 6px;
}

.placement-alvarao {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #fff;
  border-radius: 4px 4px 2px 2px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  color: #214337;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.remove-placement {
  position: absolute;
  top: -38px;
  left: 50%;
  transform: translateX(-50%);
  border: 2px solid #fff;
  width: 30px;
  height: 30px;
  min-height: 0;
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  background: #d93636;
  color: #fff;
  padding: 0;
  line-height: 0;
  font-size: 1.2rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 12px rgba(124, 16, 16, 0.42);
  z-index: 7;
}

button.remove-placement:hover {
  background: #b71f1f;
  transform: translateX(-50%);
}

.resize-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.52);
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.22);
}

.resize-handle-nw {
  top: -7px;
  left: -7px;
  cursor: nwse-resize;
}

.resize-handle-ne {
  top: -7px;
  right: -7px;
  cursor: nesw-resize;
}

.resize-handle-sw {
  bottom: -7px;
  left: -7px;
  cursor: nesw-resize;
}

.resize-handle-se {
  right: -7px;
  bottom: -7px;
  cursor: nwse-resize;
}

.empty-state {
  border: 1px dashed #b8d1c4;
  color: #5d7469;
  border-radius: 10px;
  padding: 15px;
  text-align: center;
  margin: 4px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(8, 28, 19, 0.45);
  backdrop-filter: blur(2px);
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(430px, calc(100vw - 30px));
  border-radius: 14px;
  border: 1px solid #d8cbc4;
  background: #fff;
  box-shadow: 0 22px 44px rgba(18, 32, 24, 0.28);
  padding: 16px;
  display: grid;
  gap: 11px;
}

.modal-card h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

.modal-card p {
  margin: 0;
  color: #53655b;
  font-size: 0.9rem;
}

.modal-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.9rem;
}

.modal-check input {
  margin-top: 2px;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (max-width: 1280px) {
  .info-strip {
    grid-template-columns: 1fr;
  }

  .safety-zone p {
    margin-right: 0;
  }
}

@media (max-width: 1500px) {
  .control-deck {
    grid-template-columns: minmax(420px, 0.92fr) minmax(0, 1.08fr);
    grid-template-areas:
      "uploads uploads"
      "safety action";
    gap: var(--split-gap);
  }

  .upload-grid {
    grid-template-columns: minmax(420px, 0.92fr) minmax(0, 1.08fr);
    gap: var(--split-gap);
  }
}

@media (max-width: 1560px) {
  .toolbar-search-row {
    gap: 12px;
  }
}

@media (max-width: 1320px) {
  .doc-title-actions {
    gap: 8px;
  }

  .toolbar-search-row {
    gap: 10px;
  }

  .toolbar-inline-actions .mini-btn {
    min-width: 88px;
    min-height: 42px;
  }
}

@media (max-width: 1220px) {
  html,
  body {
    height: auto;
    overflow: auto;
  }

  .app-shell {
    width: min(1980px, calc(100vw - 14px));
    height: auto;
    overflow: visible;
    margin: 7px auto 16px;
    padding: 0;
  }

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

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

  .workspace {
    height: clamp(980px, 94vh, 1200px);
    overflow: hidden;
  }

  .panel-doc {
    height: 100%;
  }

  .compare-layout {
    grid-template-columns: minmax(360px, 0.95fr) minmax(0, 1.05fr);
  }

  .control-deck {
    grid-template-columns: minmax(360px, 0.95fr) minmax(0, 1.05fr);
  }

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

@media (max-width: 980px) {
  .control-deck {
    grid-template-columns: 1fr;
    grid-template-areas:
      "uploads"
      "safety"
      "action";
  }

  .workspace {
    height: auto;
    min-height: 980px;
    overflow: visible;
  }

  .panel-doc {
    height: auto;
    grid-template-rows: minmax(0, auto);
  }

  .compare-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(340px, 520px) minmax(540px, auto);
  }

  .proof-column {
    padding: 12px;
  }

  .doc-column {
    padding: 12px;
    margin-top: 0;
  }

  .panel-title-row {
    gap: 12px;
  }

  .doc-title-actions {
    justify-content: flex-end;
    gap: 6px;
  }

  .toolbar-search-row {
    gap: 8px;
  }

  .toolbar-inline-actions .mini-btn {
    min-width: 82px;
    min-height: 40px;
  }

  .barcode-library {
    grid-template-columns: 1fr;
  }

  .barcode-item,
  .barcode-identifiers,
  .barcode-content-grid,
  .barcode-stats {
    grid-template-columns: 1fr;
  }

  .barcode-item img {
    width: 100%;
    max-width: 280px;
    height: auto;
  }
}

@media (max-width: 760px) {
  .panel-head {
    padding: 12px;
  }

  .panel-title-row {
    padding-inline: 2px;
  }

  .toolbar-inline-actions .mini-btn {
    min-width: 74px;
    min-height: 36px;
    padding: 4px 8px;
    font-size: 0.68rem;
  }

  .doc-title-actions {
    gap: 4px;
  }

  .doc-zoom-controls,
  .doc-rotate-controls {
    justify-content: flex-end;
  }
}

@media (max-width: 560px) {
  .panel-title-row {
    gap: 8px;
  }

  .panel-title-row h2 {
    font-size: 1rem;
  }

  .zoom-btn {
    min-width: 32px;
    min-height: 32px;
    padding: 2px 4px;
  }

  .zoom-label {
    min-width: 44px;
    min-height: 32px;
    font-size: 0.72rem;
  }

  .doc-rotate-controls .mini-btn {
    min-width: 32px;
    min-height: 32px;
  }

  .toolbar-inline-actions .mini-btn {
    min-width: 68px;
    min-height: 34px;
    font-size: 0.66rem;
  }
}
