:root {
  --bg: #f3f6f5;
  --panel: rgba(255, 255, 255, 0.96);
  --panel-soft: #f7faf8;
  --text: #101915;
  --muted: #69756f;
  --line: #dfe8e3;
  --green: #06c755;
  --green-dark: #049c44;
  --green-soft: #eafaf0;
  --shadow: 0 18px 55px rgba(16, 48, 33, 0.09);
  --shadow-soft: 0 8px 28px rgba(16, 48, 33, 0.07);
}

body {
  background:
    radial-gradient(circle at 82% 0%, rgba(6, 199, 85, 0.09), transparent 30%),
    radial-gradient(circle at 10% 90%, rgba(37, 99, 235, 0.06), transparent 28%),
    var(--bg);
}

.sidebar {
  background: linear-gradient(180deg, #0b1712 0%, #101e18 58%, #0b1511 100%);
  border-right: 1px solid rgba(255,255,255,.05);
  box-shadow: 14px 0 42px rgba(11, 23, 18, .08);
}

.brand-mark {
  background: linear-gradient(145deg, #13db68, #05ad4b);
  box-shadow: 0 12px 30px rgba(6, 199, 85, .32);
}

.nav-item { border: 1px solid transparent; }
.nav-item.active {
  border-color: rgba(58, 232, 129, .16);
  background: linear-gradient(90deg, rgba(6,199,85,.21), rgba(6,199,85,.07));
}

.main-content { max-width: 1680px; width: 100%; margin: 0 auto; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  margin: -18px -18px 28px;
  padding: 18px;
  border-bottom: 1px solid rgba(218, 230, 223, .72);
  background: rgba(243, 246, 245, .82);
  backdrop-filter: blur(18px);
}

.primary-button {
  min-height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #08cf5b, #04ad49);
  box-shadow: 0 10px 24px rgba(6,199,85,.22);
}
.primary-button:hover { box-shadow: 0 14px 30px rgba(6,199,85,.3); }

.secondary-button {
  min-height: 42px;
  border: 1px solid #dde6e1;
  background: #fff;
  box-shadow: 0 4px 14px rgba(20, 44, 32, .04);
}

.welcome-card,
.workspace-card,
.form-card,
.validation-card,
.preview-card,
.helper-card,
.project-card,
.stat-card {
  border-color: rgba(215, 229, 221, .9);
  box-shadow: var(--shadow-soft);
}

.welcome-card {
  position: relative;
  isolation: isolate;
  background: linear-gradient(135deg, rgba(255,255,255,.98), rgba(238,253,244,.98));
  box-shadow: var(--shadow);
}
.welcome-card::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: auto -70px -90px auto;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: rgba(6,199,85,.09);
  filter: blur(6px);
}

.stat-card { position: relative; overflow: hidden; }
.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(#08cf5b, #049c44);
  opacity: .65;
}

.stepper {
  position: sticky;
  top: 96px;
  z-index: 20;
  padding: 8px;
  border: 1px solid rgba(217, 230, 223, .82);
  border-radius: 18px;
  background: rgba(249, 252, 250, .9);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 26px rgba(16,48,33,.06);
}
.step { border: 1px solid transparent; background: transparent; }
.step.active {
  border-color: rgba(6,199,85,.18);
  box-shadow: inset 0 0 0 1px rgba(6,199,85,.04);
}

.workspace-card,
.form-card,
.validation-card,
.preview-card {
  border-radius: 26px;
  background: rgba(255,255,255,.97);
}
.helper-card { border-radius: 22px; background: linear-gradient(160deg, #fff, #f5fff8); }

.dropzone {
  min-height: 275px;
  border-width: 1.5px;
  background:
    linear-gradient(#fbfffc, #fbfffc) padding-box,
    linear-gradient(135deg, rgba(6,199,85,.65), rgba(40,120,255,.25)) border-box;
  border-color: transparent;
  box-shadow: inset 0 0 0 1px rgba(6,199,85,.04);
}

.sticker-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.sticker-card {
  position: relative;
  overflow: hidden;
  padding: 9px;
  border-radius: 18px;
  background: linear-gradient(180deg, #fff, #fbfcfb);
  box-shadow: 0 7px 22px rgba(17, 42, 29, .06);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.sticker-card:hover {
  transform: translateY(-2px);
  border-color: #bfe7ce;
  box-shadow: 0 13px 30px rgba(17,42,29,.11);
}
.sticker-card img {
  min-height: 132px;
  background-color: #f8faf9;
  background-image:
    linear-gradient(45deg, #eef2f0 25%, transparent 25%),
    linear-gradient(-45deg, #eef2f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef2f0 75%),
    linear-gradient(-45deg, transparent 75%, #eef2f0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.sticker-index {
  width: max-content;
  margin: 8px 0 0;
  padding: 4px 8px;
  border-radius: 999px;
  background: #edf3ef;
}

.sticker-order-buttons {
  display: flex;
  gap: 5px;
  margin-top: 7px;
}
.sticker-order-buttons button {
  min-width: 34px;
  min-height: 30px;
  border: 1px solid #dce7e1;
  border-radius: 9px;
  background: #fff;
  color: #405149;
  font-weight: 900;
  cursor: pointer;
}
.sticker-order-buttons button:hover:not(:disabled) {
  border-color: #8bd9aa;
  color: #047c37;
  background: #f1fff6;
}
.sticker-order-buttons button:disabled { opacity: .3; cursor: default; }

.sticker-enhance-meta { margin-top: 9px; display: grid; gap: 7px; }
.sticker-file-name {
  width: 100%;
  overflow: hidden;
  color: #34443c;
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sticker-card-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sticker-mini-button {
  min-height: 34px;
  border: 1px solid #dce7e1;
  border-radius: 10px;
  background: #fff;
  color: #304239;
  font-size: 11px;
  font-weight: 800;
}
.sticker-mini-button:hover {
  border-color: #9bd9b3;
  color: #047c37;
  background: #f2fff7;
}

.honest-empty-state { grid-column: 1 / -1; }
.honest-empty-state .primary-button { margin-top: 10px; }

.upload-enhance-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #edf1ef;
}

.editor-backdrop {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(7, 18, 13, .68);
  backdrop-filter: blur(10px);
}
.editor-backdrop.hidden { display: none !important; }

.sticker-editor {
  width: min(1180px, 96vw);
  max-height: 94vh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 34px 90px rgba(0,0,0,.28);
}

.editor-head,
.editor-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid #e7eeea;
}
.editor-foot { border-top: 1px solid #e7eeea; border-bottom: 0; }
.editor-head h2 { margin: 0; font-size: 20px; }
.editor-head p { margin: 3px 0 0; font-size: 12px; }
.editor-close {
  width: 40px;
  height: 40px;
  border: 1px solid #dfe7e3;
  border-radius: 12px;
  background: #fff;
  font-size: 22px;
}

.editor-body { min-height: 0; display: grid; grid-template-columns: minmax(0,1.45fr) minmax(300px,.55fr); }
.editor-stage-wrap {
  min-height: 520px;
  padding: 22px;
  display: grid;
  place-items: center;
  overflow: auto;
  background: #eef3f0;
}
.editor-stage {
  position: relative;
  display: grid;
  place-items: center;
  max-width: 100%;
  max-height: 68vh;
  padding: 22px;
  border: 1px solid #dae4de;
  border-radius: 20px;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #e9eeeb 25%, transparent 25%),
    linear-gradient(-45deg, #e9eeeb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e9eeeb 75%),
    linear-gradient(-45deg, transparent 75%, #e9eeeb 75%);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
  box-shadow: 0 20px 50px rgba(20,48,34,.08);
}
#editorCanvas {
  display: block;
  max-width: min(720px, 62vw);
  max-height: 64vh;
  touch-action: none;
  cursor: crosshair;
}
.crop-selection {
  position: absolute;
  display: none;
  border: 2px solid #06c755;
  background: rgba(6,199,85,.12);
  box-shadow: 0 0 0 9999px rgba(10,22,16,.35);
  pointer-events: none;
}

.editor-panel {
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  border-left: 1px solid #e5ece8;
  background: #fbfdfc;
}
.editor-section { padding: 14px 0; border-bottom: 1px solid #e7eeea; }
.editor-section:first-child { padding-top: 0; }
.editor-section:last-child { border-bottom: 0; }
.editor-section h3 { margin: 0 0 9px; font-size: 14px; }
.editor-section p { margin-bottom: 9px; font-size: 12px; }

.editor-input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #dbe5df;
  border-radius: 11px;
  padding: 9px 11px;
  background: #fff;
  outline: none;
}
.editor-input:focus { border-color: #61ce8d; box-shadow: 0 0 0 3px rgba(6,199,85,.1); }

.editor-tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.editor-tool-button {
  min-height: 40px;
  border: 1px solid #dbe5df;
  border-radius: 11px;
  padding: 8px 10px;
  background: #fff;
  color: #2b3b33;
  font-size: 12px;
  font-weight: 750;
}
.editor-tool-button:hover,
.editor-tool-button.active { border-color: #83d8a5; color: #047b37; background: #effcf4; }
.editor-tool-button.danger { color: #ba3e3e; }

.editor-range-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 9px;
  font-size: 12px;
}
.editor-range-row input[type="range"] { width: 100%; accent-color: #06c755; }
.editor-status { min-height: 20px; color: #617068; font-size: 12px; }
.editor-status.success { color: #04843a; }
.editor-status.error { color: #c33d3d; }
.editor-foot-left,
.editor-foot-right { display: flex; flex-wrap: wrap; gap: 8px; }

.package-panel {
  border-radius: 20px !important;
  border-color: #caead7 !important;
  background: linear-gradient(145deg, #f9fffb, #effbf4) !important;
  box-shadow: 0 12px 32px rgba(6,199,85,.08);
}
.package-panel .primary-button { min-width: 180px; }

@media (max-width: 900px) {
  .topbar { position: relative; top: auto; }
  .stepper { position: relative; top: auto; }
  .editor-body { grid-template-columns: 1fr; }
  .editor-stage-wrap { min-height: 360px; }
  .editor-panel { border-left: 0; border-top: 1px solid #e5ece8; }
  #editorCanvas { max-width: 78vw; max-height: 46vh; }
}

@media (max-width: 640px) {
  .sticker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .sticker-order-buttons button { flex: 1; min-height: 34px; }
  .editor-backdrop { padding: 6px; }
  .sticker-editor { width: 100%; max-height: 98vh; border-radius: 18px; }
  .editor-stage-wrap { padding: 10px; }
  .editor-stage { padding: 12px; }
  .editor-panel { padding: 15px; }
  .editor-head, .editor-foot { padding: 12px; }
  .editor-tool-grid { grid-template-columns: 1fr; }
  .editor-foot { align-items: stretch; flex-direction: column; }
  .editor-foot-left, .editor-foot-right { width: 100%; }
  .editor-foot button { flex: 1; }
}