body.is-editing {
  padding-bottom: var(--edit-space, 168px);
}

body.is-editing [data-color] {
  position: relative;
}

.edit-swatch {
  position: absolute;
  z-index: 4;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 2px solid #fff;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(18, 18, 18, 0.28);
  overflow: hidden;
  cursor: pointer;
}

.icon .edit-swatch {
  top: -8px;
  right: -8px;
}

.edit-swatch input {
  width: 42px;
  height: 42px;
  margin: -8px;
  padding: 0;
  border: 0;
  cursor: pointer;
}

body.is-editing [data-edit] {
  outline: 1px dashed rgba(252, 132, 0, 0.9);
  outline-offset: 3px;
  cursor: text;
}

body.is-editing [data-edit].is-editing-target {
  outline: 2px solid var(--orange);
  background: rgba(255, 255, 255, 0.18);
}

body.is-editing img[data-media] {
  outline: 2px dashed rgba(252, 132, 0, 0.95);
  outline-offset: 4px;
  cursor: pointer;
}

body.is-editing .cookie {
  bottom: var(--edit-space, 176px);
}

.edit-bar {
  position: fixed;
  z-index: 90;
  left: 0;
  right: 0;
  bottom: 12px;
  display: grid;
  gap: 8px;
  width: min(640px, calc(100% - 20px));
  margin: 0 auto;
  padding: 10px;
  border: 1px solid #ececec;
  border-radius: 16px;
  background: #fff;
  color: #141414;
  box-shadow: 0 12px 32px rgba(18, 18, 18, 0.12);
}

.edit-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.edit-hint,
.edit-status {
  margin: 0;
}

.edit-hint {
  color: #8a8a8a;
  font-size: 0.78rem;
  line-height: 1.35;
}

.edit-status {
  flex: none;
  color: #8a8a8a;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.edit-status[data-kind="ok"] {
  color: #0f7a32;
}

.edit-status[data-kind="error"] {
  color: var(--danger);
}

.edit-status[data-kind="dirty"] {
  color: #9a5b00;
}

.edit-bar .btn {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 0.88rem;
}

.edit-bar .btn:hover {
  transform: none;
}

.edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

@media (max-width: 640px) {
  .edit-top {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .edit-actions {
    gap: 4px;
  }

  .edit-actions .btn {
    padding: 0 8px;
    font-size: 0.8rem;
  }
}

.edit-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
}

.edit-colors[hidden],
.edit-frames[hidden] {
  display: none;
}

.edit-frames {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
  padding: 3px;
  border-radius: 12px;
  background: #f3f3f3;
}

.edit-frames .btn {
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #3f3f3f;
  font-size: 0.82rem;
}

.edit-frames .btn:hover {
  border-color: transparent;
  background: #fff;
}

.edit-frames .btn.is-selected,
.edit-frames .btn.is-selected:hover {
  background: var(--orange);
  color: #1a1208;
}

body.is-cropping {
  overflow: hidden;
}

.cropper {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: flex;
  padding: 12px;
  background: rgba(18, 18, 18, 0.72);
}

.crop-sheet {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(560px, 100%);
  max-height: min(100%, 860px);
  margin: auto;
  padding: 14px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 16px 50px rgba(18, 18, 18, 0.18);
}

.crop-hint {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.4;
}

.crop-stage {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  margin: 0 auto;
  touch-action: none;
  line-height: 0;
}

.crop-image {
  display: block;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
}

.crop-box {
  position: absolute;
  border: 2px solid #fff;
  box-shadow: 0 0 0 9999px rgba(17, 17, 17, 0.55);
  touch-action: none;
  cursor: move;
}

.crop-box span {
  position: absolute;
  width: 44px;
  height: 44px;
  touch-action: none;
  cursor: nwse-resize;
}

.crop-box span::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 11px;
  width: 22px;
  height: 22px;
  border: 2px solid #fff;
  border-radius: 7px;
  background: var(--orange);
}

.crop-box span[data-handle="nw"] { left: -22px; top: -22px; }
.crop-box span[data-handle="ne"] { right: -22px; top: -22px; cursor: nesw-resize; }
.crop-box span[data-handle="sw"] { left: -22px; bottom: -22px; cursor: nesw-resize; }
.crop-box span[data-handle="se"] { right: -22px; bottom: -22px; }

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

.edit-colors label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 700;
}

.edit-colors input {
  width: 42px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--mist);
}

.login-card {
  width: min(380px, 100%);
  padding: 28px 24px 24px;
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-card img {
  height: 64px;
  width: auto;
}

.login-card h1 {
  margin: 16px 0 6px;
  font-size: 1.55rem;
}

.login-lead {
  margin: 0 0 18px;
  color: var(--muted);
}

.login-card form {
  display: grid;
  gap: 6px;
}

.login-card label {
  font-size: 0.92rem;
  font-weight: 700;
}

.login-field {
  position: relative;
}

.login-field input {
  width: 100%;
  min-height: 48px;
  padding: 0 92px 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
}

.login-field input:focus {
  outline: 2px solid var(--orange);
  border-color: transparent;
}

.login-field .btn-text {
  position: absolute;
  top: 50%;
  right: 6px;
  min-height: 36px;
  margin: 0;
  padding: 0 10px;
  transform: translateY(-50%);
  border-radius: 9px;
  background: var(--mist);
  color: var(--ink);
  font-size: 0.9rem;
  text-decoration: none;
}

.login-field .btn-text:hover {
  transform: translateY(-50%);
  background: var(--line);
}

.login-card .btn-primary {
  width: 100%;
  margin-top: 8px;
}

.login-error {
  margin: 2px 0 0;
  color: var(--danger);
  font-size: 0.92rem;
  font-weight: 700;
}

.login-error[hidden] {
  display: none;
}
