@font-face{
  font-family:"Inter";
  src:url("/fonts/Inter.woff2") format("woff2 supports variations");
  font-weight:300 900;
  font-style:normal;
}

:root{
  --bg:#f1f5f9;        /* slate-100 */
  --panel:#ffffff;
  --card:#ffffff;
  --muted:#475569;     /* slate-600 */
  --text:#0f172a;      /* slate-900 */
  --primary:#1D2C65;   /* ARC primary */
  --accent:#69ABDE;    /* ARC tertiary */
  --danger:#EC6625;    /* ARC secondary */
  --border:#e2e8f0;    /* slate-200 */
  --shadow:0 12px 30px rgba(29,44,101,.10);
  --radius:14px;
  --focus:rgba(105,171,222,.55);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color:var(--text);
  background:
    radial-gradient(900px 500px at 10% 0%, rgba(105,171,222,.25), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(236,102,37,.12), transparent 55%),
    var(--bg);
}

a{ color:inherit; }

.container{
  display:grid;
  grid-template-columns: 320px 1fr;
  height:100vh;
}

.sidebar{
  background: var(--panel);
  border-right:1px solid var(--border);
  padding:18px;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:14px;
}
.logo{
  width:38px;height:38px;border-radius:12px;
  background: rgba(105,171,222,.25);
  border:1px solid rgba(105,171,222,.55);
  box-shadow: var(--shadow);
}
.brand h1{
  margin:0;
  font-size:16px;
  letter-spacing:.2px;
  color: var(--primary);
  font-weight: 800;
}
.brand p{
  margin:2px 0 0 0;
  color:var(--muted);
  font-size:12px;
}

.card{
  background: var(--card);
  border:1px solid var(--border);
  border-radius: var(--radius);
  padding:14px;
  box-shadow: var(--shadow);
}

.row{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}

.actionSection{
  margin-top:12px;
}

.actionTitle{
  margin-bottom:8px;
}

.actionRow{
  flex-direction:column;
  align-items:stretch;
  gap:10px;
}

.btn{
  appearance:none;
  border:1px solid var(--border);
  background: #ffffff;
  color: var(--primary);
  padding:10px 12px;
  border-radius: 12px;
  cursor:pointer;
  transition: transform .05s ease, background .15s ease, border-color .15s ease, color .15s ease;
  font-weight:700;
  font-size:13px;
}

.actionBtn{
  width:100%;
  min-height:54px;
  padding:14px 16px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  font-family:"Inter", "Segoe UI", Roboto, Arial, sans-serif;
  font-size:17px;
  font-weight:800;
  letter-spacing:.2px;
}

.btn.actionBtn,
.btn.actionBtn.primary{
  background: var(--primary);
  border-color: rgba(29,44,101,.90);
  color:#ffffff;
}

.btn.actionBtn:hover,
.btn.actionBtn.primary:hover{
  background:#162550;
  border-color:#162550;
}

.btn.actionBtn:disabled,
.btn.actionBtn.primary:disabled{
  background: rgba(29,44,101,.60);
  border-color: rgba(29,44,101,.45);
  color: rgba(255,255,255,.95);
}

.btnIcon{
  font-size:19px;
  line-height:1;
}
.btn:hover{ background: rgba(15,23,42,.03); border-color: rgba(105,171,222,.55); }
.btn:active{ transform: translateY(1px); }
.btn.primary{
  background: var(--accent);
  border-color: rgba(105,171,222,.70);
  color: #ffffff;
}
.btn.primary:hover{ background: var(--primary); border-color: rgba(29,44,101,.80); }
.btn.danger{
  background: var(--danger);
  border-color: rgba(236,102,37,.70);
  color: #ffffff;
}
.btn.danger:hover{ background: #d9561f; border-color: rgba(236,102,37,.85); }
.btn.small{ padding:8px 10px; font-size:12px; }
.btn:disabled{ opacity:.55; cursor:not-allowed; }

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

.uploadSplit{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
}

.uploadChoice{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  min-height:118px;
  width:100%;
  border-radius:12px;
  border:1px solid var(--border);
  background:#ffffff;
  padding:10px;
  color:var(--primary);
}

.uploadDrop{
  border:1px dashed rgba(29,44,101,.28);
  background: rgba(255,255,255,.65);
  cursor:default;
  transition: border-color .15s ease, background .15s ease;
}

.uploadDrop:focus{
  outline:2px solid var(--focus);
  outline-offset:2px;
}

.uploadDrop.dragover{
  border-color: rgba(105,171,222,.85);
  background: rgba(105,171,222,.16);
}

.uploadBrowse{
  cursor:pointer;
  transition: border-color .15s ease, background .15s ease;
}

.uploadBrowse:hover{
  border-color: rgba(105,171,222,.75);
  background: rgba(105,171,222,.10);
}

.uploadIcon{
  font-size:22px;
  line-height:1;
}

.uploadTitle{
  margin-top:7px;
  font-size:13px;
  font-weight:700;
  color:var(--primary);
}

.uploadSub{
  margin-top:3px;
  color:var(--muted);
  font-size:12px;
}

.dropzoneFileRow{
  margin-top:8px;
}

.dropzoneFile{
  color:var(--muted);
  font-size:12px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.panelTitle{
  color: var(--primary);
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .25px;
}

.guideAccordion{
  border-radius:10px;
}

.guideSummary{
  list-style:none;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:space-between;
  user-select:none;
}

.guideSummary::-webkit-details-marker{
  display:none;
}

.guideSummary::after{
  content:'▾';
  font-size:12px;
  line-height:1;
  color:var(--primary);
  transform:rotate(-90deg);
  transition:transform .15s ease;
}

.guideAccordion[open] .guideSummary::after{
  transform:rotate(0deg);
}

.guideContent{
  margin-top:8px;
}

.guideList{
  margin:8px 0 0 18px;
  padding:0;
  color:var(--muted);
  font-size:12px;
  line-height:1.5;
}

.guideList li{
  margin:0 0 8px 0;
}

.guideList li:last-child{
  margin-bottom:0;
}

.guideList strong{
  color:var(--primary);
}

.guideNote{
  margin:10px 0 0 0;
  color:var(--muted);
  font-size:12px;
  line-height:1.45;
}

.sectionDivider{
  height:1px;
  background: var(--border);
  margin:10px 0 12px;
}

.warningCard{
  background: #fff1f2;
  border:1px solid #fecdd3;
  border-left:4px solid #dc2626;
  border-radius:12px;
  padding:10px 12px;
}

.warningTitle{
  color:#991b1b;
  font-weight:800;
  font-size:12px;
  letter-spacing:.2px;
  text-transform:uppercase;
}

.warningText{
  margin-top:4px;
  color:#7f1d1d;
  font-size:12px;
  line-height:1.45;
}

.thumbs{
  margin-top:14px;
  display:flex;
  flex-direction:column;
  gap:8px;
  max-height: calc(100vh - 260px);
  overflow:auto;
  padding-right:6px;
}
.thumb{
  text-align:left;
  border-radius: 12px;
  padding:10px 12px;
  border:1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  cursor:pointer;
}
.thumb.active{
  border-color: rgba(105,171,222,.75);
  background: rgba(105,171,222,.14);
}

.main{
  position:relative;
  display:flex;
  flex-direction:column;
  height:100vh;
}

.operationOverlay{
  position:absolute;
  inset:0;
  z-index:50;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(241,245,249,.78);
  backdrop-filter: blur(2px);
}

.operationOverlay[hidden]{
  display:none !important;
}

.operationCard{
  min-width: 280px;
  max-width: 420px;
  padding:16px 18px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#ffffff;
  box-shadow: var(--shadow);
  display:flex;
  align-items:center;
  gap:12px;
}

.operationSpinner{
  width:22px;
  height:22px;
  border-radius:999px;
  border:3px solid rgba(105,171,222,.28);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
  flex-shrink:0;
}

.operationText{
  color:var(--primary);
  font-weight:700;
  font-size:14px;
}

.toolbar{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
  padding:14px 18px;
  border-bottom:1px solid var(--border);
  background: rgba(255,255,255,.85);
}

.toolbarControls{
  gap:8px;
}

.toolbarDivider{
  width:1px;
  height:28px;
  background:var(--border);
  margin:0 2px;
}

.status{
  color:var(--muted);
  font-size:13px;
  text-align:right;
  padding-top:3px;
}

.viewport{
  position:relative;
  flex:1;
  overflow:auto;
  background: #e2e8f0;
}
.viewport.panning{ cursor:grabbing; }

.floatingPagePanel{
  position:absolute;
  top:12px;
  left:12px;
  z-index:25;
  min-width:210px;
  padding:8px;
  border-radius:12px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.95);
  box-shadow: var(--shadow);
}

.floatingPageNav{
  display:flex;
  align-items:center;
  gap:8px;
}

.floatingNavBtn{
  min-width:34px;
  min-height:30px;
  padding:6px 8px;
  font-size:14px;
}

.floatingPageIndicator{
  min-width:88px;
  text-align:center;
  font-size:12px;
  font-weight:700;
  color:var(--primary);
}

.multiPageNotice{
  margin-top:8px;
  max-width:340px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(105,171,222,.65);
  background:rgba(105,171,222,.22);
  color:#17457a;
  font-size:12px;
  line-height:1.4;
  font-weight:600;
  box-shadow: var(--shadow);
}

.mainSignature{
  position:fixed;
  right:14px;
  bottom:10px;
  z-index:999;
  font-size:11px;
  color:var(--muted);
  background:rgba(255,255,255,.82);
  border:1px solid var(--border);
  border-radius:10px;
  padding:4px 8px;
  pointer-events:none;
}

.pageWrap{
  position:relative;
  padding: 16px 0 28px;
  transform-origin: 0 0;
  will-change: transform;
}

.pages{
  position:relative;
  display:flex;
  flex-direction:column;
  align-items:center;
}

.page{
  position:relative;
  margin: 0 0 18px 0;
  display:none;
  box-shadow: 0 20px 60px rgba(29,44,101,.18);
  border-radius: 12px;
  overflow:hidden;
}
.page.active{ display:block; }

.pdf-canvas{
  display:block;
}

.overlay{
  position:absolute;
  inset:0;
}

.rect{
  position:absolute;
  border-radius: 10px;
  background: rgba(0,0,0,.92);
  outline: 2px solid rgba(255,255,255,.10);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.rect.ghost{
  background: rgba(105,171,222,.22);
  outline: 2px dashed rgba(105,171,222,.85);
}

.rect-handle{
  position:absolute;
  right:-8px;
  top:-10px;
  width:24px;
  height:24px;
  border-radius: 999px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(236,102,37,.92);
  border: 1px solid rgba(29,44,101,.15);
  font-weight:900;
  cursor:pointer;
}

kbd{
  display:inline-block;
  padding:2px 6px;
  border-radius: 8px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.8);
  font-size:11px;
  color: var(--muted);
}

@media (max-width: 1180px){
  .toolbar{
    flex-direction:column;
    align-items:flex-start;
  }
  .status{
    text-align:left;
    padding-top:0;
  }
}

@media (max-width: 700px){
  .operationCard{
    min-width: 0;
    width: min(92vw, 360px);
  }
}

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