:root {
  --bg: #efe8dd;
  --panel: rgba(255, 252, 247, .84);
  --line: #ddd4c7;
  --text: #243024;
  --muted: #677166;
  --primary: #34472C;
  --primary-2: #567649;
  --accent: #E7DFD0;
  --shadow: 0 18px 40px rgba(31, 43, 24, 0.08);
  --radius: 22px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(180deg, #eee7dc 0%, #f7f4ee 100%);
  color: var(--text);
}
button, input, select { font: inherit; }
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 420px 1fr;
}
.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(255,255,255,.52);
  backdrop-filter: blur(14px);
  padding: 24px;
  overflow-y: auto;
}
.workspace { padding: 28px; }
.brand-block h1 {
  margin: 8px 0 10px;
  font-size: 34px;
  line-height: 1.05;
}
.brand-block p { color: var(--muted); margin: 0 0 16px; }
.badge, .section-kicker {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #ecf1e8;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 16px;
}
.panel h2, .panel h3 { margin: 0 0 10px; }
.panel h2 { font-size: 18px; }
.panel h3 { font-size: 14px; }
.panel-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.upload-box {
  display: grid;
  place-items: center;
  min-height: 156px;
  border: 1.5px dashed #9cb08d;
  border-radius: 18px;
  background: linear-gradient(180deg, #f7faf5, #edf3e8);
  text-align: center;
  padding: 20px;
  cursor: pointer;
}
.upload-box:hover { border-color: var(--primary); }
.upload-title { font-weight: 700; font-size: 16px; display: block; }
.upload-subtitle { color: var(--muted); font-size: 13px; display: block; margin-top: 4px; }
.tiny-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.uploads-strip {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 10px;
}
.upload-thumb {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.8);
  aspect-ratio: 1/1;
  display: grid;
  place-items: center;
}
.upload-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}
.mini-btn {
  border: 0;
  background: #e8efe1;
  color: var(--primary);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer;
}
.mini-btn.ghost { background: #f2ede5; }
.field-grid {
  display: grid;
  gap: 14px;
}
label span { display: block; font-size: 13px; font-weight: 700; margin-bottom: 8px; }
input[type='range'], select { width: 100%; accent-color: var(--primary-2); }
small { color: var(--muted); display: block; margin-top: 6px; }
.muted { color: var(--muted); }
.template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.template-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255,255,255,.8);
  transition: .2s ease;
  cursor: pointer;
}
.template-card.active {
  border-color: var(--primary-2);
  box-shadow: 0 10px 22px rgba(86, 118, 73, .18);
}
.template-thumb {
  position: relative;
  aspect-ratio: 1/1;
  background: linear-gradient(180deg, #f5efe5, #e7dfd3);
  display: grid;
  place-items: center;
}
.template-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}
.template-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(0,0,0,.08);
  display: grid;
  place-items: center;
  font-size: 12px;
}
.template-body { padding: 10px; }
.template-name { font-weight: 700; font-size: 13px; line-height: 1.25; }
.template-sub { color: var(--muted); font-size: 11px; margin-top: 4px; }
.palette-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.palette-list { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px 4px 4px;
}
.swatch {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 2px solid rgba(0,0,0,.08);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.35);
}
.swatch-code { font-size: 11px; font-weight: 700; color: #4a5449; text-transform: uppercase; }
.swatch-x {
  border: 0;
  background: transparent;
  color: #8b8477;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}
.actions-panel { display: grid; gap: 10px; }
.btn {
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: white; }
.btn-secondary { background: var(--primary-2); color: white; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.workspace-top {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 20px;
}
.workspace-top h2 { margin: 8px 0 6px; font-size: 32px; }
.status-pill {
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  background: #eef3ea;
  color: var(--primary);
}
.empty-state {
  min-height: 60vh;
  border: 1px dashed var(--line);
  border-radius: 28px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 28px;
  background: rgba(255,255,255,.45);
}
.empty-icon { font-size: 48px; }
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.card {
  background: rgba(255,255,255,.74);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.card canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #e9e6e0;
}
.card-body { padding: 14px; }
.card-topline {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}
.filename { font-weight: 700; font-size: 14px; line-height: 1.35; word-break: break-word; }
.tag {
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.meta-item {
  background: #f3f0ea;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  color: #495249;
}
.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.card-actions button {
  border: 0;
  border-radius: 12px;
  padding: 11px 12px;
  background: #eef2eb;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
}
.card-actions button.primary-mini { background: var(--primary); color: white; }
.hidden { display: none; }

/* Editor modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 25, 18, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 50;
}
.modal.open { display: flex; }
.modal-card {
  width: min(1080px, 100%);
  max-height: min(92vh, 900px);
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 22px 60px rgba(0,0,0,0.28);
}
.modal-left {
  padding: 18px;
  background: linear-gradient(180deg, #f6f0e6, #ece5d8);
}
.modal-right {
  padding: 18px;
  border-left: 1px solid var(--line);
  overflow: auto;
}
.modal-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.modal-title {
  font-weight: 800;
  font-size: 16px;
}
.close-btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.06);
  cursor: pointer;
  font-weight: 800;
}
.editor-canvas {
  width: 100%;
  height: auto;
  border-radius: 18px;
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(0,0,0,0.08);
}
.editor-help {
  color: var(--muted);
  font-size: 12px;
  margin-top: 10px;
}
.editor-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}
.row {
  display: grid;
  gap: 10px;
}
.row.two { grid-template-columns: 1fr 1fr; }
.editor-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.editor-actions button {
  border: 0;
  border-radius: 14px;
  padding: 12px 12px;
  cursor: pointer;
  font-weight: 800;
}
.editor-actions .primary { background: var(--primary); color: white; }
.editor-actions .ghost { background: #f2ede5; color: var(--primary); }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 820px) {
  .modal-card { grid-template-columns: 1fr; }
  .modal-right { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .workspace { padding: 18px; }
  .sidebar { padding: 18px; }
  .workspace-top { flex-direction: column; align-items: start; }
  .palette-columns, .template-grid { grid-template-columns: 1fr; }
}

.pill-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}


.result-design-thumb{padding:12px 12px 0 12px;display:flex;justify-content:flex-start}
.result-design-thumb img{width:64px;height:64px;object-fit:contain;background:rgba(255,255,255,.7);border:1px solid var(--line);border-radius:12px;padding:6px}
