* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f5f6f8;
  color: #141414;
  font-size: 15px;
  line-height: 1.4;
  min-height: 100%;
}

/* TOP BAR ACTIONS */
.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.download-btn {
  background: rgba(255,255,255,.12);
  border: none;
  color: #fff;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .5px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  line-height: 1;
}
.download-btn:active { background: rgba(255,255,255,.25); }

input, button { font-family: inherit; font-size: inherit; }
img { display: block; max-width: 100%; }

/* TOP BAR */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #141414;
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(0,0,0,.15);
}
.topbar-title {
  font-weight: 800;
  letter-spacing: 1.5px;
  font-size: 14px;
  display: flex; align-items: center; gap: 8px;
}
.topbar-title small {
  font-weight: 400;
  opacity: .6;
  letter-spacing: 1px;
  font-size: 11px;
}

/* EDIT BUTTON */
.edit-btn {
  background: rgba(255,255,255,.12);
  border: none;
  color: #fff;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .5px;
  cursor: pointer;
}
.edit-btn:active { background: rgba(255,255,255,.25); }
.edit-btn.locked { background: #e04343; }

/* SAVE BAR */
.save-bar {
  position: sticky;
  top: 54px;
  z-index: 40;
  padding: 10px 14px;
  background: #f5f6f8;
  border-bottom: 1px solid #ececec;
}
.btn-save {
  width: 100%;
  padding: 13px;
  background: #141414;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  font-size: 14px;
  cursor: pointer;
}
.btn-save:active { transform: scale(.99); }
.btn-save:disabled { opacity: .6; }

/* CONTAINER */
.container { padding: 14px; max-width: 700px; margin: 0 auto; }

/* PRODUCT BLOCK */
.product-block {
  background: #fff;
  border-radius: 16px;
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(20,20,20,.05);
}
.product-name {
  font-size: 15px;
  font-weight: 700;
  padding: 14px 16px 10px;
  border-bottom: 1px solid #f0f0f2;
  color: #141414;
}

/* COLOR ROW */
.color-row {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #f5f5f7;
}
.color-row:last-child { border-bottom: none; }

.img-wrap {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  background: #f2f2f4;
}
.img-wrap img { width: 100%; height: 100%; object-fit: cover; }

.size-area { flex: 1; min-width: 0; }

.color-title {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  background: #f0f0f3;
  color: #444;
  padding: 3px 9px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.size-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 10px;
}
.size-label {
  font-size: 13px;
  color: #666;
  font-weight: 600;
  min-width: 34px;
}
.size-line input {
  width: 78px;
  padding: 9px 10px;
  text-align: center;
  border: 1.5px solid #e2e4e8;
  border-radius: 10px;
  background: #fafbfc;
  font-weight: 600;
  outline: none;
  transition: border-color .15s, background .15s;
  -moz-appearance: textfield;
}
.size-line input::-webkit-outer-spin-button,
.size-line input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.size-line input:focus {
  border-color: #141414;
  background: #fff;
}
.size-line input:disabled {
  background: #f0f0f2;
  color: #888;
  border-color: #e8e8ea;
  cursor: not-allowed;
}

/* TOTAL */
.total-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding: 9px 12px;
  background: #f5f6f8;
  border-radius: 10px;
  font-size: 13px;
  color: #666;
}
.total-line b { font-size: 16px; color: #141414; }

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
}
.modal-overlay.show { display: flex; }

.modal-box {
  background: #fff;
  border-radius: 18px;
  padding: 22px;
  width: 100%;
  max-width: 320px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.modal-box h3 {
  font-size: 15px;
  margin-bottom: 14px;
  color: #141414;
}
.modal-box input {
  width: 100%;
  padding: 14px;
  border: 1.5px solid #e2e4e8;
  border-radius: 12px;
  text-align: center;
  font-size: 20px;
  letter-spacing: 6px;
  outline: none;
  margin-bottom: 14px;
}
.modal-box input:focus { border-color: #141414; }

.modal-actions { display: flex; gap: 10px; }
.modal-actions button {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.btn-cancel { background: #ececec; color: #444; }
.btn-confirm { background: #141414; color: #fff; }
.modal-error {
  color: #d33;
  font-size: 13px;
  margin-top: 10px;
  min-height: 16px;
}

/* TOAST */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%) translateY(120px);
  background: #1fb95a;
  color: #fff;
  padding: 13px 22px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
  z-index: 999;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.error { background: #e04343; }

.bottom-spacer { height: 80px; }