:root {
  --bg: #f4f6f8;
  --card: #fff;
  --ink: #1a1a1a;
  --muted: #667;
  --line: #e3e7eb;
  --brand: #0f2744;
  --ok: #0a7a32;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 28px 32px 8px;
}
h1 { margin: 0 0 4px; font-size: 22px; }
h2 { margin: 0 0 12px; font-size: 16px; }
.muted { color: var(--muted); font-size: 13px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  margin: 16px 32px;
}
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.grid .card { margin-right: 8px; }
.grid .card:last-child { margin-left: 8px; margin-right: 32px; }
.badge {
  padding: 8px 12px;
  border-radius: 999px;
  background: #e8e8e8;
  font-size: 13px;
}
.badge.ok { background: #d9f5e3; color: var(--ok); }
.badge.bad { background: #fde8e8; color: #a40000; }
.warn { border-color: #ead7a0; background: #fff8e8; }
.hidden { display: none !important; }
select, input[type=file] {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
.place-row {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.toolbar { display: flex; gap: 12px; align-items: center; }
button, .btn {
  display: inline-block;
  border: 0;
  background: var(--brand);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
}
button:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { font-weight: 600; }
#sig-stamp {
  min-width: 180px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #0a7a32;
  background: #e8f8ee;
  color: #0a7a32;
  font-weight: 600;
  font-size: 13px;
  border-radius: 6px;
  cursor: grab;
  user-select: none;
}
#sig-stamp:active { cursor: grabbing; }
#viewer-wrap {
  position: relative;
  overflow: auto;
  max-height: 70vh;
  border: 1px solid var(--line);
  background: #d9dde3;
  min-height: 240px;
}
#pdf-canvas { display: block; margin: 0 auto; }
#sig-box {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0a7a32;
  background: rgba(10, 122, 50, 0.22);
  color: #064d20;
  font-weight: 600;
  font-size: 12px;
  cursor: grab;
  user-select: none;
}
#sig-box.dragging { cursor: grabbing; }
#sig-resize {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 14px;
  height: 14px;
  background: #0a7a32;
  border-radius: 2px;
  cursor: nwse-resize;
}
.status { margin: 12px 0 0; font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
@media (max-width: 800px) {
  .grid { display: block; }
  .grid .card, .grid .card:last-child { margin: 16px 16px; }
  .card, .top { margin-left: 16px; margin-right: 16px; padding-left: 16px; padding-right: 16px; }
}
