* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f4f7fb;
  color: #1d2433;
}

.topbar {
  padding: 22px 20px;
  background: #ffffff;
  border-bottom: 1px solid #dde3ea;
}

.topbar h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.topbar p {
  margin: 0;
  color: #5d6879;
}

.container {
  width: min(1200px, calc(100% - 24px));
  margin: 20px auto 40px;
}

.card {
  background: white;
  border: 1px solid #dde3ea;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: 0 4px 18px rgba(0,0,0,.04);
}

.soft {
  background: #fafcff;
}

.section-title {
  margin-top: 2px;
  margin-bottom: 12px;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.option {
  display: flex;
  gap: 10px;
  margin: 10px 0;
  line-height: 1.4;
  align-items: flex-start;
}

.help {
  margin: 8px 0 0;
  color: #576378;
  line-height: 1.5;
  font-size: 14px;
}

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

.inline-row input {
  width: 100px;
  border: 1px solid #d1d8e4;
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 14px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 15px;
  cursor: pointer;
  background: #e9eef5;
}

button:hover {
  filter: brightness(.98);
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.primary {
  background: #2563eb;
  color: white;
}

.success {
  background: #118c4f;
  color: white;
}

.danger {
  background: #d94343;
  color: white;
}

.danger-light {
  background: #ffe8e8;
  color: #a11d1d;
}

.notice {
  line-height: 1.5;
  color: #465266;
}

.status {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

#message {
  color: #566176;
}

.separator {
  color: #95a0b5;
  margin: 0 10px;
}

.pages {
  display: grid;
  gap: 16px;
}

.page-card {
  background: white;
  border: 1px solid #dfe4eb;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 4px 18px rgba(0,0,0,.04);
}

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

.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.page-preview {
  width: 100%;
  max-height: 650px;
  object-fit: contain;
  display: block;
  background: #eef2f7;
  border-radius: 10px;
}

.crop-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.92);
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

.crop-toolbar {
  min-height: 58px;
  padding: 10px 16px;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.crop-stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

#rectImage {
  max-width: 100%;
  max-height: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.selection-box {
  position: absolute;
  border: 2px solid #e53935;
  background: rgba(229,57,53,.16);
  pointer-events: none;
}

#captureVideo {
  position: fixed;
  left: -10000px;
  top: -10000px;
  width: 1px;
  height: 1px;
}

@media (max-width: 900px) {
  .grid-two {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .controls button {
    flex: 1 1 100%;
  }

  .page-title {
    align-items: flex-start;
    flex-direction: column;
  }
}


.top-gap {
  margin-top: 14px;
}


.mini-heading {
  margin: 0 0 8px;
  font-size: 15px;
}


.success-alt {
  background: #6b4eff;
  color: white;
}
