:root {
  --background: #f7fafc;
  --surface: #ffffff;
  --surface-low: #f1f4f6;
  --surface-high: #e5e9eb;
  --ink: #181c1e;
  --muted: #44474c;
  --line: #c4c6cd;
  --line-soft: #d7dadc;
  --navy: #041627;
  --navy-soft: #1a2b3c;
  --green: #1b6d24;
  --green-bg: #a0f399;
  --red: #ba1a1a;
  --red-bg: #ffdad6;
  --amber: #773200;
  --amber-bg: #ffdbca;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--ink);
  font: 14px/1.45 Arial, sans-serif;
}
body::before {
  position: fixed;
  inset: 64px 0 0;
  z-index: -1;
  opacity: .32;
  background-image: radial-gradient(var(--line-soft) 1px, transparent 1px);
  background-size: 24px 24px;
  content: "";
}
h1, h2, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { color: inherit; font: inherit; }
button { cursor: pointer; }

.appbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-height: 64px;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding: 0 max(16px, calc((100vw - 1380px) / 2));
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--navy);
  font-size: 23px;
  font-weight: 700;
}
.barcode-mark {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-left: 3px solid var(--navy);
  border-right: 2px solid var(--navy);
  background: repeating-linear-gradient(90deg, var(--navy) 0 2px, transparent 2px 4px);
}
.workspace-name {
  border-left: 1px solid var(--line);
  padding-left: 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.appbar nav {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
.appbar nav a {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  border-radius: 4px;
  padding: 0 13px;
  color: var(--muted);
  font-weight: 600;
}
.appbar nav a:hover { background: var(--surface-low); color: var(--navy); }
.appbar .nav-action {
  border: 1px solid var(--line);
  color: var(--navy);
}

.studio {
  max-width: 1380px;
  margin: 0 auto;
  padding: 26px 16px 42px;
}
.studio-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
}
.studio-heading > div { display: grid; gap: 9px; }
.tag {
  width: fit-content;
  border-radius: 3px;
  background: var(--green-bg);
  padding: 5px 9px;
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.studio-heading h1 {
  max-width: 720px;
  color: var(--navy);
  font-size: 31px;
  line-height: 1.18;
}
.studio-heading > p {
  max-width: 360px;
  color: var(--muted);
}

.studio-shell {
  display: grid;
  grid-template-columns: minmax(460px, 1fr) 306px;
  gap: 14px;
  align-items: start;
}
.tools-panel,
.canvas-panel,
.inspector-panel section {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}
.tools-panel {
  grid-column: 1 / -1;
  display: flex;
  min-height: 92px;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
}
.tools-panel section {
  display: grid;
  min-width: max-content;
  gap: 8px;
  align-content: start;
  padding: 11px 13px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 0;
}
.tools-panel section:last-child { border-right: 0; }
.setup-group { width: 250px; }
.insert-group { width: 300px; }
h2 { color: var(--navy); font-size: 16px; }
.field { display: grid; gap: 6px; }
.field span,
.section-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  padding: 9px 10px;
}
.field input,
.field select { min-height: 42px; }
.field input[type="color"] {
  width: 42px;
  min-height: 38px;
  padding: 4px;
  cursor: pointer;
}
.field textarea { resize: vertical; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--navy);
  outline: 1px solid var(--navy);
}
.mono input { font-family: "Courier New", Consolas, monospace; }
.quiet-action {
  justify-self: start;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}
.color-control {
  display: flex;
  align-items: center;
  gap: 9px;
}
.color-swatches {
  display: flex;
  gap: 6px;
}
.color-swatches button {
  width: 26px;
  height: 26px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 0 1px var(--line);
}
.color-swatches button:hover,
.color-swatches button:focus {
  box-shadow: 0 0 0 2px var(--navy);
  outline: none;
}
.quiet { color: var(--muted); font-size: 12px; }
.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(58px, 1fr));
  gap: 5px;
}
.tool-grid button,
.tool-upload {
  display: grid;
  justify-items: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface-low);
  padding: 8px 5px;
  color: var(--navy);
  font-size: 11px;
  font-weight: 600;
}
.tool-grid button span,
.tool-upload span {
  color: var(--navy);
  font-size: 18px;
  font-weight: 700;
}
.tool-upload { cursor: pointer; }
.tool-upload input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.barcode-tool { width: 230px; background: var(--surface); }
.barcode-tool strong { color: var(--navy); }
.insert-picker {
  display: grid;
  gap: 5px;
}
.insert-picker button {
  display: grid;
  gap: 2px;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: var(--surface);
  padding: 8px 9px;
  color: var(--navy);
  text-align: left;
}
.insert-picker button:hover,
.insert-picker button:focus-visible {
  border-color: var(--navy);
  background: var(--surface-low);
}
.insert-picker small { color: var(--muted); font-size: 11px; }
.safety { width: 205px; background: var(--surface-low); }
.safety details { display: grid; gap: 8px; }
.safety summary,
.inspector-fold > summary,
.font-access > summary {
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  list-style-position: outside;
}
.safety summary:hover,
.inspector-fold > summary:hover,
.font-access > summary:hover { color: var(--green); }
.safety strong { color: var(--navy); }
.safety p:last-child { color: var(--muted); font-size: 12px; }

.canvas-panel { padding: 13px; }
.canvas-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.canvas-meta {
  display: grid;
  gap: 4px;
}
.draft-status {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: none;
}
.draft-status.saved { color: var(--green); }
.draft-status.fail { color: var(--red); }
.canvas-meta #canvas-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.canvas-actions { display: flex; gap: 7px; }
.canvas-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  padding: 0 13px;
  color: var(--navy);
  font-weight: 700;
}
.canvas-actions .primary {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
}
.canvas-actions .canvas-barcode-action {
  border-color: var(--navy);
  color: var(--navy);
}
.canvas-actions .canvas-barcode-action.empty {
  background: var(--navy);
  color: #fff;
}
.canvas-actions .icon-action {
  width: 38px;
  padding: 0;
  font-size: 19px;
}
.canvas-actions button:disabled {
  opacity: .4;
  cursor: not-allowed;
}
.zoom-control {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.zoom-control input { width: 72px; accent-color: var(--navy); }
.zoom-control output { min-width: 34px; color: var(--navy); }
.canvas-workspace {
  position: relative;
  display: grid;
  min-height: 700px;
  place-items: center;
  overflow: auto;
  border: 1px solid var(--line-soft);
  background: var(--surface-low);
  padding: 24px;
}
.canvas-empty-prompt {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 2;
  display: grid;
  width: min(272px, calc(100% - 36px));
  gap: 7px;
  border: 1px solid var(--navy);
  border-radius: 4px;
  background: var(--surface);
  padding: 12px;
  box-shadow: 0 4px 14px rgba(4, 22, 39, .12);
}
.canvas-empty-prompt[hidden] { display: none; }
.canvas-empty-prompt strong { color: var(--navy); }
.canvas-empty-prompt p { color: var(--muted); font-size: 12px; }
.canvas-empty-prompt button {
  min-height: 38px;
  border: 1px solid var(--navy);
  border-radius: 3px;
  background: var(--navy);
  color: #fff;
  font-weight: 700;
}
.insert-popover-backdrop {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  background: rgba(4, 22, 39, .15);
  padding: 18px;
}
.insert-popover-backdrop[hidden] { display: none; }
.insert-popover {
  display: grid;
  width: min(410px, 100%);
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  padding: 17px;
  box-shadow: 0 16px 38px rgba(4, 22, 39, .22);
}
.insert-popover-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
}
.insert-popover-head > div { display: grid; gap: 5px; }
.insert-popover-head h2 { color: var(--navy); font-size: 19px; }
.popover-close {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: var(--surface);
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}
.popover-close:hover { border-color: var(--navy); color: var(--navy); }
#label-canvas {
  display: block;
  background: #fff;
  box-shadow: 0 2px 10px rgba(4, 22, 39, .1);
  touch-action: none;
}
.canvas-help {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.inspector-panel { display: grid; gap: 12px; }
.inspector-panel section { display: grid; gap: 12px; padding: 15px; }
.inspector-fold {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line-soft);
  padding-top: 10px;
}
.inspector-fold:first-of-type { border-top: 0; padding-top: 0; }
.inspector-fold[open] > summary { margin-bottom: 10px; }
.inspector-fold > summary {
  display: list-item;
  min-height: 28px;
  align-content: center;
}
.inspector-fold:not([open]) > summary {
  color: var(--muted);
}
.section-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.danger-link {
  border: 0;
  background: transparent;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
}
.selected-name {
  border: 1px solid var(--line-soft);
  background: var(--surface-low);
  padding: 9px;
  color: var(--navy);
  font-weight: 600;
}
.edit-actions,
.align-actions {
  display: grid;
  gap: 5px;
}
.edit-actions { grid-template-columns: 1.2fr 1fr 1fr; }
.align-actions { grid-template-columns: repeat(3, 1fr); }
.edit-actions button,
.align-actions button {
  min-height: 34px;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: var(--surface);
  color: var(--navy);
  font-size: 12px;
  font-weight: 600;
}
.edit-actions button:hover,
.align-actions button:hover {
  border-color: var(--navy);
  background: var(--surface-low);
}
.edit-actions button:disabled,
.align-actions button:disabled {
  opacity: .42;
  cursor: not-allowed;
}
.control-group { display: grid; gap: 11px; }
.font-access {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: var(--surface-low);
  padding: 8px;
  color: var(--muted);
  font-size: 11px;
}
.font-access > div {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}
.font-request {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
}
.font-request button {
  min-height: 38px;
  border: 1px solid var(--navy);
  border-radius: 3px;
  background: var(--navy);
  padding: 0 10px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
}
.status {
  border-radius: 3px;
  background: var(--surface-low);
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
}
.status.pass { background: rgba(160, 243, 153, .32); color: var(--green); }
.status.fail { background: var(--red-bg); color: var(--red); }
.size-check {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: var(--surface-low);
  padding: 9px;
  color: var(--muted);
  font-size: 12px;
}
.size-check[hidden] { display: none; }
.size-check.pass { border-color: rgba(27, 109, 36, .28); background: rgba(160, 243, 153, .18); }
.size-check.review { border-color: rgba(119, 50, 0, .25); background: var(--amber-bg); color: var(--amber); }
.size-check.fail { border-color: rgba(186, 26, 26, .25); background: var(--red-bg); color: var(--red); }
.size-check-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: currentColor;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.size-check strong { color: currentColor; font-size: 13px; }
.size-tip {
  position: relative;
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
  cursor: help;
}
.size-tooltip {
  position: absolute;
  right: -4px;
  bottom: calc(100% + 8px);
  z-index: 2;
  display: none;
  width: 252px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--navy);
  padding: 9px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.45;
  text-transform: none;
}
.size-tip:hover .size-tooltip,
.size-tip:focus .size-tooltip { display: block; }
.lock-toggle {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--navy);
  font-size: 12px;
  font-weight: 600;
}
.lock-toggle input { accent-color: var(--navy); }
.proof-target {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: var(--surface-low);
  padding: 9px;
}
.proof-target button {
  min-height: 34px;
  border: 1px solid var(--navy);
  border-radius: 3px;
  background: var(--surface);
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
}
#layers-list { display: grid; gap: 5px; }
.layer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 5px;
}
.layer-button {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: var(--surface);
  padding: 9px;
  text-align: left;
}
.layer-button.active {
  border-color: var(--navy);
  background: var(--surface-low);
}
.layer-button small { color: var(--muted); text-transform: capitalize; }
.layer-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: var(--surface);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}
.layer-delete:hover,
.layer-delete:focus-visible {
  border-color: var(--red);
  color: var(--red);
}
.readiness { background: var(--surface-low) !important; }
.readiness strong { color: var(--navy); }
.readiness p:not(.section-label) { color: var(--muted); font-size: 12px; }
.readiness a {
  width: fit-content;
  border-bottom: 1px solid var(--navy);
  color: var(--navy);
  font-weight: 700;
}
.proof-upload {
  display: grid;
  justify-items: center;
  gap: 5px;
  border: 1px dashed var(--line);
  border-radius: 3px;
  background: var(--surface);
  padding: 12px 8px;
  text-align: center;
}
.proof-upload span {
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
}
.proof-upload small { color: var(--muted); }
.proof-upload b {
  display: inline-flex;
  min-height: 31px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 10px;
  color: var(--navy);
  font-size: 11px;
  text-transform: uppercase;
}
.proof-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.proof-action {
  min-height: 42px;
  border: 1px solid var(--navy);
  border-radius: 3px;
  background: var(--navy);
  color: #fff;
  font-weight: 700;
}
.proof-action:disabled { opacity: .55; cursor: wait; }
.production-report {
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: var(--surface);
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
}
.production-report h3 {
  margin: 0 0 5px;
  color: var(--navy);
  font-size: 14px;
}
.production-report.pass { border-left: 3px solid var(--green); }
.production-report.pass h3 { color: var(--green); }
.production-report.fail { border-left: 3px solid var(--red); }
.production-report.fail h3 { color: var(--red); }
.production-report.review { border-left: 3px solid var(--amber); }
.production-downloads {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.production-downloads button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  color: var(--navy);
  font-weight: 700;
}

@media (max-width: 1120px) {
  .studio-heading { display: grid; }
  .studio-shell { grid-template-columns: 1fr; }
  .tools-panel { grid-column: auto; }
  .canvas-panel { order: 1; }
  .tools-panel { order: 2; }
  .inspector-panel { order: 3; }
}
@media (max-width: 760px) {
  .appbar { flex-wrap: wrap; padding-block: 10px; }
  .workspace-name, .appbar nav a[href="/migration-studio.html"] { display: none; }
  .studio-heading h1 { font-size: 27px; }
  .canvas-workspace { min-height: 550px; padding: 10px; }
  .canvas-actions { flex-wrap: wrap; }
}
