/* Homepage: portrait-first desk — preview leads, controls follow (app-like). */
.page-home {
  --home-ink: #101f33;
  --home-muted: #53657d;
  --home-line: #dce3ed;
  --home-panel: #fff;
  --home-warm: #f0f2f8;
  --home-accent: #533afd;
  --home-accent-dark: #4434d4;
  --font-display: "DM Sans", system-ui, sans-serif;
}

.home-studio {
  width: var(--page-width);
  margin: 0 auto 72px;
  padding-top: 8px;
}

.home-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px 32px;
  align-items: end;
  padding: 28px 0 24px;
  border-bottom: 1px solid var(--home-line);
}
.home-intro h1 {
  grid-column: 1 / -1;
  max-width: 16ch;
  margin: 0;
  color: var(--home-ink);
  font: 700 clamp(30px, 4.4vw, 44px) / 1.07 var(--font-display);
  letter-spacing: -.038em;
  text-wrap: balance;
}
.home-intro .lead {
  margin: 0;
  max-width: 88ch;
  color: var(--home-muted);
  font-size: 16px;
  line-height: 1.6;
}
.home-paper-note {
  margin: 10px 0 0;
  max-width: 88ch;
  color: var(--home-muted);
  font-size: 14.5px;
  line-height: 1.65;
}
.home-desk {
  display: grid;
  grid-template-columns: minmax(260px, .95fr) minmax(0, 1.05fr);
  align-items: start;
  gap: 0;
  margin-top: 24px;
  border: 1px solid var(--home-line);
  border-radius: var(--home-radius-card);
  overflow: hidden;
  background: var(--home-panel);
  box-shadow: var(--home-card-shadow);
}

.home-desk-preview {
  display: flex;
  flex-direction: column;
  padding: 28px;
  background: var(--home-warm);
  border-right: 1px solid var(--home-line);
}
.preview-chrome {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 12px;
}
.preview-label {
  font-weight: 600;
  color: var(--home-ink);
  letter-spacing: -.01em;
}
.preview-meta {
  color: var(--home-muted);
  font-variant-numeric: tabular-nums;
}
.preview-frame {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  min-height: 0;
  margin: 0 auto;
  width: min(240px, 72%);
  aspect-ratio: var(--preview-aspect, 413 / 531);
  background: var(--preview-bg, #4385d8);
  border: 1px solid rgba(16,31,51,.10);
  border-radius: var(--home-radius-control);
  box-shadow: 0 4px 14px rgba(16,31,51,.12);
}
.preview-frame::after {
  position: absolute;
  z-index: 4;
  inset: 0;
  border: 1px solid rgba(18, 31, 48, .82);
  content: "";
  pointer-events: none;
}
.preview-frame img,
.preview-frame canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  object-position: center center;
}
.preview-frame canvas { object-fit: fill; }
.preview-frame #home-preview-canvas { z-index: 1; }
.preview-guides { position: absolute; inset: 0; z-index: 3; display: block; width: 100%; height: 100%; overflow: hidden; pointer-events: none; }
.preview-guides[hidden] { display: none; }
.preview-guide-axis { fill: none; stroke: rgba(18,34,54,.84); stroke-width: 1.1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.preview-guide-offset { fill: none; stroke: #d47a1e; stroke-width: 1.5; stroke-dasharray: 4 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.preview-guide-center { fill: #fff; stroke: #192c43; stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.preview-guide-subject-cross { fill: none; stroke: #fff; stroke-width: 1.4; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.preview-guide-subject { fill: rgba(255,255,255,.92); stroke: #b76713; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.preview-foot {
  margin: 16px 0 0;
  max-width: 36ch;
  color: var(--home-muted);
  font-size: 12px;
  line-height: 1.5;
}
.home-example-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  min-height: 44px;
  margin-top: 10px;
  color: var(--home-accent-dark);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  text-underline-offset: 3px;
}
.home-example-link:hover { text-decoration: underline; }

.home-desk-controls {
  padding: 24px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.home-desk-controls.picker { padding: 24px 28px 28px; border: 0; border-radius: 0; box-shadow: 0 0 #0000; background: transparent; container-type: inline-size; }
.desk-block--photo { padding-top: 0; border-top: 0; }
.desk-block--output { padding-top: 14px; border-top: 1px solid var(--home-line); }
.home-adjustment-grid { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(0,.85fr); align-items: stretch; gap: 16px; }
.desk-block--framing, .desk-block--background { display: flex; flex-direction: column; min-width: 0; }
.desk-card[hidden], .desk-block[hidden] { display: none !important; }

/* Size pages: only framing + output controls remain, so lay them out as flat
   panels in the workbench column instead of nested cards inside a two-column grid. */
.page-home--size .desk-block--framing,
.page-home--size .desk-block--output {
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
}
.page-home--size .desk-block--output { border-top: 1px solid var(--home-line); padding-top: 16px; }
.page-home--size .home-framing-controls { align-content: start; }

/* Modular cards: each control group is a self-contained panel instead of a divider line. */
.desk-card { border: 1px solid var(--home-line); border-radius: var(--home-radius-card); background: var(--home-panel, #fff); box-shadow: var(--home-card-shadow); padding: 20px 20px 18px; }
.desk-card .desk-title { margin-bottom: 14px; }
.home-adjustment-grid { border-top: 0; padding: 0; gap: 16px; }
.desk-block--output { border-top: 0; padding-top: 0; }
.desk-title {
  margin: 0 0 10px;
  font: 650 13px / 1.3 var(--font-display);
  letter-spacing: .02em;
  text-transform: uppercase;
  color: #4a5563;
}
.home-adjustment-grid .desk-title { margin-bottom: 6px; color: #15263e; font-size: 14px; letter-spacing: 0; text-transform: none; }
.home-adjustment-grid .home-frame-help { max-width: 34ch; color: #66758b; font-size: 12px; line-height: 1.45; }
.home-adjustment-grid #home-cutout-hint { min-height: 0; max-width: 34ch; margin: 0 0 12px; color: #66758b; font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.desk-hint {
  margin: 10px 0 0;
  font-size: 13px;
}
.desk-hint a { color: var(--home-accent-dark); font-weight: 600; text-decoration: none; }
.desk-hint a:hover { text-decoration: underline; }

.size-matrix {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.size-matrix--wrap { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.home-size-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  min-height: 58px;
  padding: 8px 10px;
  border: 1px solid #d9d5ce;
  border-radius: 8px;
  background: #fafaf8;
  color: #26303a;
  text-align: left;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.home-size-option span { font-size: 13px; font-weight: 600; white-space: normal; overflow-wrap: anywhere; }
.home-size-option small { font-size: 11px; color: #667080; }
.home-size-option:hover { border-color: #8faede; background: #f4f7fc; }
.home-size-option[aria-pressed="true"] {
  border-color: var(--home-accent);
  background: #edf2fb;
  outline: 1px solid var(--home-accent);
}
.home-more-sizes { margin-top: 8px; }
.home-more-sizes summary {
  cursor: pointer;
  color: var(--home-accent-dark);
  font-size: 13px;
  font-weight: 600;
}
.home-more-options { margin-top: 8px; }

.bg-swatches { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.bg-swatch {
  min-width: 0;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #d0d4da;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: #344250;
  cursor: pointer;
}
.bg-swatch[data-bg="original"] { grid-column: 1 / -1; }
.bg-swatch.is-active {
  border-color: var(--home-accent);
  background: #edf2fb;
  color: var(--home-accent-dark);
}
.bg-swatch[data-bg="#4385d8"].is-active { background: #4385d8; color: #fff; border-color: #3568b0; }
.bg-swatch[data-bg="#ffffff"].is-active { background: #fff; }
.bg-swatch[data-bg="#d94a50"].is-active { background: #d94a50; color: #fff; border-color: #b83a40; }
.home-bg-custom { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; cursor: pointer; }
.home-bg-custom.is-active { border-color: var(--home-accent); background: #f0efff; color: var(--home-accent-dark); }
.home-bg-custom input[type="color"] { flex: 0 0 26px; width: 26px; height: 26px; min-height: 26px; padding: 2px; border: 1px solid #d0d4da; border-radius: 6px; background: #fff; cursor: pointer; }

.home-upload {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px 14px;
  border: 1px dashed var(--home-control-line);
  border-radius: var(--home-radius-card);
  background: rgba(255,255,255,.72);
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}
.home-upload:hover { border-color: var(--home-accent); background: var(--blue-soft, #f0efff); box-shadow: var(--home-card-shadow); }
.home-upload--preview { margin-top: 16px; }
.home-desk-preview > .home-file-status { margin: 7px 0 0; }
.home-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.home-upload-icon {
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--home-radius-control);
  background: var(--home-accent);
  color: #fff;
  box-shadow: var(--home-primary-shadow);
}
.home-upload-icon svg { width: 20px; height: 20px; }
.home-upload-copy { min-width: 0; }
.home-upload-copy b { display: block; font-size: 14px; color: var(--home-ink); overflow-wrap: anywhere; }
.home-upload-copy small { font-size: 12px; color: var(--home-muted); }
.home-file-status { min-height: 20px; margin: 8px 0; font-size: 13px; color: var(--home-muted); }
.home-country-fields { display: grid; gap: 7px; }
.home-country-fields > label { color: #35445a; font-size: 12px; font-weight: 600; }
.home-country-fields select { width: 100%; min-height: 40px; padding: 0 11px; border: 1px solid var(--home-control-line); border-radius: var(--home-radius-control); background: #fff; color: #213249; font: inherit; }
.home-spec-status { min-height: 0; margin: 2px 0 0; color: #647187; font-size: 12px; line-height: 1.5; }
.home-output-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.home-output-actions .home-add-size, .home-output-actions .home-download-photo { min-width: 0; min-height: 44px; padding: 8px 12px; white-space: normal; overflow-wrap: anywhere; font-size: 14px; font-weight: 600; line-height: 1.3; border-radius: var(--home-radius-control); }
.home-output-actions .home-add-size { background: var(--home-primary-gradient); border-color: var(--home-accent); color: #fff; box-shadow: var(--home-primary-shadow); }
.home-output-actions .home-add-size:hover:not(:disabled) { background: linear-gradient(180deg, #583cf5 0%, var(--home-accent-dark) 100%); border-color: var(--home-accent-dark); }
.home-output-actions .home-download-photo { background: #fff; border-color: var(--home-control-line); color: #344760; }
.page-home .home-output-actions .button:disabled { border-color: #c8d0dc; background: #e9edf3; color: #536176; opacity: 1; cursor: not-allowed; }
.home-manual-dimensions { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 8px; padding: 14px 0 0; margin-top: 12px; border-top: 1px solid var(--home-line); border-radius: 0; background: transparent; }
.home-manual-dimensions[hidden] { display: none; }
.home-size-custom input { width: 84px; min-height: 36px; padding: 4px 6px; border: 1px solid var(--home-control-line); border-radius: var(--home-radius-control); }
.home-size-presets { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 6px; }
.home-size-preset { min-height: 36px; padding: 5px 8px; border: 1px solid var(--home-control-line); border-radius: var(--home-radius-control); background: #fff; color: #40516a; font: inherit; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 150ms ease; }
.home-size-preset:hover { border-color: #94a3b8; background: #f8fafc; }
.home-size-preset:focus-visible { outline: none; border-color: var(--home-accent); box-shadow: 0 0 0 3px var(--blue-soft, #f0efff); }
.home-size-preset:active { transform: scale(0.97); }
.home-size-preset.is-active { border-color: var(--home-accent); background: var(--blue-soft, #f0efff); color: var(--home-accent-dark, #4434d4); }
.home-size-custom { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.home-size-custom label { display: flex; align-items: center; gap: 5px; color: #40516a; font-size: 12px; }
.home-size-hint { flex: 1 0 100%; color: #647187; font-size: 11px; }
.home-framing-controls { display: grid; flex: 1; grid-template-columns: minmax(0,1fr) auto; grid-auto-rows: auto; align-content: space-between; gap: 8px 12px; align-items: center; margin-top: 0; padding-top: 0; border-top: 0; }
.home-frame-help { grid-column: 1 / -1; margin: 0; color: #647187; font-size: 12px; line-height: 1.5; }
.home-guide-toggle { grid-column: 1 / -1; display: inline-flex; align-items: center; gap: 7px; color: #52627a; font-size: 12px; cursor: pointer; }
.home-guide-toggle input { width: 15px; height: 15px; margin: 0; accent-color: #315e9d; }
.home-framing-controls label { color: #35445a; font-size: 12px; font-weight: 600; }
.home-framing-controls output { margin-left: 8px; color: #53647a; font-variant-numeric: tabular-nums; font-weight: 500; }
.home-framing-controls input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: #315e9d; }
.home-position-tools { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 160px; }
.home-nudge-pad { display: grid; grid-template-columns: 40px 96px 40px; grid-template-rows: 40px 40px 40px; gap: 6px; align-items: center; justify-items: center; flex: 0 0 auto; margin-inline: auto; }
.home-nudge-button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--home-control-line); border-radius: var(--home-radius-control); background: #fff; color: #344760; cursor: pointer; }
.home-nudge-button:hover:not(:disabled) { border-color: #869cbb; background: #f1f5fa; }
.home-nudge-button:focus-visible { outline: 2px solid var(--home-accent); outline-offset: 2px; }
.home-nudge-button:disabled { border-color: #d3d9e2; background: #eef1f5; color: #657287; cursor: not-allowed; }
.home-nudge-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.home-nudge-left svg { transform: rotate(-90deg); }
.home-nudge-right svg { transform: rotate(90deg); }
.home-nudge-down svg { transform: rotate(180deg); }
.home-nudge-up { grid-row: 1; grid-column: 2; }
.home-nudge-left { grid-row: 2; grid-column: 1; }
.home-nudge-readout { grid-row: 2; grid-column: 2; display: grid; place-content: center; width: 96px; min-height: 38px; color: #344760; font-size: 11px; font-weight: 600; line-height: 1.35; text-align: center; font-variant-numeric: tabular-nums; }
.home-nudge-right { grid-row: 2; grid-column: 3; }
.home-nudge-down { grid-row: 3; grid-column: 2; }
.home-nudge-help { max-width: 34ch; margin: 0; color: #66758b; font-size: 12px; line-height: 1.45; text-align: center; }
.home-reset-frame { justify-self: end; align-self: end; margin-top: auto; padding: 6px 10px; border: 1px solid #d4dce7; border-radius: 7px; background: #fff; color: #35445a; font-size: 12px; cursor: pointer; }
.home-reset-frame:disabled { opacity: .5; cursor: not-allowed; }
#home-preview-canvas { touch-action: none; }
#home-preview-canvas.is-draggable { cursor: grab; }
#home-preview-canvas.is-draggable:active { cursor: grabbing; }
.home-alignment-status { margin: 9px 0 0; padding: 8px 10px; border: 1px solid #e1e6ed; border-radius: 8px; background: rgba(255,255,255,.72); color: #58677c; font-size: 11px; line-height: 1.45; font-variant-numeric: tabular-nums; }
.home-alignment-status.is-centered { border-color: #d8e8df; color: #37694d; }
.home-alignment-status.is-offset { border-color: #eadfc9; color: #765920; }
.home-keyboard-hint { margin: 6px 0 0; color: #53647a; font-size: 12px; line-height: 1.45; }
#home-preview-canvas:focus-visible { outline: 2px solid var(--home-accent); outline-offset: -4px; }
#home-cutout-hint { min-height: 34px; color: var(--home-muted); }

.home-print-studio {
  margin-top: 48px;
  padding: 32px;
  border: 1px solid #d7dce5;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 0 #0000;
}
.home-print-intro { max-width: 720px; margin-bottom: 26px; }
.home-print-intro h2 { margin: 0; color: #15263e; font: 650 clamp(23px,3vw,30px)/1.2 var(--font-display); letter-spacing: -.03em; }
.home-print-intro > p:last-child { margin: 10px 0 0; color: #5d6a7d; font-size: 14px; line-height: 1.6; }
.home-sheet-source-switch { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0 0 22px; border-bottom: 1px solid #e3e7ed; }
.home-sheet-source-switch button { min-height: 42px; padding: 8px 2px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #5d6a7d; font: 600 13px/1.35 var(--font-sans); cursor: pointer; }
.home-sheet-source-switch button[aria-pressed="true"] { border-bottom-color: #533afd; color: #3021bc; }
.home-sheet-source-switch button:disabled { color: #8792a1; cursor: not-allowed; }
.home-sheet-direct-panel { display: grid; gap: 10px; }
.home-sheet-direct-panel[hidden], .home-sheet-edited-panel[hidden], .home-print-sizes[hidden] { display: none; }
.home-sheet-upload { min-height: 64px; padding: 10px 12px; border-radius: 7px; }
.home-sheet-size-field { display: grid; gap: 6px; margin: 0; }
.home-sheet-size-field > span, .home-sheet-manual-size > label { color: #35445a; font-size: 12px; font-weight: 600; }
.home-sheet-country-preset { margin-top: -4px; font-size: 12px; }
.home-sheet-country-preset summary { min-height: 34px; display: flex; align-items: center; color: #4434d4; font-weight: 600; cursor: pointer; list-style: none; }
.home-sheet-country-preset summary::-webkit-details-marker { display: none; }
.home-sheet-country-preset > div { display: grid; gap: 6px; padding: 3px 0 5px; }
.home-sheet-country-preset label { color: #53657d; font-size: 11px; font-weight: 600; }
.home-sheet-country-preset select { width: 100%; min-height: 40px; padding: 0 10px; border: 1px solid var(--home-control-line); border-radius: var(--home-radius-control); background: #fff; color: #213249; font: inherit; }
.home-sheet-country-preset select:disabled { background: #f1f3f5; color: #788393; }
.home-sheet-manual-size[hidden], .home-sheet-confirm[hidden] { display: none; }
.home-sheet-manual-size > div { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 8px; margin-top: 6px; }
.home-sheet-manual-size input { width: 100%; min-height: 38px; padding: 6px 9px; border: 1px solid var(--home-control-line); border-radius: var(--home-radius-control); color: #213249; font: inherit; }
.home-sheet-manual-size input:disabled { background: #f1f3f5; color: #788393; }
.home-sheet-manual-size > div > span, .home-sheet-manual-size output { color: #647187; font-size: 12px; font-variant-numeric: tabular-nums; }
.home-sheet-confirm { display: flex; align-items: flex-start; gap: 8px; color: #40516a; font-size: 12px; font-weight: 600; line-height: 1.45; cursor: pointer; }
.home-sheet-confirm input { flex: 0 0 auto; width: 16px; height: 16px; margin: 1px 0 0; accent-color: #533afd; }
.home-sheet-edited-panel { padding-bottom: 2px; }
.home-print-layout { display: grid; grid-template-columns: minmax(260px,.72fr) minmax(0,1.28fr); gap: 28px; align-items: start; }
.home-print-controls { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.home-print-field label, .home-print-sizes legend { display: block; margin-bottom: 8px; color: #35445a; font-size: 13px; font-weight: 600; }
.home-print-field select { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--home-control-line); border-radius: var(--home-radius-control); background: #fff; color: #213249; font: inherit; }
.home-print-sizes { min-width: 0; margin: 0; padding: 0; border: 0; }
.home-print-size-list { display: grid; gap: 7px; }
.home-print-size { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 8px; align-items: center; min-height: 58px; padding: 8px 10px; border: 1px solid #e0e5ed; border-radius: 8px; background: #fff; }
.home-print-size-info { min-width: 0; }
.home-print-size b, .home-print-size small { display: block; overflow-wrap: anywhere; }
.home-print-size b { color: #27384f; font-size: 13px; font-weight: 600; }
.home-print-size small { margin-top: 2px; color: #68768a; font-size: 12px; }
.home-frame-size, .home-remove-size { min-height: 32px; padding: 4px 7px; border: 1px solid #d4dce7; border-radius: 6px; background: #fff; color: #40516a; font-size: 11px; white-space: nowrap; cursor: pointer; }
.home-frame-size:hover, .home-remove-size:hover { background: #f3f6fb; border-color: #a5b5cb; }
.home-print-empty { margin: 4px 0; color: #748197; font-size: 13px; line-height: 1.5; }
.home-print-status { min-height: 40px; margin: 0; color: #53647a; font-size: 13px; line-height: 1.5; }
.home-print-download { width: 100%; min-height: 46px; border-color: var(--home-accent); background: var(--home-primary-gradient); color: #fff; font-weight: 600; white-space: normal; box-shadow: var(--home-primary-shadow); }
.home-print-download:hover:not(:disabled) { border-color: var(--home-accent-dark); background: linear-gradient(180deg, #583cf5 0%, var(--home-accent-dark) 100%); }
.home-print-download:disabled { border-color: #d8dee8; background: #e6eaf0; color: #758092; opacity: 1; cursor: not-allowed; box-shadow: none; }
.home-print-note { color: #718096; font-size: 11px; line-height: 1.5; }
.home-sheet-preview-wrap { min-width: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
.home-sheet-preview-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 12px; color: #34455e; font-size: 12px; font-weight: 600; }
.home-sheet-preview-head span:last-child { color: #6b788a; font-weight: 500; text-align: right; }
.home-sheet-example { position: relative; display: block; width: 100%; aspect-ratio: var(--paper-aspect, 152 / 102); overflow: hidden; border: 1px solid #d8dee7; background: #fff; }
.home-sheet-example[hidden], #home-sheet-preview[hidden] { display: none; }
.home-sheet-example-photo { position: absolute; display: block; box-sizing: border-box; object-fit: cover; object-position: center; border: 1px solid rgba(22,35,55,.52); background: #fff; }
#home-sheet-preview { display: block; width: 100%; height: auto; border: 1px solid #d8dee7; background: #fff; }
#home-preview-canvas, #home-sheet-preview { border-radius: 0; }
.home-sheet-legend { margin-top: 10px; color: #758196; font-size: 11px; }

.home-capabilities {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--home-line);
}
.home-capabilities h2 {
  margin: 0 0 16px;
  font: 650 20px / 1.25 var(--font-display);
  letter-spacing: -.02em;
}
.cap-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.cap-list li {
  padding-top: 14px;
  border-top: 2px solid #c8c4bc;
  font-size: 14px;
  line-height: 1.55;
  color: var(--home-muted);
}
.cap-list strong {
  display: block;
  margin-bottom: 4px;
  color: var(--home-ink);
  font-weight: 650;
}

.page-home .country-directory {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--home-line);
}
.country-directory-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.country-directory-head h2 {
  margin: 0;
  font: 650 20px / 1.25 var(--font-display);
}
.country-all {
  font-size: 14px;
  font-weight: 600;
  color: var(--home-accent-dark);
  text-decoration: none;
}
.page-home .country-grid {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--home-line);
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.page-home .country-grid a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  min-height: 46px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--home-line);
  color: var(--home-accent-dark);
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
}
.page-home .country-grid a:hover { background: #f5f7fa; }
.page-home .country-grid a span { min-width: 0; overflow-wrap: anywhere; }
.page-home .country-grid a small { flex: 0 0 auto; color: var(--home-muted); font-size: 11px; }

/* The standalone nav routes reuse the homepage workflows and their state model. */
.page-home--editor .home-print-studio,
.page-home--editor .home-capabilities,
.page-home--editor .country-directory,
.page-home--editor .home-faq,
.page-home--print .home-desk,
.page-home--print .home-capabilities,
.page-home--print .country-directory,
.page-home--print .home-faq { display: none; }
.page-home--editor.is-sheet-open .home-print-studio { display: block; }
.page-home--editor .home-print-studio { margin-top: 28px; }
.page-home--print .home-print-studio { margin-top: 0; }
.page-home--print.is-editor-open .home-desk { display: grid; }
.page-home--print.is-editor-open .home-desk { margin-bottom: 28px; }

.page-home .home-faq {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--home-line);
}
.page-home .home-faq h2 {
  margin: 0 0 12px;
  font: 650 20px / 1.25 var(--font-display);
}
.page-home .home-faq details {
  border-top: 1px solid var(--home-line);
  padding: 14px 0;
  font-size: 14px;
}
.page-home .home-faq summary { font-weight: 650; cursor: pointer; }
.page-home .home-faq p { margin: 8px 0 0; max-width: 65ch; color: var(--home-muted); line-height: 1.6; }

.page-home .footer--studio {
  width: var(--page-width);
  border-top: 1px solid var(--home-line);
  font-size: 13px;
}

@media (max-width: 900px) {
  .home-desk { grid-template-columns: 1fr; }
  .home-desk-preview { border-right: 0; border-bottom: 1px solid var(--home-line); }
  .home-intro { grid-template-columns: 1fr; }
  .cap-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-print-layout { grid-template-columns: minmax(0,1fr); }
  .page-home .country-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@container (max-width: 520px) {
  .home-adjustment-grid { grid-template-columns: minmax(0,1fr); gap: 16px; }
}
@media (max-width: 640px) {
  .size-matrix { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cap-list { grid-template-columns: 1fr; }
  .page-home .country-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preview-frame { min-height: 0; width: min(200px, 65%); }
  .home-print-studio { padding: 20px 16px; }
  .home-sheet-source-switch { gap: 8px 16px; }
  .home-sheet-source-switch button { font-size: 12px; }
  .home-desk-controls.picker { padding: 18px; }
  .page-home .home-sheet-preview-wrap { padding: 0; }
  .home-sheet-preview-head { flex-direction: column; gap: 4px; }
  .home-sheet-preview-head span:last-child { text-align: left; }
  .home-print-size { grid-template-columns: minmax(0,1fr) auto; }
  .home-print-size .home-frame-size, .home-print-size .home-remove-size { grid-row: 2; }
  .home-print-size .home-frame-size { grid-column: 1; justify-self: start; }
  .home-print-size .home-remove-size { grid-column: 2; justify-self: end; }
}

/* Home studio layout: one clear work surface, compact controls, and a distinct paper preview. */
.page-home {
  --home-ink: #101f33;
  --home-muted: #53657d;
  --home-line: #dce3ed;
  --home-panel: #fff;
  --home-warm: #f0f2f8;
  --home-accent: #533afd;
  --home-accent-dark: #4434d4;
  --home-control-line: #cbd5e1;
  --home-radius-card: 12px;
  --home-radius-control: 8px;
  --home-card-shadow: 0 1px 2px rgba(16,31,51,.05), 0 1px 3px rgba(16,31,51,.06);
  --home-primary-shadow: 0 1px 2px rgba(83,58,253,.28), 0 2px 6px rgba(83,58,253,.18);
  --home-primary-gradient: linear-gradient(180deg, #6348ff 0%, #533afd 100%);
}

.home-studio {
  max-width: 1180px;
  padding-top: 8px;
}

.home-intro {
  gap: 12px 24px;
  padding: 32px 0 24px;
  border-color: var(--home-line);
}

.home-intro h1 {
  max-width: none;
  color: var(--home-ink);
  font-size: clamp(32px, 3.8vw, 46px);
  letter-spacing: -.03em;
}

.home-intro .lead {
  max-width: 88ch;
  color: var(--home-muted);
  font-size: 15px;
  line-height: 1.6;
}

.home-desk {
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  align-items: stretch;
  margin-top: 24px;
  border: 1px solid var(--home-line);
  border-radius: var(--home-radius-card);
  box-shadow: var(--home-card-shadow);
}

.home-desk-preview {
  min-width: 0;
  padding: 20px 20px 18px;
  background: var(--home-warm);
  border-color: var(--home-line);
  justify-content: flex-start;
}

.preview-chrome { margin-bottom: 8px; }
.preview-label { color: var(--home-ink); font-size: 12px; }
.preview-meta, .preview-foot { color: var(--home-muted); }
.preview-frame {
  box-shadow: 0 4px 14px rgba(16,31,51,.12);
  width: min(264px, 78%);
}

.home-upload {
  min-height: 56px;
  gap: 10px;
  padding: 8px 12px;
  border-color: var(--home-control-line);
  border-radius: var(--home-radius-card);
  background: rgba(255,255,255,.72);
}

.home-upload:hover { border-color: var(--home-accent); background: var(--blue-soft, #f0efff); }
.home-upload--preview { margin-top: 10px; }
.home-desk-preview > .home-file-status { margin: 10px 0 0; min-height: 20px; font-size: 12.5px; line-height: 1.5; }
.home-upload-icon {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  background: var(--home-accent);
  border-radius: var(--home-radius-control);
}
.home-upload-icon svg { width: 17px; height: 17px; }
.home-upload-copy b { color: var(--home-ink); font-size: 13px; }
.home-upload-copy small { color: var(--home-muted); font-size: 11.5px; }
.home-alignment-status { margin-top: 10px; padding: 8px 11px; font-size: 11.5px; line-height: 1.5; }
.home-keyboard-hint { margin-top: 8px; font-size: 12.5px; line-height: 1.5; }
.preview-foot { margin-top: auto; padding-top: 14px; font-size: 12.5px; line-height: 1.55; }

.home-desk-controls.picker {
  min-width: 0;
  padding: 20px;
  gap: 16px;
  container-type: inline-size;
}

.desk-card { padding: 16px 18px 15px; }

.desk-title {
  margin-bottom: 10px;
  color: var(--home-ink);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.home-country-fields { gap: 8px; }
.home-country-fields > label,
.home-framing-controls > label,
.home-sheet-country-preset label,
.home-sheet-size-field > span,
.home-print-field label,
.home-sheet-manual-size > label {
  color: #273951;
  font-size: 12px;
  font-weight: 600;
}

.home-country-fields select,
.home-print-field select,
.home-sheet-country-preset select {
  min-height: 40px;
  border-color: var(--home-control-line);
  border-radius: var(--home-radius-control);
  color: var(--home-ink);
  font-size: 14px;
}

.home-spec-status { min-height: 0; margin: 2px 0 0; color: var(--home-muted); }
.home-adjustment-grid .desk-title { margin-bottom: 8px; color: var(--home-ink); }
.home-adjustment-grid .home-frame-help,
.home-adjustment-grid #home-cutout-hint { color: var(--home-muted); }
.desk-block--background .bg-swatches { flex: 0 1 auto; align-content: start; }

.home-bg-swatches,
.bg-swatches { gap: 8px; }
.bg-swatch {
  min-height: 36px;
  border-color: var(--home-control-line);
  border-radius: var(--home-radius-control);
  color: #273951;
}
.bg-swatch.is-active { border-color: var(--home-accent); background: #f0efff; color: #3021bc; }
.bg-swatch[data-bg="#4385d8"].is-active { background: #4385d8; color: #fff; }
.bg-swatch[data-bg="#d94a50"].is-active { background: #d94a50; color: #fff; }

.home-framing-controls { gap: 8px 12px; }
.home-guide-toggle { color: var(--home-muted); }
.home-guide-toggle input,
.home-framing-controls input[type=range] { accent-color: var(--home-accent); }
.home-nudge-button { border-color: var(--home-control-line); border-radius: var(--home-radius-control); color: #273951; }
.home-nudge-button:hover:not(:disabled) { border-color: #a7a0ee; background: #f6f5ff; }
.home-nudge-readout { color: var(--home-ink); }
.home-alignment-status { border-color: var(--home-line); border-radius: var(--home-radius-control); background: #fff; color: var(--home-muted); }

.home-output-actions { gap: 8px; }
.home-output-actions .home-add-size,
.home-output-actions .home-download-photo {
  min-height: 44px;
  border-radius: var(--home-radius-control);
  font-size: 14px;
  font-weight: 600;
}
.home-output-actions .home-add-size { background: var(--home-primary-gradient); border-color: var(--home-accent); }
.home-output-actions .home-download-photo { background: #fff; border-color: var(--home-control-line); color: #273951; }
.home-export-pixels { margin: 10px 0 0; color: var(--home-muted); font-size: 12px; line-height: 1.45; font-variant-numeric: tabular-nums; }
.home-compress-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.home-compress-mode { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; color: var(--home-ink); font-size: 12.5px; font-weight: 600; }
.home-compress-mode select { flex: 1 1 auto; min-width: 0; height: 40px; padding: 0 10px; border: 1px solid var(--home-control-line); border-radius: var(--home-radius-control); background: var(--home-panel); color: var(--home-ink); font-size: 13px; }
.home-compress-kb { display: inline-flex; align-items: center; gap: 6px; }
.home-compress-kb[hidden] { display: none; }
.home-compress-kb input { width: 84px; height: 40px; padding: 0 10px; border: 1px solid var(--home-control-line); border-radius: var(--home-radius-control); background: var(--home-panel); color: var(--home-ink); font-size: 13px; font-variant-numeric: tabular-nums; }
.home-compress-kb span { color: var(--home-muted); font-size: 12.5px; }
.home-export-size { margin: 6px 0 0; color: var(--home-muted); font-size: 12px; line-height: 1.45; font-variant-numeric: tabular-nums; }

.home-print-studio {
  margin-top: 40px;
  padding: 24px;
  border-color: var(--home-line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 0 #0000;
}

.home-print-intro { max-width: 68ch; margin-bottom: 20px; }
.home-print-intro h2 {
  color: var(--home-ink);
  font-size: clamp(24px, 2.5vw, 30px);
  letter-spacing: -.025em;
}
.home-print-intro > p:last-child { color: var(--home-muted); }

.home-sheet-source-switch {
  display: inline-flex;
  gap: 4px;
  max-width: 100%;
  margin: 0 0 20px;
  padding: 4px;
  border: 1px solid var(--home-line);
  border-radius: 8px;
  background: #f4f6f9;
}

.home-sheet-source-switch button {
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--home-muted);
  font-size: 13px;
}

.home-sheet-source-switch button[aria-pressed="true"] {
  border-color: #dce3ed;
  background: #fff;
  color: #3021bc;
  box-shadow: 0 0 #0000;
}

.home-sheet-source-switch button:disabled { color: #69778b; }

.home-print-layout {
  grid-template-columns: minmax(320px, .9fr) minmax(0, 1.1fr);
  gap: 24px;
  align-items: stretch;
}

.home-print-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 14px 16px;
}

.home-sheet-direct-panel {
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 10px 12px;
}

.home-sheet-upload,
.home-sheet-direct-panel > .home-file-status,
.home-sheet-manual-size,
.home-sheet-confirm,
#home-sheet-dimensions { grid-column: 1 / -1; }

.home-sheet-upload { min-height: 60px; }
.home-sheet-direct-panel > .home-file-status { min-height: 0; margin: -4px 0 0; font-size: 12px; }
.home-sheet-size-field { min-width: 0; gap: 5px; }
.home-sheet-size-field > span { margin: 0; }
.home-sheet-country-preset { min-width: 0; margin: 0; }
.home-sheet-country-preset summary {
  min-height: 40px;
  color: #4434d4;
  font-size: 12px;
}
.home-sheet-country-preset > div {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 8px;
}
.home-sheet-country-preset label:nth-of-type(1) { grid-column: 1; grid-row: 1; }
.home-sheet-country-preset select:nth-of-type(1) { grid-column: 1; grid-row: 2; }
.home-sheet-country-preset label:nth-of-type(2) { grid-column: 2; grid-row: 1; }
.home-sheet-country-preset select:nth-of-type(2) { grid-column: 2; grid-row: 2; }
.home-sheet-country-preset label { font-size: 11px; }
.home-sheet-manual-size input { min-height: 40px; border-radius: 6px; }
.home-sheet-confirm { color: #273951; }

.home-print-field,
.home-print-sizes,
.home-print-status,
.home-sheet-edited-panel,
.home-print-download,
.home-print-controls > .home-print-note { grid-column: 1 / -1; }

.home-print-field { min-width: 0; }
.home-print-field label { margin-bottom: 6px; }
.home-print-field select { min-height: 40px; border-radius: 6px; }
.home-custom-paper-fields[hidden] { display: none; }
.home-custom-paper-fields:not([hidden]) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.home-custom-paper-fields label { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px; margin: 0; color: #273951; font-size: 12px; font-weight: 600; }
.home-custom-paper-fields input { width: 100%; min-width: 0; min-height: 40px; padding: 6px 8px; border: 1px solid var(--home-control-line); border-radius: var(--home-radius-control); color: var(--home-ink); font: inherit; }
.home-paper-help { display: block; margin-top: 8px; color: var(--home-muted); font-size: 11px; line-height: 1.45; }
.home-print-sizes legend { margin-bottom: 8px; color: var(--home-ink); }
.home-print-size-list { gap: 6px; }
.home-print-size { min-height: 54px; border-color: var(--home-line); border-radius: 6px; }
.home-print-size b { color: var(--home-ink); }
.home-print-size small { color: var(--home-muted); }
.home-print-status { min-height: 0; color: var(--home-muted); }
.home-print-download { min-height: 44px; border-radius: var(--home-radius-control); background: var(--home-primary-gradient); border-color: var(--home-accent); }
.home-print-download:hover:not(:disabled) { background: linear-gradient(180deg, #583cf5 0%, var(--home-accent-dark) 100%); border-color: var(--home-accent-dark); }
.home-print-download:disabled { border-color: #d6dbe4; background: #e9edf3; color: #536176; }
.home-print-note { color: #53657d; }
.home-paper-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 10px; font-size: 12.5px; }
.home-paper-links-label { color: var(--home-muted); }
.home-paper-links a { color: var(--home-accent-dark); text-decoration: none; padding: 3px 10px; border: 1px solid var(--home-line); border-radius: 6px; background: var(--home-panel); }

/* ID-photo previews are measurement canvases: keep every edge square and
   remove decorative depth so the displayed crop stays visually exact. */
.preview-frame,
.preview-frame img,
.preview-frame canvas {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  filter: none;
}
.home-paper-links a:hover { border-color: var(--home-accent); background: var(--blue-soft); }
.home-paper-links a[aria-current="page"] { color: var(--home-accent-dark); background: var(--blue-soft); border-color: var(--home-accent); font-weight: 600; }

.home-sheet-preview-wrap {
  align-self: stretch;
  padding: 16px;
  border-radius: 8px;
  background: #f0f2f8;
}
.home-sheet-preview-head { margin-bottom: 12px; color: var(--home-ink); }
.home-sheet-preview-head span:last-child { color: var(--home-muted); }
.home-sheet-example,
#home-sheet-preview {
  border: 1px solid var(--home-control-line);
  border-radius: 0;
  background: #fff;
  box-shadow: 0 0 #0000;
}
.home-sheet-legend { color: var(--home-muted); }

@media (max-width: 900px) {
  .home-desk { grid-template-columns: minmax(0, 1fr); }
  .home-desk-preview { border-right: 0; border-bottom: 1px solid var(--home-line); }
  .home-print-layout { grid-template-columns: minmax(0, 1fr); }
  .home-print-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-sheet-preview-wrap { padding: 16px; }
}

@media (max-width: 640px) {
  .home-intro { padding: 24px 0 20px; }
  .home-intro h1 { max-width: 18ch; font-size: 34px; }
  .home-desk-preview { padding: 16px; }
  .home-desk-controls.picker { padding: 20px 16px; gap: 18px; }
  .home-print-studio { margin-top: 32px; padding: 20px 16px; }
  .home-sheet-source-switch { display: flex; width: fit-content; max-width: 100%; flex-wrap: wrap; }
  .home-sheet-source-switch button { padding-inline: 10px; }
  .home-print-controls,
  .home-sheet-direct-panel { grid-template-columns: minmax(0, 1fr); }
  .home-sheet-direct-panel > *,
  .home-print-controls > * { grid-column: 1; }
  .home-sheet-country-preset > div { grid-template-columns: minmax(0, 1fr); }
  .home-sheet-country-preset label:nth-of-type(1),
  .home-sheet-country-preset select:nth-of-type(1),
  .home-sheet-country-preset label:nth-of-type(2),
  .home-sheet-country-preset select:nth-of-type(2) { grid-column: 1; grid-row: auto; }
  .home-custom-paper-fields:not([hidden]) { grid-template-columns: minmax(0, 1fr); }
  .home-sheet-preview-wrap { padding: 12px; }
  .home-output-actions .home-add-size,
  .home-output-actions .home-download-photo {
    padding-inline: 6px;
    font-size: 12px;
    overflow-wrap: normal;
  }
}

/* Country document pages share the editor and print workspace used on the home page. */
.page-home--country .country-breadcrumbs { margin: 8px 0 20px; }
.page-home--country .country-breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.page-home--country .country-breadcrumbs li { color: var(--home-muted); font-size: 12px; }
.page-home--country .country-breadcrumbs li + li::before { content: "/"; margin-right: 8px; color: #8b95a5; }
.page-home--country .country-breadcrumbs a { color: #405879; text-decoration: none; text-underline-offset: 3px; }
.page-home--country .country-breadcrumbs a:hover { text-decoration: underline; }
.country-spec-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 20px 0 0; border: 1px solid #d8deea; border-radius: 8px; background: #fff; }
.country-spec-strip > div { min-width: 0; padding: 13px 16px; }
.country-spec-strip > div + div { border-left: 1px solid #e1e5ed; }
.country-spec-strip dt { color: #58677c; font-size: 12px; }
.country-spec-strip dd { margin: 5px 0 0; color: #17263c; font-size: 14px; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.size-spec-strip { grid-template-columns: minmax(0, 1fr); }
.size-spec-strip > div + div { border-left: 0; }
.country-reference { margin-top: 32px; padding: 24px 0 0; border-top: 1px solid var(--home-line); }
.country-reference-heading h2 { margin: 0; color: var(--home-ink); font: 650 22px/1.25 var(--font-display); letter-spacing: -.025em; }
.country-reference-heading p { margin: 6px 0 0; color: var(--home-muted); font-size: 13px; }
.country-reference-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .38fr); gap: 28px; margin-top: 18px; }
.country-spec-table { width: 100%; border-collapse: collapse; }
.country-spec-table th, .country-spec-table td { padding: 11px 12px; border-bottom: 1px solid #e0e5ee; text-align: left; vertical-align: top; font-size: 13px; line-height: 1.45; }
.country-spec-table th { width: 34%; color: #53647a; font-weight: 550; }
.country-spec-table td { color: #17263c; overflow-wrap: anywhere; }
.country-sources { padding-left: 20px; border-left: 1px solid #dce2ec; }
.country-sources h3 { margin: 0 0 10px; color: #17263c; font: 650 14px/1.35 var(--font-display); }
.country-sources ul { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.country-sources li { display: grid; gap: 3px; color: #344a67; font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.country-sources a { color: #315e9d; text-underline-offset: 3px; }
.country-sources small { color: #5b6879; font-size: 11px; }
.country-sources > p { margin: 16px 0 0; color: #53647a; font-size: 12px; line-height: 1.55; }
.country-related { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 22px; padding-top: 14px; border-top: 1px solid #e0e5ee; }
.country-related a { color: #315e9d; font-size: 13px; text-decoration: none; text-underline-offset: 3px; }
.country-related a:hover { text-decoration: underline; }
.page-home--country .home-capabilities,
.page-home--country .country-directory,
.page-home--country .home-faq { display: none; }
@media (max-width: 900px) {
  .country-spec-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .country-spec-strip > div:nth-child(3) { border-left: 0; border-top: 1px solid #e1e5ed; }
  .country-spec-strip > div:nth-child(4) { border-top: 1px solid #e1e5ed; }
  .country-reference-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .country-sources { padding: 16px 0 0; border-left: 0; border-top: 1px solid #dce2ec; }
}
@media (max-width: 520px) {
  .page-home--country .country-breadcrumbs { margin-top: 4px; }
  .country-spec-strip > div { padding: 11px 12px; }
  .country-reference { margin-top: 24px; padding-top: 20px; }
  .country-spec-table th, .country-spec-table td { padding: 9px 8px; font-size: 12px; }
  .country-spec-table th { width: 38%; }
  .country-related { gap: 8px 14px; }
}

/* ---------------------------------------------------------------------------
   Unified control surface: home / editor / country share this partial.
   Tighten spacing, align control heights to the shared design tokens, and
   stop color swatches / nudge pad from stretching the column vertically.
   --------------------------------------------------------------------------- */
.home-desk-controls.picker {
  gap: 18px;
}

.home-adjustment-grid {
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 16px;
  padding: 0;
}

.desk-block--framing,
.desk-block--background {
  gap: 10px;
}

.home-adjustment-grid .desk-title {
  margin-bottom: 2px;
}

.home-adjustment-grid .home-frame-help,
.home-adjustment-grid #home-cutout-hint {
  margin: 0;
  max-width: 36ch;
}

/* Country / document field rhythm: label close to its control, one shared height. */
.home-country-fields {
  gap: 4px 8px;
}

.home-country-fields > label {
  margin: 2px 0 0;
}

.home-country-fields .cs-trigger,
.home-sheet-size-field .cs-trigger,
.home-sheet-country-preset .cs-trigger,
.home-print-field .cs-trigger {
  min-height: 40px;
}

.home-spec-status {
  margin-top: 4px;
}

/* Framing controls: compact, single consistent vertical rhythm. */
.home-framing-controls {
  gap: 10px 12px;
  align-content: start;
}

.home-framing-controls label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.home-position-tools {
  flex: 0 0 auto;
  gap: 8px;
  min-height: 0;
}

.home-nudge-pad {
  flex: 0 0 auto;
  grid-template-columns: 36px 84px 36px;
  grid-template-rows: 36px 36px 36px;
  gap: 5px;
}

.home-nudge-button {
  width: 36px;
  height: 36px;
  border-radius: var(--home-radius-control);
}

.home-nudge-button svg {
  width: 16px;
  height: 16px;
}

.home-nudge-readout {
  width: 84px;
  min-height: 34px;
}

.home-nudge-help {
  margin: 0;
}

.home-reset-frame {
  justify-self: end;
  margin-top: 2px;
  padding: 7px 12px;
  border-radius: var(--home-radius-control);
}

/* Background swatches: natural height, no space-between stretch. */
.bg-swatches {
  flex: 0 1 auto;
  align-content: start;
  gap: 8px;
}

.bg-swatch {
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--home-radius-control);
}

.home-bg-custom {
  min-height: 40px;
  padding: 0 12px;
}

.home-bg-custom input[type="color"] {
  width: 24px;
  height: 24px;
  min-height: 24px;
  border-radius: 5px;
}

/* Export actions: one shared button height. */
.home-output-actions {
  gap: 10px;
}

.home-output-actions .home-add-size,
.home-output-actions .home-download-photo {
  min-height: var(--btn-h);
  border-radius: var(--home-radius-control);
}

/* Shared control state polish, aligned to a standard control library:
   hover lightens, active presses back slightly, focus ring is the soft brand ring. */
.home-output-actions .home-add-size:not(:disabled):active,
.home-print-download:not(:disabled):active {
  transform: scale(.985);
}

.home-output-actions .home-download-photo:not(:disabled):hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.home-reset-frame:not(:disabled):hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.home-reset-frame:not(:disabled):active {
  transform: scale(.97);
}

/* Number / text inputs used for manual dimensions and custom paper. */
.home-manual-dimensions input,
.home-sheet-manual-size input,
.home-custom-paper-fields input {
  min-height: 38px;
  border: 1px solid var(--home-control-line);
  border-radius: var(--home-radius-control);
  background: #fff;
  color: var(--home-ink);
  font: inherit;
  font-size: 13px;
  padding: 6px 9px;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.home-manual-dimensions input:hover:not(:disabled),
.home-sheet-manual-size input:hover:not(:disabled),
.home-custom-paper-fields input:hover:not(:disabled) {
  border-color: #94a3b8;
}

.home-manual-dimensions input:focus,
.home-sheet-manual-size input:focus,
.home-custom-paper-fields input:focus {
  outline: none;
  border-color: var(--home-accent);
  box-shadow: 0 0 0 3px var(--blue-soft, #f0efff);
}

.home-manual-dimensions input:disabled,
.home-sheet-manual-size input:disabled {
  background: #f1f3f5;
  color: #788393;
  cursor: not-allowed;
}

@media (max-width: 520px) {
  .home-adjustment-grid { gap: 16px; }
  .home-size-presets { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

/* ---------------------------------------------------------------------------
   Custom select: a hidden native <select> keeps the form/accessibility contract;
   a styled wrapper renders the trigger button and the option pop-up.
   --------------------------------------------------------------------------- */
.cs-select {
  position: relative;
  width: 100%;
}

.cs-select select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  margin: 0;
  padding: 0;
  border: 0;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  cursor: pointer;
}

.cs-select select:disabled { cursor: not-allowed; }

/* The hidden native select must never show the global purple focus ring;
   the trigger owns the visible focus treatment. */
.cs-select select:focus-visible { outline: none; }

.cs-trigger {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--home-control-line);
  border-radius: var(--home-radius-control);
  background: #fff;
  color: var(--home-ink);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.cs-trigger:hover:not(:disabled) { border-color: #94a3b8; background: #f8fafc; }

.cs-trigger.is-focus:not(:disabled) {
  border-color: var(--home-accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--blue-soft, #f0efff);
}

.cs-trigger.is-open {
  border-color: var(--home-accent);
  box-shadow: 0 0 0 3px var(--blue-soft, #f0efff);
}

.cs-trigger:disabled,
.cs-select.is-disabled .cs-trigger {
  background: #f1f3f5;
  color: #788393;
  cursor: not-allowed;
}

.cs-trigger__value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cs-trigger__value.is-placeholder { color: #8a95a5; }

.cs-trigger__chevron {
  position: absolute;
  inset-inline-end: 10px;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: #64748b;
  transition: transform 150ms ease;
}

.cs-trigger__chevron svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.cs-select.is-open .cs-trigger__chevron { transform: rotate(180deg); }

.cs-pop {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 232px;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--home-line);
  border-radius: var(--home-radius-card);
  background: #fff;
  box-shadow:
    0 2px 8px rgba(16, 31, 51, .06),
    0 -6px 12px rgba(16, 31, 51, .03),
    0 14px 28px rgba(16, 31, 51, .10);
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
}

.cs-select.is-open .cs-pop {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.cs-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--home-ink);
  cursor: pointer;
  transition: background-color 100ms ease;
}

.cs-option.is-placeholder { color: #8a95a5; }

.cs-option:hover,
.cs-option.is-hover { background: var(--blue-soft, #f0efff); }

.cs-option.is-selected {
  background: var(--blue-soft, #f0efff);
  color: var(--home-accent-dark, #4434d4);
  font-weight: 600;
}

.cs-option__meta {
  flex: 0 0 auto;
  color: var(--home-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.cs-option.is-selected .cs-option__meta { color: var(--home-accent-dark, #4434d4); }

.cs-option.is-disabled {
  color: #9aa4b2;
  cursor: not-allowed;
}

/* Native select reset: remove the OS arrow so the custom chevron owns it. */
.home-country-fields select,
.home-print-field select,
.home-sheet-country-preset select {
  appearance: none;
  -webkit-appearance: none;
  background-image: none;
}
