:root {
  --ink: #171622;
  --muted: #6e6a7d;
  --line: #dedbe6;
  --wash: #f5f4f8;
  --pink: #d92f68;
  --pink-bright: #f25287;
  --pink-dark: #d83a72;
  --green: #4f9f69;
  --panel: 300px;
  --props: 290px;
  --header: 64px;
  --mobilebar: 68px;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  color: var(--ink);
  background: var(--wash);
  overscroll-behavior: none;
}
button,
input,
select,
textarea {
  font: inherit;
}
.app-header {
  height: var(--header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 20;
}
.header-left,
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand img {
  height: 40px;
  max-width: 180px;
  object-fit: contain;
}
.brand-fallback {
  font-weight: 900;
  letter-spacing: 0.06em;
}
.design-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.design-title {
  border: 0;
  font-weight: 800;
  font-size: 1rem;
  width: min(32vw, 320px);
  padding: 8px;
  border-radius: 8px;
}
.design-title:focus {
  outline: 2px solid rgba(242, 82, 135, 0.25);
}
.save-state {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}
.btn,
.icon-btn,
.workspace-topbar button,
.tool,
.button-grid button,
.layer-actions button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 9px;
  cursor: pointer;
}
.btn {
  padding: 10px 16px;
  font-weight: 800;
}
.btn.primary {
  background: var(--pink);
  border-color: var(--pink);
  color: #fff;
}
.btn.primary:hover {
  background: var(--pink-dark);
}
.btn.secondary {
  background: #fff;
}
.btn.full {
  width: 100%;
  margin-top: 12px;
}
.icon-btn {
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
}
.designer-shell {
  height: calc(100dvh - var(--header));
  display: grid;
  grid-template-columns: 74px var(--panel) minmax(0, 1fr) var(--props);
  overflow: hidden;
}
.tool-rail {
  background: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  z-index: 12;
}
.tool {
  min-height: 58px;
  color: #fff;
  background: transparent;
  border: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.tool span {
  font-size: 1.4rem;
}
.tool small {
  font-size: 0.68rem;
}
.tool:hover,
.tool.active {
  background: var(--pink);
}
.side-panel,
.properties-panel {
  background: #fff;
  overflow: auto;
  border-right: 1px solid var(--line);
  z-index: 11;
}
.properties-panel {
  border-right: 0;
  border-left: 1px solid var(--line);
}
.panel-head {
  height: 54px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
}
.panel-head h2 {
  font-size: 1rem;
  margin: 0;
}
.panel-content,
.properties-panel > div:not(.panel-head) {
  padding: 14px;
}
.panel-view {
  display: none;
}
.panel-view.active {
  display: block;
}
.welcome-card,
.check-card,
.notice,
.empty-state {
  padding: 14px;
  border-radius: 12px;
  background: var(--wash);
  margin-bottom: 12px;
}
.welcome-card p,
.hint {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.45;
}
.element-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}
.element-grid button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 12px 8px;
  min-height: 86px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}
.element-grid button:hover {
  border-color: var(--pink);
  background: #fff7fa;
}
.shape-preview {
  display: block;
  width: 38px;
  height: 30px;
  background: var(--pink);
}
.shape-preview.round {
  border-radius: 10px;
}
.shape-preview.circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}
.shape-preview.ellipse {
  height: 24px;
  border-radius: 50%;
}
.shape-preview.triangle {
  width: 0;
  height: 0;
  background: transparent;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-bottom: 34px solid var(--pink);
}
.shape-preview.star,
.element-icon {
  background: none;
  font-size: 2rem;
  color: var(--pink);
  line-height: 1;
}
.shape-preview.line {
  height: 3px;
  margin-top: 15px;
}
.shape-preview.arrow {
  background: none;
  font-size: 2.2rem;
  color: var(--pink);
}
.add-text-btn {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  text-align: left;
  margin-bottom: 8px;
}
.add-text-btn.heading {
  font-size: 1.5rem;
  font-weight: 900;
}
.add-text-btn.subheading {
  font-size: 1.15rem;
  font-weight: 700;
}
.field-group {
  margin-bottom: 13px;
}
.field-group label,
.field-row label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  color: var(--ink);
}
input[type="color"] {
  padding: 3px;
  height: 42px;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
}
.segmented button {
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 9px;
}
.segmented button:last-child {
  border: 0;
}
.segmented button.active {
  background: var(--ink);
  color: #fff;
}
.upload-box {
  border: 2px dashed var(--line);
  border-radius: 14px;
  min-height: 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  cursor: pointer;
  margin-bottom: 12px;
}
.upload-box:hover {
  border-color: var(--pink);
  background: #fff7fa;
}
.upload-box span {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 5px;
}
.upload-box.compact {
  min-height: 90px;
}
.layers-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.layer-row {
  display: grid;
  grid-template-columns: 36px 1fr 34px 34px;
  align-items: center;
  gap: 5px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}
.layer-row.selected {
  border-color: var(--pink);
  background: #fff7fa;
}
.layer-row .layer-main {
  border: 0;
  background: transparent;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.layer-row button {
  border: 0;
  background: transparent;
}
.layer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.layer-actions button {
  padding: 8px;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  margin: 10px 0;
}
.check-row input {
  width: auto;
}
.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 10px 0;
}
.button-grid.three {
  grid-template-columns: repeat(3, 1fr);
}
.button-grid button {
  padding: 9px;
}
.properties-panel h3,
.panel-view h3 {
  font-size: 0.85rem;
  margin: 18px 0 9px;
}
.workspace {
  position: relative;
  min-width: 0;
  background: #e9e7ef;
  overflow: hidden;
}
.workspace-topbar {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 5px;
  display: flex;
  gap: 4px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}
.workspace-topbar button {
  height: 34px;
  padding: 0 10px;
}
.viewport {
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  position: relative;
}
.artboard-stage {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-origin: 0 0;
}
.artboard-wrap {
  position: relative;
  background: #fff;
  box-shadow: 0 18px 50px rgba(23, 22, 34, 0.2);
}
#canvas {
  display: block;
  background: #fff;
  touch-action: none;
}
.guide {
  position: absolute;
  pointer-events: none;
}
.bleed {
  inset: 0;
  border: 1px dashed #888;
}
.trim {
  border: 2px solid #ee6d7b;
}
.safe {
  border: 2px solid #55a36c;
}
.preview-mode .guide {
  display: none;
}
.preview-mode .workspace-topbar {
  opacity: 0.15;
}
.preview-mode .workspace-topbar:hover {
  opacity: 1;
}
.mobile-only,
.mobile-toolbar {
  display: none;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: #171622;
  color: #fff;
  padding: 11px 16px;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  z-index: 100;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast.error {
  background: #a72042;
}
@media (max-width: 1180px) {
  :root {
    --panel: 260px;
    --props: 260px;
  }
  .designer-shell {
    grid-template-columns: 68px var(--panel) minmax(0, 1fr);
  }
  .properties-panel {
    position: fixed;
    right: 0;
    top: var(--header);
    bottom: 0;
    width: var(--props);
    transform: translateX(102%);
    transition: 0.2s;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.12);
  }
  .properties-panel.open {
    transform: none;
  }
}
@media (max-width: 760px) {
  :root {
    --header: 58px;
  }
  .desktop-only,
  .tool-rail {
    display: none !important;
  }
  .mobile-only {
    display: inline-flex;
  }
  .app-header {
    padding: 6px 8px;
  }
  .brand {
    display: none;
  }
  .design-title {
    width: 38vw;
    font-size: 0.9rem;
  }
  .save-state {
    display: none;
  }
  .btn {
    padding: 9px 11px;
    font-size: 0.8rem;
  }
  .header-actions {
    gap: 5px;
  }
  .header-actions .icon-btn {
    width: 34px;
    height: 34px;
  }
  .designer-shell {
    height: calc(100dvh - var(--header) - var(--mobilebar));
    display: block;
  }
  .workspace {
    height: 100%;
  }
  .side-panel {
    position: fixed;
    z-index: 40;
    left: 0;
    right: 0;
    bottom: var(--mobilebar);
    height: min(64vh, 580px);
    border: 0;
    border-radius: 18px 18px 0 0;
    transform: translateY(105%);
    transition: 0.22s;
    box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.16);
  }
  .side-panel.open {
    transform: none;
  }
  .side-panel .panel-head {
    height: 48px;
  }
  .properties-panel {
    z-index: 41;
    left: 0;
    right: 0;
    top: auto;
    bottom: var(--mobilebar);
    height: min(70vh, 620px);
    width: auto;
    border-radius: 18px 18px 0 0;
    transform: translateY(105%);
    transition: 0.22s;
  }
  .properties-panel.open {
    transform: none;
  }
  .mobile-toolbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    z-index: 50;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--mobilebar);
    padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--line);
  }
  .mobile-toolbar button {
    border: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 0.65rem;
  }
  .mobile-toolbar span {
    font-size: 1.25rem;
  }
  .workspace-topbar {
    top: 7px;
  }
  .workspace-topbar #preview-toggle {
    display: none;
  }
  .viewport {
    touch-action: none;
  }
  .toast {
    bottom: calc(var(--mobilebar) + 14px);
  }
}
.document-card {
  padding: 14px;
  border: 1px solid var(--line, #ddd);
  border-radius: 14px;
  background: var(--wash, #f7f7fa);
  margin-bottom: 14px;
}
.document-card h3 {
  margin-top: 0;
}
.check-row.inline {
  align-self: end;
  min-height: 42px;
}
.button-like {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line, #ccc);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
}
.button-like.full {
  width: 100%;
  box-sizing: border-box;
  margin-top: 8px;
}
.image-only h3 {
  margin-bottom: 8px;
}
.grid-visible canvas {
  background-image: linear-gradient(rgba(30, 30, 40, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 30, 40, 0.08) 1px, transparent 1px);
  background-size: 25px 25px;
}
.snap-line {
  position: absolute;
  z-index: 9;
  pointer-events: none;
  background: #00a3ff;
  display: none;
}
.snap-line.vertical {
  width: 1px;
  top: 0;
  bottom: 0;
}
.snap-line.horizontal {
  height: 1px;
  left: 0;
  right: 0;
}

.page-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 0 8px;
  scrollbar-width: thin;
}
.page-tab {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  padding: 8px 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.page-tab.active {
  border-color: var(--pink);
  background: #fff7fa;
  color: var(--pink-dark);
  font-weight: 800;
}
.page-tab .page-number {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--wash);
  font-size: 0.72rem;
}
.template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}
.template-grid button {
  min-height: 58px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, #fff, #f8f7fb);
  border-radius: 10px;
  padding: 9px;
  font-weight: 750;
  cursor: pointer;
}
.template-grid button:hover {
  border-color: var(--pink);
  background: #fff7fa;
}
@media (max-width: 760px) {
  .page-tabs {
    padding-bottom: 12px;
  }
  .page-tab {
    min-height: 42px;
  }
  .template-grid button {
    min-height: 64px;
  }
}

/* v2.4 selection, codes and richer styling */
.selection-summary {
  padding: 13px;
  border-radius: 12px;
  background: var(--wash);
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}
.selection-summary span {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}
.nudge-grid {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  justify-content: center;
  gap: 5px;
  margin: 10px 0;
}
.nudge-grid button {
  height: 42px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  font-weight: 900;
}
.nudge-grid button:active {
  background: var(--pink);
  color: #fff;
}
.code-icon {
  font-family: monospace;
  font-weight: 900;
}
.gradient-options[hidden],
.code-only[hidden],
.qr-only[hidden],
.barcode-only[hidden],
#multi-selection[hidden] {
  display: none !important;
}
.text-style-buttons button.active,
#multi-select-toggle.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.workspace-topbar button.active {
  background: var(--pink);
  border-color: var(--pink);
  color: #fff;
}
.layer-row.multi-selected {
  border-color: var(--pink);
  background: #fff7fa;
}
.layer-row.grouped .layer-main:after {
  content: "  • grouped";
  font-size: 0.68rem;
  color: var(--muted);
}
.layer-actions {
  grid-template-columns: 1fr 1fr;
}
.properties-panel textarea {
  resize: vertical;
}
.code-only .hint {
  margin-top: 8px;
}
.gradient-options input[type="color"] {
  height: 42px;
}
.multi-selection-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--pink);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
}
.workspace-topbar #zoom-selection {
  display: none;
}
.has-selection .workspace-topbar #zoom-selection {
  display: inline-block;
}
@media (max-width: 900px) {
  .workspace-topbar {
    max-width: calc(100vw - 18px);
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
  }
  .workspace-topbar::-webkit-scrollbar {
    display: none;
  }
  .workspace-topbar button {
    flex: 0 0 auto;
  }
}
@media (max-width: 760px) {
  .workspace-topbar {
    left: 8px;
    right: 8px;
    transform: none;
    justify-content: flex-start;
  }
  .workspace-topbar #fit-page,
  .workspace-topbar #grid-toggle {
    display: none;
  }
  .nudge-grid {
    grid-template-columns: repeat(3, 50px);
  }
  .nudge-grid button {
    height: 48px;
  }
  .selection-summary {
    position: sticky;
    top: 54px;
    z-index: 1;
  }
  .mobile-toolbar {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* v2.5 document setup, libraries and preflight */
.document-setup {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  margin: 10px 0 13px;
  overflow: hidden;
}
.document-setup summary {
  cursor: pointer;
  padding: 11px 12px;
  font-size: 0.82rem;
  font-weight: 850;
  background: #fbfafd;
}
.document-setup[open] summary {
  border-bottom: 1px solid var(--line);
}
.document-setup > div,
.document-setup > label {
  margin-left: 11px;
  margin-right: 11px;
}
.document-setup > .field-group {
  margin-top: 11px;
}
.small-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 750;
  color: var(--muted);
  margin: 11px 0 6px;
}
.library-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0 18px;
}
.component-card,
.asset-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  position: relative;
}
.component-card button,
.asset-card button {
  border: 0;
  background: #fff;
  cursor: pointer;
}
.component-main {
  width: 100%;
  min-height: 72px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  text-align: left;
}
.component-main strong {
  font-size: 0.8rem;
}
.component-main span {
  font-size: 0.7rem;
  color: var(--muted);
}
.component-delete,
.asset-delete {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 27px;
  height: 27px;
  border-radius: 7px !important;
  background: rgba(255, 255, 255, 0.92) !important;
  color: #a72042;
  font-weight: 900;
}
.asset-library {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 8px 0 18px;
}
.asset-card {
  aspect-ratio: 1/1;
}
.asset-main {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0 !important;
}
.asset-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.preflight-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.preflight-score {
  display: inline-grid;
  place-items: center;
  min-width: 40px;
  height: 28px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
}
.notice.warning {
  background: #fff5d9;
  color: #6e5200;
}
.notice.info {
  background: #eaf5ff;
  color: #185681;
}
.notice.success {
  background: #eaf7ef;
  color: #246c3d;
}
.notice.compact {
  padding: 9px 11px;
  margin-bottom: 7px;
  font-size: 0.78rem;
}
.text-overflow-badge {
  color: #a72042;
  font-weight: 800;
}
@media (max-width: 760px) {
  .document-setup summary {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .library-grid,
  .asset-library {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .component-main {
    min-height: 82px;
  }
  .nudge-step {
    min-height: 44px;
  }
}

/* v2.6 direct crop, touch navigation, saved templates and export safeguards */
.crop-toolbar {
  position: absolute;
  z-index: 10;
  left: 50%;
  top: 58px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(23, 22, 34, 0.96);
  color: #fff;
  padding: 8px 10px;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  max-width: calc(100% - 20px);
}
.crop-toolbar[hidden] {
  display: none;
}
.crop-toolbar > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.crop-toolbar strong {
  font-size: 0.82rem;
}
.crop-toolbar span {
  font-size: 0.7rem;
  color: #d9d6e2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crop-toolbar button {
  border: 1px solid #5b5768;
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 8px 11px;
  font-weight: 800;
  cursor: pointer;
}
.crop-toolbar button.primary {
  background: var(--pink);
  border-color: var(--pink);
  color: #fff;
}
.crop-mode #canvas {
  cursor: move;
}
.pan-mode #canvas,
.space-pan #canvas {
  cursor: grab;
}
.pan-mode.dragging-stage #canvas,
.space-pan.dragging-stage #canvas {
  cursor: grabbing;
}
.crop-mode .workspace-topbar {
  opacity: 0.28;
}
.crop-mode .workspace-topbar:hover {
  opacity: 1;
}
.export-preflight {
  margin: 10px 0;
}
.export-preflight .notice {
  margin-bottom: 6px;
}
.template-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  position: relative;
}
.template-card button {
  border: 0;
  background: #fff;
  cursor: pointer;
}
.template-main {
  width: 100%;
  min-height: 76px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  text-align: left;
}
.template-main strong {
  font-size: 0.8rem;
}
.template-main span {
  font-size: 0.7rem;
  color: var(--muted);
}
.template-delete {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 27px;
  height: 27px;
  border-radius: 7px !important;
  background: rgba(255, 255, 255, 0.94) !important;
  color: #a72042;
  font-weight: 900;
}
.export-size-warning {
  color: #8a5500;
  font-weight: 750;
}
@media (max-width: 760px) {
  .crop-toolbar {
    top: 52px;
    left: 8px;
    right: 8px;
    transform: none;
  }
  .crop-toolbar span {
    max-width: 44vw;
  }
  .crop-toolbar button {
    min-height: 40px;
  }
  .crop-mode .side-panel,
  .crop-mode .properties-panel {
    transform: translateY(105%);
  }
  .template-main {
    min-height: 86px;
  }
}


/* v2.7 production workflow additions */
.custom-guides { margin-top: 10px; }
.guide-add-row { align-items: end; }
.guide-list { display: grid; gap: 6px; margin-top: 8px; }
.guide-row { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; align-items: center; padding: 7px 8px; background: var(--wash); border: 1px solid var(--line); border-radius: 9px; font-size: .75rem; }
.guide-row button { min-width: 34px; min-height: 32px; padding: 4px 7px; }
.compact-search { margin-bottom: 8px; }
.brand-add-row { align-items: end; }
.brand-palette { display: flex; flex-wrap: wrap; gap: 8px; margin: 9px 0 15px; }
.brand-swatch { position: relative; width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--line); box-shadow: inset 0 0 0 2px rgba(255,255,255,.65); cursor: pointer; }
.brand-swatch span { position: absolute; left: 3px; right: 3px; bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .55rem; line-height: 1.2; padding: 2px 3px; border-radius: 5px; background: rgba(255,255,255,.88); color: #171622; }
.brand-swatch .brand-delete { position: absolute; right: -6px; top: -6px; width: 20px; height: 20px; min-height: 20px; padding: 0; border-radius: 50%; background: #fff; color: #9f2141; border: 1px solid var(--line); font-size: .75rem; font-weight: 900; }
.drop-overlay { position: absolute; inset: 12px; z-index: 30; display: none; align-items: center; justify-content: center; flex-direction: column; gap: 4px; border: 3px dashed var(--pink); border-radius: 18px; background: rgba(255,255,255,.94); color: #171622; pointer-events: none; }
.drop-overlay strong { font-size: 1.15rem; }
.dragging-files .drop-overlay { display: flex; }
.image-filters { margin: 10px 0; }
.image-filters summary { font-weight: 800; cursor: pointer; }
.template-grid button[hidden] { display: none !important; }
.asset-card.filtered-out, .template-card.filtered-out { display: none; }
@media (max-width: 760px) {
  .brand-swatch { width: 54px; height: 54px; }
  .drop-overlay { inset: 8px; }
  .guide-row { grid-template-columns: 1fr auto auto; }
}

.brand-swatch .brand-apply { position:absolute; inset:0; width:100%; height:100%; min-height:0; padding:0; border:0; background:transparent; border-radius:inherit; cursor:pointer; }
.brand-swatch > span { pointer-events:none; }

/* v2.8 platform integration */
.product-rules {
  padding: 12px;
  margin: 0 0 12px;
  border: 1px solid rgba(90, 44, 105, 0.22);
  border-radius: 12px;
  background: #f8f3fa;
  line-height: 1.4;
}
.product-rules strong {
  display: block;
  margin-bottom: 4px;
}
.product-rules p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}
.product-rules a {
  display: inline-block;
  margin-top: 8px;
  font-weight: 800;
}
button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed !important;
  opacity: 0.52;
}
body.upload-only .designer-shell {
  grid-template-columns: 74px minmax(0, 760px) minmax(0, 1fr);
}
body.upload-only .side-panel {
  grid-column: 2;
  border-right: 1px solid var(--line);
}
body.upload-only .workspace,
body.upload-only .properties-panel {
  display: none;
}
body.upload-only .tool-rail .tool:not([data-panel="uploads"]):not([data-panel="export"]) {
  display: none;
}
body.upload-only .mobile-toolbar button:not([data-mobile-panel="uploads"]):not([data-mobile-panel="export"]) {
  display: none;
}
@media (max-width: 820px) {
  body.upload-only .designer-shell {
    display: block;
  }
  body.upload-only .side-panel {
    display: block;
    width: 100%;
    height: calc(100dvh - var(--header) - var(--mobilebar));
  }
}

/* Accessibility and local-data controls */
:where(button,input,select,textarea,a):focus-visible{outline:3px solid #005fcc;outline-offset:3px}
.danger-outline{border-color:#9f2449!important;color:#7d1738!important;background:#fff!important}
