/* Scale ruler — calibrate image scale, measure, export PDF */

.sr-page {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #f0f4f8;
  color: #0f172a;
  line-height: 1.5;
}

.sr-noscript {
  margin: 1rem;
  padding: 1rem;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  max-width: 52rem;
  margin-left: auto;
  margin-right: auto;
}

.sr-hero {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 50%, #3b82f6 100%);
  color: #eff6ff;
  padding: 1.75rem 1.25rem 1.5rem;
}

.sr-hero__inner {
  max-width: 1200px;
  margin: 0 auto;
}

.sr-hero__crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.65rem;
  font-size: 0.82rem;
}

.sr-hero__crumbs a {
  color: #bfdbfe;
  text-decoration: underline;
}

.sr-hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.45rem, 2.2vw + 1rem, 2rem);
  font-weight: 800;
  line-height: 1.15;
}

.sr-hero p {
  margin: 0;
  max-width: 56rem;
  font-size: 0.92rem;
  opacity: 0.96;
}

.sr-main {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 0;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 12rem);
}

@media (max-width: 860px) {
  .sr-main {
    grid-template-columns: 1fr;
  }
}

.sr-sidebar {
  background: #fff;
  border-right: 1px solid #e2e8f0;
  padding: 1rem;
  overflow-y: auto;
  max-height: calc(100vh - 10rem);
}

@media (max-width: 860px) {
  .sr-sidebar {
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
    max-height: none;
  }
}

.sr-panel {
  margin-bottom: 1.1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.sr-panel--compact {
  border-bottom: none;
  margin-bottom: 0;
}

.sr-panel__title {
  margin: 0 0 0.55rem;
  font-size: 0.88rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
}

.sr-panel label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: #334155;
}

.sr-hint {
  margin: 0.35rem 0 0.65rem;
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.45;
}

.sr-hint--tight {
  margin-top: 0.45rem;
  margin-bottom: 0;
}

.sr-file-label {
  display: inline-block;
  padding: 0.45rem 0.85rem;
  background: #2563eb;
  color: #fff;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 0.35rem;
}

.sr-file-input {
  display: block;
  width: 100%;
  font-size: 0.82rem;
  margin-top: 0.35rem;
}

select,
.sr-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.55rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
  font-size: 0.88rem;
  background: #fff;
}

.sr-input-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
}

.sr-input-row .sr-input {
  flex: 1;
}

.sr-unit-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #475569;
  min-width: 2rem;
}

.sr-tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.sr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #0f172a;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.sr-btn:hover:not(:disabled) {
  background: #e2e8f0;
}

.sr-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sr-btn--primary {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #fff;
  width: 100%;
  margin-bottom: 0.35rem;
}

.sr-btn--primary:hover:not(:disabled) {
  background: #1d4ed8;
}

.sr-btn--ghost {
  background: transparent;
  width: 100%;
  border-style: dashed;
}

.sr-btn--tool {
  flex: 1;
  min-width: 5.5rem;
}

.sr-btn--tool.sr-btn--active {
  background: #dbeafe;
  border-color: #2563eb;
  color: #1e40af;
}

.sr-btn--tiny {
  padding: 0.25rem 0.5rem;
  font-size: 0.78rem;
  min-width: 2rem;
}

.sr-scale-info {
  margin: 0.55rem 0 0;
  padding: 0.55rem 0.65rem;
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  border-radius: 8px;
  font-size: 0.8rem;
  color: #065f46;
  line-height: 1.45;
}

.sr-dim-preview {
  margin: 0.45rem 0 0.65rem;
  font-size: 0.8rem;
  color: #475569;
}

.sr-zoom-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.sr-zoom-row input[type="range"] {
  flex: 1;
}

.sr-zoom-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
}

.sr-workspace-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #cbd5e1;
}

.sr-status {
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  min-height: 1.4rem;
}

.sr-status--ok {
  background: #ecfdf5;
  color: #065f46;
}

.sr-status--warn {
  background: #fffbeb;
  color: #92400e;
}

.sr-workspace {
  position: relative;
  flex: 1;
  min-height: 420px;
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
  outline: none;
}

.sr-workspace.sr-mode-pan {
  cursor: grab;
}

.sr-workspace.sr-mode-pan.sr-dragging {
  cursor: grabbing;
}

.sr-workspace.sr-drag-over {
  outline: 3px dashed #2563eb;
  outline-offset: -3px;
}

#sr-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.sr-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: #64748b;
  text-align: center;
  padding: 1rem;
}

.sr-empty[hidden] {
  display: none;
}

.sr-empty__title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: #475569;
}

.sr-empty__text {
  margin: 0;
  font-size: 0.88rem;
}

.sr-readout {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  padding: 0.45rem 0.65rem;
  background: rgba(15, 23, 42, 0.88);
  color: #f8fafc;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  pointer-events: none;
  max-width: calc(100% - 1.5rem);
}

.sr-measure-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0.75rem;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  max-height: 140px;
  overflow-y: auto;
  font-size: 0.82rem;
}

.sr-measure-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.sr-measure-list li:last-child {
  border-bottom: none;
}

.sr-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.sr-steps__item {
  flex: 1;
  min-width: 4.2rem;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.35rem 0.25rem;
  border-radius: 6px;
  background: #f1f5f9;
  color: #64748b;
}

.sr-steps__item--active {
  background: #dbeafe;
  color: #1e40af;
}

.sr-steps__item--done {
  background: #ecfdf5;
  color: #047857;
}

.sr-pdf-pages {
  margin-top: 0.55rem;
}

.sr-suggest-scale {
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
  color: #1e40af;
  line-height: 1.45;
}

.sr-link-btn {
  border: none;
  background: none;
  color: #2563eb;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.sr-check-row {
  margin: 0.35rem 0;
  font-size: 0.78rem;
  color: #475569;
}

.sr-check-row label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  margin: 0;
  cursor: pointer;
}

.sr-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}

.sr-measure-list--sidebar {
  max-height: 160px;
  padding: 0.35rem 0;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.sr-measure-list__item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid #e2e8f0;
}

.sr-measure-list__label {
  font-weight: 600;
  color: #475569;
}

.sr-measure-list__val {
  font-weight: 700;
  color: #0f172a;
}

.sr-measure-list__acts {
  display: flex;
  gap: 0.15rem;
}

.sr-icon-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 4px;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  color: #475569;
}

.sr-icon-btn:hover {
  background: #e2e8f0;
}

.sr-angle-hint {
  position: absolute;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.4rem 0.75rem;
  background: rgba(124, 58, 237, 0.92);
  color: #fff;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  pointer-events: none;
  white-space: nowrap;
  max-width: calc(100% - 1.5rem);
  overflow: hidden;
  text-overflow: ellipsis;
}

.sr-workspace.sr-mode-angle {
  cursor: crosshair;
}

.sr-help {
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: #64748b;
}

.sr-help summary {
  cursor: pointer;
  font-weight: 700;
  color: #475569;
}

.sr-help__list {
  margin: 0.45rem 0 0;
  padding-left: 1.1rem;
  line-height: 1.55;
}

.sr-help kbd,
.sr-hint kbd {
  display: inline-block;
  padding: 0.05rem 0.35rem;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #f8fafc;
  font-size: 0.72rem;
  font-family: inherit;
}

@media print {
  .sr-no-print {
    display: none !important;
  }
}
