:root {
  --bg: #f4f3ee;
  --ink: #171717;
  --muted: #68645d;
  --line: #d9d5cb;
  --panel: #ffffff;
  --accent: #d4212a;
  --accent-dark: #a9151d;
  --shadow: 0 24px 70px rgba(24, 24, 24, .12);
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

textarea,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
}

.preview-area {
  padding: 32px clamp(18px, 4vw, 58px);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

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

.eyebrow {
  color: var(--accent);
  display: block;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 10px;
}

h1 {
  margin: 0;
  max-width: 680px;
  font-size: clamp(34px, 5vw, var(--hero-size, 78px));
  line-height: .92;
  letter-spacing: 0;
}

.ghost-button,
.primary-button,
.secondary-button {
  min-height: 44px;
  border-radius: 6px;
  border: 1px solid var(--line);
  padding: 0 18px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.ghost-button {
  background: transparent;
  color: var(--ink);
}

.stage-wrap {
  position: relative;
  flex: 1;
  min-height: 520px;
  display: grid;
  place-items: center;
}

#capCanvas {
  width: auto;
  height: auto;
  max-width: min(100%, 1040px);
  max-height: calc(100vh - 210px);
  aspect-ratio: 1402 / 1122;
  display: block;
  cursor: grab;
  object-fit: contain;
  filter: drop-shadow(0 28px 34px rgba(39, 36, 30, .13));
}

#capCanvas.dragging {
  cursor: grabbing;
}

.drag-hint {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, .86);
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 999px;
  padding: 8px 14px;
  color: #34302b;
  font-size: 13px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .08);
  pointer-events: none;
}

.drag-hint.hidden {
  opacity: 0;
}

.config-panel {
  min-height: 100vh;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

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

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-heading span,
.controls-grid span,
.toggle,
dt,
.summary p {
  color: var(--muted);
  font-size: 14px;
}

.section-heading strong {
  font-size: 14px;
}

.swatches {
  display: grid;
  grid-template-columns: repeat(7, 38px);
  gap: 10px;
}

.swatch {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, .18);
  cursor: pointer;
  position: relative;
}

.swatch[aria-checked="true"]::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 2px solid var(--accent);
  border-radius: 50%;
}

.upload-box {
  min-height: 116px;
  border: 1px dashed #b7b0a2;
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
  cursor: pointer;
  background: #fbfaf7;
}

.upload-box input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.upload-box span {
  font-weight: 800;
  margin-bottom: 4px;
}

.upload-box small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.sample-logos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.sample-logos button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.techniques {
  display: grid;
  gap: 10px;
}

.tech-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  cursor: pointer;
}

.tech-card[aria-checked="true"] {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.tech-card strong,
.tech-card b {
  font-size: 14px;
}

.tech-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  grid-column: 1 / -1;
}

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

.controls-grid label {
  display: grid;
  gap: 8px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.options {
  display: grid;
  gap: 12px;
}

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

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.summary {
  border-bottom: 0;
  padding-bottom: 0;
}

.hidden {
  display: none !important;
}

.admin-login {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.admin-login input {
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
}

.admin-login button,
.admin-buttons button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.admin-controls {
  display: grid;
  gap: 12px;
}

.admin-controls label {
  display: grid;
  gap: 7px;
}

.admin-controls span {
  color: var(--muted);
  font-size: 13px;
}

.admin-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.admin-edit-grid {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.admin-edit-grid label:has(textarea) {
  grid-column: 1 / -1;
}

.admin-controls input:not([type="range"]),
.admin-controls select,
.admin-controls textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.admin-controls input[type="color"] {
  min-height: 44px;
  padding: 4px;
}

.admin-controls textarea {
  padding: 10px;
  resize: vertical;
}

.admin-layout-tools {
  display: none;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 12px;
}

.layout-mode .admin-layout-tools {
  display: flex;
}

.admin-layout-tools button,
.admin-order-row button,
.admin-controls > button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.admin-order-list {
  display: grid;
  gap: 8px;
}

.admin-order-row {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-order-row span {
  display: flex;
  gap: 6px;
}

.pricing-admin {
  display: grid;
  gap: 18px;
}

.compact-heading {
  margin-bottom: 8px;
}

.compact-heading button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.price-tier-list {
  display: grid;
  gap: 8px;
}

.price-tier-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.price-tier-row label {
  display: grid;
  gap: 6px;
}

.price-tier-row span {
  color: var(--muted);
  font-size: 13px;
}

.price-tier-row input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
}

.price-tier-row button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.admin-page {
  min-height: 100vh;
}

.admin-shell {
  width: 100%;
  margin: 0 auto;
  padding: 34px 18px;
  display: grid;
  gap: 18px;
}

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.admin-header h1 {
  font-size: clamp(36px, 7vw, 74px);
}

.admin-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 16px 46px rgba(24, 24, 24, .08);
}

.admin-login-wide {
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 1fr) auto;
}

.admin-preview-stage {
  position: relative;
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
}

.admin-preview-image {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
}

.admin-print-area {
  position: absolute;
  border: 2px dashed var(--accent);
  border-radius: 8px;
  background: rgba(212, 33, 42, .1);
  box-shadow: 0 0 0 9999px rgba(255, 255, 255, .18);
  cursor: move;
  touch-action: none;
}

.admin-print-area.dragging {
  background: rgba(212, 33, 42, .18);
  border-style: solid;
}

dl {
  margin: 0 0 14px;
  display: grid;
  gap: 10px;
}

dl div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

.summary p {
  line-height: 1.5;
  margin: 0 0 18px;
}

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

.primary-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 800;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  color: var(--ink);
  background: #fff;
}

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

  .preview-area {
    min-height: auto;
    padding-bottom: 12px;
  }

  .stage-wrap {
    min-height: 340px;
  }

  #capCanvas {
    max-height: none;
  }

  .config-panel {
    min-height: auto;
    border-left: 0;
    border-top: 1px solid var(--line);
    box-shadow: 0 -16px 40px rgba(24, 24, 24, .08);
  }
}

@media (max-width: 560px) {
  .preview-area,
  .config-panel {
    padding-left: 18px;
    padding-right: 18px;
  }

  .brand-row {
    align-items: center;
  }

  .top-actions {
    flex-direction: column;
  }

  h1 {
    font-size: 36px;
  }

  .ghost-button {
    min-width: 72px;
    padding: 0 12px;
  }

  .swatches {
    grid-template-columns: repeat(7, 34px);
    gap: 8px;
  }

  .swatch {
    width: 34px;
    height: 34px;
  }

  .sample-logos {
    grid-template-columns: 1fr;
  }

  .admin-header,
  .admin-login-wide,
  .admin-edit-grid,
  .price-tier-row {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .admin-login-wide {
    display: grid;
  }
}
