:root {
  color-scheme: dark;
  --bg: #101216;
  --panel: #191d24;
  --panel-strong: #222733;
  --text: #f4f7fb;
  --muted: #aab4c2;
  --line: #303747;
  --accent: #68d391;
  --accent-strong: #3fbf76;
  --warning: #f7c46c;
  --paper: #ffffff;
  --ink: #111111;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--accent);
  color: #07100b;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: #141820;
}

.app-header h1,
.workspace h2,
.control-section h2,
.info-panel h2,
.info-panel h3 {
  margin: 0;
  letter-spacing: 0;
}

.app-header h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.08;
}

.lead {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-badge {
  align-self: flex-start;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  white-space: nowrap;
}

.app-layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 20px;
  padding: 20px;
}

.controls,
.info-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.controls {
  position: sticky;
  top: 16px;
  align-self: start;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.control-section {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.control-section:last-child {
  border-bottom: 0;
}

.control-section h2 {
  margin-bottom: 14px;
  font-size: 16px;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
  padding: 9px 10px;
}

textarea {
  min-height: 148px;
  resize: vertical;
  line-height: 1.45;
}

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

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 9px;
}

.check-row input {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
}

.hint {
  color: #8e99a8;
  font-size: 12px;
  font-weight: 500;
}

.export-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.status-line {
  min-height: 40px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.workspace {
  min-width: 0;
}

.preview-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.preview-toolbar h2 {
  font-size: 24px;
}

.preview-meta {
  color: var(--muted);
  text-align: right;
}

.warning-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.warning-list:empty {
  display: none;
}

.warning-list p {
  margin: 0;
  border: 1px solid rgba(247, 196, 108, 0.45);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(247, 196, 108, 0.1);
  color: var(--warning);
}

.preview-frame {
  display: grid;
  justify-items: center;
  gap: 20px;
  overflow: auto;
  max-width: 100%;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0d12;
}

.print-sheet {
  position: relative;
  flex: 0 0 auto;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.42);
}

.page-number {
  position: absolute;
  right: 5mm;
  bottom: 4mm;
  color: #9ca3af;
  font-size: 2.4mm;
}

.sheet-card,
.sheet-section-title {
  position: absolute;
}

.sheet-card {
  display: block;
  color: var(--ink);
  border: 0.15mm dashed #c6cbd3;
}

.sheet-card-plotter,
.sheet-card-control {
  border-style: solid;
  border-color: #d1d5db;
}

.sheet-card-compact,
.sheet-card-duplex {
  border-color: #e5e7eb;
}

.sheet-card-scissors {
  border: 0.25mm dashed #111111;
}

.sheet-card.no-cut-lines {
  border-color: transparent;
}

.sticker-zone {
  position: absolute;
  border: 0.18mm solid #333333;
}

.sticker-zone.no-sticker-bounds {
  border-color: transparent;
}

.sticker-zone svg {
  display: block;
  width: 100%;
  height: 100%;
}

.sticker-top-cue {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 0.45mm;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 1.1mm solid transparent;
  border-right: 1.1mm solid transparent;
  border-bottom: 1.55mm solid #111111;
}

.color-light-on-dark .sticker-top-cue {
  border-bottom-color: #ffffff;
}

.paper-label {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.7mm;
  overflow: hidden;
  font-size: 2.2mm;
  line-height: 1.15;
}

.sheet-card-control .paper-label,
.sheet-card-scissors .paper-label {
  font-size: 2.45mm;
}

.sheet-card-compact .paper-label,
.sheet-card-duplex .paper-label,
.sheet-card-plotter .paper-label {
  font-size: 1.65mm;
  gap: 0.25mm;
}

.label-on-back {
  align-items: center;
  padding: 0.8mm;
  border: 0.15mm solid #d1d5db;
}

.paper-label strong {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 2.75mm;
}

.paper-label span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.paper-checkbox {
  width: 3mm;
  height: 3mm;
  border: 0.25mm solid #111111;
}

.paper-checkbox.tiny {
  width: 2mm;
  height: 2mm;
  align-self: center;
}

.cut-line,
.safe-area,
.sticker-boundary {
  position: absolute;
  pointer-events: none;
}

.cut-line {
  inset: 0;
  border: 0.15mm dashed #8a8f98;
}

.sheet-card-scissors .cut-line {
  border: 0.25mm dashed #111111;
}

.safe-area {
  inset: 1mm;
  border: 0.12mm dotted #7aa7d9;
}

.sticker-boundary {
  border: 0.16mm solid #111111;
}

.registration-mark {
  position: absolute;
  width: 5mm;
  height: 5mm;
  transform: translate(-50%, -50%);
}

.registration-mark::before,
.registration-mark::after {
  content: "";
  position: absolute;
  background: #111111;
}

.registration-mark::before {
  left: 0;
  top: 2.35mm;
  width: 5mm;
  height: 0.3mm;
}

.registration-mark::after {
  left: 2.35mm;
  top: 0;
  width: 0.3mm;
  height: 5mm;
}

.page-side-label {
  position: absolute;
  left: 5mm;
  bottom: 4mm;
  color: #6b7280;
  font-size: 2.4mm;
  font-weight: 700;
}

.top-arrow {
  font-weight: 700;
}

.sheet-section-title {
  display: flex;
  align-items: center;
  border-bottom: 0.25mm solid #111111;
  color: #111111;
  font-size: 3.2mm;
  font-weight: 800;
}

.info-panel {
  margin-top: 20px;
  padding: 20px;
}

.info-panel h2 {
  margin-bottom: 16px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.info-grid article {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.info-grid p,
.info-grid ol {
  color: var(--muted);
  line-height: 1.55;
}

.info-grid ol {
  padding-left: 22px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 980px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .controls {
    position: static;
    max-height: none;
  }

  .preview-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .preview-meta {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .app-header {
    flex-direction: column;
  }

  .header-badge {
    white-space: normal;
  }

  .app-layout {
    padding: 12px;
  }

  .two-columns,
  .export-bar,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .preview-frame {
    justify-items: start;
    padding: 12px;
  }
}

@media print {
  :root {
    color-scheme: light;
  }

  body {
    background: #ffffff;
  }

  .app-header,
  .controls,
  .preview-toolbar,
  .warning-list,
  .info-panel {
    display: none !important;
  }

  .app-layout,
  .workspace,
  .preview-frame {
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
    background: #ffffff;
    overflow: visible;
  }

  .print-sheet {
    margin: 0;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
  }

  .print-sheet:last-child {
    break-after: auto;
    page-break-after: auto;
  }
}
